2194
* Tests for make_action_link.
2196
suite.add(new Y.Test.Case({
2197
name: 'Test make_action_link.',
2200
window.LP = {cache: {},
2202
module._lp_client = new LPClient();
2203
// Set up the required elements.
2204
this.content_node = Y.Node.create('<div></div>')
2205
.set('id', 'description-container');
2206
this.parent_node = Y.one('#test-root');
2207
this.parent_node.appendChild(this.content_node);
2209
description_box: '#description-container'
2211
this.config.subscription_info = {
2212
direct: _constructCategory(),
2213
from_duplicate: _constructCategory(),
2214
as_assignee: _constructCategory(),
2215
as_owner: _constructCategory(),
2221
tearDown: function() {
2223
delete module._lp_client;
2224
this.content_node.remove();
2225
this.parent_node.empty(true);
2229
test_link_parts: function() {
2230
var node = module._make_action_link(
2231
'some text', 'some-sprite', 'a_method', {});
2232
Y.Assert.isTrue(node.hasClass('some-sprite'));
2233
Y.Assert.isTrue(node.hasClass('js-action'));
2234
Y.Assert.isTrue(node.hasClass('sprite'));
2235
Y.Assert.isTrue(node.hasClass('modify'));
2236
Y.Assert.isFalse(node.hasClass('spinner'));
2237
Y.Assert.areEqual('some text', node.get('text'));
2240
test_on_click_handles_spinner: function() {
2241
var node = module._make_action_link(
2242
'some text', 'some-sprite', 'a_method', {});
2243
window.LP.cache = {context: {bug_link: 'http://bug/'},
2244
bug_subscription_info: {
2245
direct: {personal: []}
2248
module.show_subscription_description(this.config);
2249
// Setup the LP client to simulate a response.
2250
//module._lp_client.named_post.halt = true;
2251
module._lp_client.named_post.args = [];
2252
module._lp_client.named_post.halt = true;
2253
Y.Event.simulate(Y.Node.getDOMNode(node), 'click');
2254
this.wait(function() {
2256
Y.Assert.isTrue(node.hasClass('spinner'));
2258
module._lp_client.named_post.resume();
2259
Y.Assert.isFalse(node.hasClass('spinner'));
2192
2265
var handle_complete = function(data) {
2193
2266
status_node = Y.Node.create(
2194
2267
'<p id="complete">Test status: complete</p>');