13885.3.4
by Graham Binns
Added standard_test_template.(js|html) to help people not have to cargo-cult boilerplate. |
1 |
/* Copyright (c) 2011, Canonical Ltd. All rights reserved. */
|
2 |
YUI({ |
|
3 |
base: '../../../../canonical/launchpad/icing/yui/', |
|
4 |
filter: 'raw', |
|
5 |
combine: false, |
|
6 |
fetchCSS: false |
|
7 |
||
8 |
// Don't forget to add the module under test to the use() clause.
|
|
9 |
||
10 |
}).use('event', 'lp.client', 'node', 'test', 'widget-stack', |
|
11 |
'console', function(Y) { |
|
12 |
||
13 |
// Local aliases
|
|
14 |
var Assert = Y.Assert, |
|
15 |
ArrayAssert = Y.ArrayAssert; |
|
13885.3.6
by Graham Binns
Updated the test templates to make them match the wiki. |
16 |
var mynamespace = Y.lp.mynamespace; |
17 |
var suite = new Y.Test.Suite("mynamespace Tests"); |
|
13885.3.4
by Graham Binns
Added standard_test_template.(js|html) to help people not have to cargo-cult boilerplate. |
18 |
|
19 |
suite.add(new Y.Test.Case({ |
|
13885.3.6
by Graham Binns
Updated the test templates to make them match the wiki. |
20 |
// Test the setup method.
|
21 |
name: 'setup', |
|
13885.3.4
by Graham Binns
Added standard_test_template.(js|html) to help people not have to cargo-cult boilerplate. |
22 |
|
13885.3.6
by Graham Binns
Updated the test templates to make them match the wiki. |
23 |
_should: { |
24 |
error: { |
|
25 |
test_config_undefined: true, |
|
26 |
}
|
|
27 |
},
|
|
13885.3.4
by Graham Binns
Added standard_test_template.(js|html) to help people not have to cargo-cult boilerplate. |
28 |
|
29 |
setUp: function() { |
|
13885.3.6
by Graham Binns
Updated the test templates to make them match the wiki. |
30 |
this.tbody = Y.get('#milestone-rows'); |
31 |
},
|
|
13885.3.4
by Graham Binns
Added standard_test_template.(js|html) to help people not have to cargo-cult boilerplate. |
32 |
|
33 |
tearDown: function() { |
|
13885.3.6
by Graham Binns
Updated the test templates to make them match the wiki. |
34 |
delete this.tbody; |
35 |
mynamespace._milestone_row_uri_template = null; |
|
36 |
mynamespace._tbody = null; |
|
37 |
},
|
|
38 |
||
39 |
test_good_config: function() { |
|
40 |
// Verify the config data is stored.
|
|
41 |
var config = { |
|
42 |
milestone_row_uri_template: '/uri', |
|
43 |
milestone_rows_id: '#milestone-rows' |
|
44 |
};
|
|
45 |
mynamespace.setup(config); |
|
46 |
Y.Assert.areSame( |
|
47 |
config.milestone_row_uri_template, |
|
48 |
mynamespace._milestone_row_uri_template); |
|
49 |
Y.Assert.areSame(this.tbody, mynamespace._tbody); |
|
50 |
},
|
|
51 |
||
52 |
test_config_undefined: function() { |
|
53 |
// Verify an error is thrown if there is no config.
|
|
54 |
mynamespace.setup(); |
|
55 |
},
|
|
13885.3.4
by Graham Binns
Added standard_test_template.(js|html) to help people not have to cargo-cult boilerplate. |
56 |
}));
|
57 |
||
13885.3.6
by Graham Binns
Updated the test templates to make them match the wiki. |
58 |
|
13885.3.4
by Graham Binns
Added standard_test_template.(js|html) to help people not have to cargo-cult boilerplate. |
59 |
var handle_complete = function(data) { |
60 |
window.status = '::::' + JSON.stringify(data); |
|
61 |
};
|
|
62 |
Y.Test.Runner.on('complete', handle_complete); |
|
63 |
Y.Test.Runner.add(suite); |
|
64 |
||
65 |
var yconsole = new Y.Console({ |
|
66 |
newestOnTop: false |
|
67 |
});
|
|
68 |
yconsole.render('#log'); |
|
69 |
||
70 |
Y.on('domready', function() { |
|
71 |
Y.Test.Runner.run(); |
|
72 |
});
|
|
73 |
||
74 |
});
|