1
YUI().use('lp.testing.runner', 'test', 'console', 'node', 'lazr.picker',
3
'event', 'node-event-simulate', 'dump', function(Y) {
5
var suite = new Y.Test.Suite("lp.bugs.subscribers Tests");
6
var module = Y.lp.bugs.subscribers;
9
suite.add(new Y.Test.Case({
10
name: 'BugSubscribersList constructor test',
13
this.root = Y.Node.create('<div />');
14
Y.one('body').appendChild(this.root);
17
tearDown: function() {
21
setUpLoader: function() {
22
this.root.appendChild(
23
Y.Node.create('<div />').addClass('container'));
24
var bug = { web_link: '/base', self_link: '/bug/1'};
25
return new module.createBugSubscribersLoader({
26
container_box: '.container',
28
subscribers_details_view: '/+bug-portlet-subscribers-details'});
31
test_subscribers_list_instantiation: function() {
35
test_addSubscriber: function() {
36
// Check that the subscription list has been created with the expected
37
// subscription levels for bugs. This can be done by adding a
38
// subscriber to one of the expected levels and checking the results.
39
var loader = this.setUpLoader(this.root);
40
var node = loader.subscribers_list.addSubscriber(
41
{ name: 'user' }, 'Lifecycle');
43
// Node is constructed using _createSubscriberNode.
44
Y.Assert.isTrue(node.hasClass('subscriber'));
45
// And the ID is set inside addSubscriber() method.
46
Y.Assert.areEqual('subscriber-user', node.get('id'));
48
// And it nested in the subscribers-list of a 'Level3' section.
49
var list_node = node.ancestor('.subscribers-list');
50
Y.Assert.isNotNull(list_node);
51
var section_node = list_node.ancestor(
52
'.subscribers-section-lifecycle');
53
Y.Assert.isNotNull(section_node);
57
Y.lp.testing.Runner.run(suite);