13129.1.4
by j.c.sackett
Added stub of tests. |
1 |
/* Copyright 2011 Canonical Ltd. This software is licensed under the
|
2 |
* GNU Affero General Public License version 3 (see the file LICENSE).
|
|
3 |
*/
|
|
4 |
||
5 |
YUI({ |
|
6 |
base: '../../../../canonical/launchpad/icing/yui/', |
|
7 |
filter: 'raw', combine: false, |
|
8 |
fetchCSS: false |
|
13129.1.9
by j.c.sackett
Tests complete. |
9 |
}).use('test', 'console', 'plugin', 'lp.registry.personpicker', |
10 |
'node-event-simulate', function(Y) { |
|
13129.1.4
by j.c.sackett
Added stub of tests. |
11 |
|
12 |
var suite = new Y.Test.Suite("lp.registry.personpicker Tests"); |
|
13 |
||
14 |
suite.add(new Y.Test.Case({ |
|
15 |
name: 'personpicker', |
|
16 |
||
17 |
setUp: function() { |
|
18 |
window.LP = { |
|
13129.1.9
by j.c.sackett
Tests complete. |
19 |
links: {me: '/~no-one'}, |
13129.1.4
by j.c.sackett
Added stub of tests. |
20 |
cache: {} |
21 |
}
|
|
22 |
},
|
|
13129.1.9
by j.c.sackett
Tests complete. |
23 |
|
13129.1.5
by j.c.sackett
Test updates. |
24 |
test_render: function () { |
25 |
var personpicker = new Y.lp.registry.personpicker.PersonPicker(); |
|
26 |
personpicker.render(); |
|
13129.1.9
by j.c.sackett
Tests complete. |
27 |
personpicker.show(); |
28 |
||
29 |
// The extra buttons section exists
|
|
30 |
Y.Assert.isNotNull(Y.one('.extra-form-buttons')); |
|
31 |
Y.Assert.isNotNull(Y.one('.yui-picker-remove-button')); |
|
32 |
Y.Assert.isNotNull(Y.one('.yui-picker-assign-me-button')); |
|
13129.1.5
by j.c.sackett
Test updates. |
33 |
},
|
13129.1.9
by j.c.sackett
Tests complete. |
34 |
|
35 |
test_buttons: function () { |
|
36 |
var personpicker = new Y.lp.registry.personpicker.PersonPicker(); |
|
37 |
personpicker.render(); |
|
38 |
personpicker.show(); |
|
39 |
||
40 |
// Patch the picker so the assign_me and remove methods can be
|
|
41 |
// tested.
|
|
42 |
var data = null; |
|
43 |
personpicker.on('save', function (result) { |
|
44 |
data = result.value; |
|
45 |
});
|
|
46 |
var remove = Y.one('.yui-picker-remove-button'); |
|
47 |
remove.simulate('click'); |
|
48 |
Y.Assert.areEqual('', data); |
|
13129.1.4
by j.c.sackett
Added stub of tests. |
49 |
|
13129.1.9
by j.c.sackett
Tests complete. |
50 |
var assign_me = Y.one('.yui-picker-assign-me-button'); |
51 |
assign_me.simulate('click'); |
|
52 |
Y.Assert.areEqual('no-one', data); |
|
53 |
}
|
|
54 |
}));
|
|
13129.1.4
by j.c.sackett
Added stub of tests. |
55 |
|
56 |
// Lock, stock, and two smoking barrels.
|
|
57 |
Y.Test.Runner.add(suite); |
|
58 |
||
59 |
var console = new Y.Console({newestOnTop: false}); |
|
60 |
console.render('#log'); |
|
61 |
||
62 |
Y.on('domready', function() { |
|
63 |
Y.Test.Runner.run(); |
|
64 |
});
|
|
65 |
});
|
|
66 |