Merge lp:~rharding/launchpad/code_yui35_one into lp:launchpad

Proposed by Richard Harding on 2012-07-02
Status: Merged
Approved by: Curtis Hovey on 2012-07-02
Approved revision: no longer in the source branch.
Merged at revision: 15541
Proposed branch: lp:~rharding/launchpad/code_yui35_one
Merge into: lp:launchpad
Diff against target: 339 lines (+59/-113)
9 files modified
lib/lp/code/javascript/productseries-setbranch.js (+2/-2)
lib/lp/code/javascript/tests/test_branchdiff.html (+1/-1)
lib/lp/code/javascript/tests/test_branchdiff.js (+11/-32)
lib/lp/code/javascript/tests/test_branchrevisionexpander.html (+1/-1)
lib/lp/code/javascript/tests/test_branchrevisionexpander.js (+16/-34)
lib/lp/code/javascript/tests/test_bugspeclinks.html (+1/-2)
lib/lp/code/javascript/tests/test_bugspeclinks.js (+14/-32)
lib/lp/code/javascript/tests/test_util.js (+11/-7)
lib/lp/code/javascript/util.js (+2/-2)
To merge this branch: bzr merge lp:~rharding/launchpad/code_yui35_one
Reviewer Review Type Date Requested Status
Curtis Hovey (community) code 2012-07-02 Approve on 2012-07-02
Review via email: mp+113031@code.launchpad.net

Commit Message

Initial set of JS updates to the code JS tests for YUI 3.5.

Description of the Change

= Summary =

This branch updates the JS test code in the code module to pass under YUI 3.5.

== Implementation Notes ==

Updating the tests is mostly just reorganizing them to add an actual module or adding quotes around attribute selectors.

== Tests ==

./bin/test -x -cvv --layer=YUITestLayer

== LoC Qualification ==

It's a negative LoC change.

To post a comment you must log in.
Curtis Hovey (sinzui) wrote :

Thank you for cleaning up the tests.

review: Approve (code)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'lib/lp/code/javascript/productseries-setbranch.js'
2--- lib/lp/code/javascript/productseries-setbranch.js 2010-03-19 18:21:22 +0000
3+++ lib/lp/code/javascript/productseries-setbranch.js 2012-07-02 13:28:24 +0000
4@@ -74,9 +74,9 @@
5 };
6
7 module.setup = function() {
8- Y.all('input[name=field.rcs_type]').on(
9+ Y.all('input[name="field.rcs_type"]').on(
10 'click', module.onclick_rcs_type);
11- Y.all('input[name=field.branch_type]').on(
12+ Y.all('input[name="field.branch_type"]').on(
13 'click', module.onclick_branch_type);
14
15 // Set the initial state.
16
17=== modified file 'lib/lp/code/javascript/tests/test_branchdiff.html'
18--- lib/lp/code/javascript/tests/test_branchdiff.html 2012-03-14 04:41:36 +0000
19+++ lib/lp/code/javascript/tests/test_branchdiff.html 2012-07-02 13:28:24 +0000
20@@ -43,7 +43,7 @@
21 <body class="yui3-skin-sam">
22 <ul id="suites">
23 <!-- <li>lp.large_indicator.test</li> -->
24- <li>lp.branchmergeproposal.test</li>
25+ <li>lp.code.branch.mergeproposal.test</li>
26 </ul>
27
28 <div id="test-diff-popup">
29
30=== modified file 'lib/lp/code/javascript/tests/test_branchdiff.js'
31--- lib/lp/code/javascript/tests/test_branchdiff.js 2011-12-22 09:05:46 +0000
32+++ lib/lp/code/javascript/tests/test_branchdiff.js 2012-07-02 13:28:24 +0000
33@@ -1,18 +1,7 @@
34-/* Copyright 2010-2011 Canonical Ltd. This software is licensed under the
35- * GNU Affero General Public License version 3 (see the file LICENSE).
36- *
37- * Tests for lp.code.branchmergeproposal.diff.
38- *
39- */
40-
41-YUI({
42- base: '../../../../canonical/launchpad/icing/yui/',
43- filter: 'raw', combine: false
44- }).use('test', 'console', 'node-event-simulate', 'lp.client',
45- 'lp.code.branchmergeproposal.diff', function(Y) {
46-
47+/* Copyright (c) 2010-2012, Canonical Ltd. All rights reserved. */
48+
49+YUI.add('lp.code.branch.mergeproposal.test', function (Y) {
50 var module = Y.lp.code.branchmergeproposal.diff;
51- var suite = new Y.Test.Suite("branchmergeproposal.diff Tests");
52
53 /*
54 * A Mock client that always calls success on get.
55@@ -25,7 +14,10 @@
56 }
57 };
58
59- suite.add(new Y.Test.Case({
60+ var tests = Y.namespace('lp.code.branch.mergeproposal.test');
61+ tests.suite = new Y.Test.Suite('code.branch.mergeproposal Tests');
62+
63+ tests.suite.add(new Y.Test.Case({
64 name: 'Test branch diff functions',
65
66 /*
67@@ -63,21 +55,8 @@
68
69 }));
70
71- var handle_complete = function(data) {
72- window.status = '::::' + JSON.stringify(data);
73- };
74- Y.Test.Runner.on('complete', handle_complete);
75- Y.Test.Runner.add(suite);
76-
77- // Keep the default console object so we can debug with our dev tools
78- // while still allowing us to log to the YUI Console via Y.log and
79- // yconsole.
80- var yconsole = new Y.Console({newestOnTop: false});
81- yconsole.render('#log');
82-
83- // Start the test runner on Y.after to ensure all setup has had a
84- // chance to complete.
85- Y.after('domready', function() {
86- Y.Test.Runner.run();
87- });
88+
89+}, '0.1', {
90+ requires: ['test', 'lp.testing.helpers', 'console',
91+ 'lp.code.branchmergeproposal.diff', 'node-event-simulate', 'lp.client']
92 });
93
94=== modified file 'lib/lp/code/javascript/tests/test_branchrevisionexpander.html'
95--- lib/lp/code/javascript/tests/test_branchrevisionexpander.html 2012-03-14 04:41:36 +0000
96+++ lib/lp/code/javascript/tests/test_branchrevisionexpander.html 2012-07-02 13:28:24 +0000
97@@ -52,7 +52,7 @@
98 <body class="yui3-skin-sam">
99 <ul id="suites">
100 <!-- <li>lp.large_indicator.test</li> -->
101- <li>lp.branchrevisionexpander.test</li>
102+ <li>lp.code.branch.revisionexpander.test</li>
103 </ul>
104 </body>
105 </html>
106
107=== modified file 'lib/lp/code/javascript/tests/test_branchrevisionexpander.js'
108--- lib/lp/code/javascript/tests/test_branchrevisionexpander.js 2011-07-19 06:37:54 +0000
109+++ lib/lp/code/javascript/tests/test_branchrevisionexpander.js 2012-07-02 13:28:24 +0000
110@@ -1,18 +1,7 @@
111-/* Copyright 2010 Canonical Ltd. This software is licensed under the
112- * GNU Affero General Public License version 3 (see the file LICENSE).
113- *
114- * Tests for lp.code.branch.revisionexpander.
115- *
116- */
117-
118-YUI({
119- base: '../../../../canonical/launchpad/icing/yui/',
120- filter: 'raw', combine: false
121- }).use('test', 'console', 'node-event-simulate', 'lp.client',
122- 'lp.code.branch.revisionexpander', function(Y) {
123-
124+/* Copyright (c) 2010-2012, Canonical Ltd. All rights reserved. */
125+
126+YUI.add('lp.code.branch.revisionexpander.test', function (Y) {
127 var module = Y.lp.code.branch.revisionexpander;
128- var suite = new Y.Test.Suite("branch.revisionexpander Tests");
129
130 var MockClient = function() {};
131 MockClient.prototype = {
132@@ -34,7 +23,11 @@
133 " =========\n" +
134 " \n");
135
136- suite.add(new Y.Test.Case({
137+
138+ var tests = Y.namespace('lp.code.branch.revisionexpander.test');
139+ tests.suite = new Y.Test.Suite('code.branch.revisionexpander Tests');
140+
141+ tests.suite.add(new Y.Test.Case({
142 name: 'Test difftext_to_node',
143
144 /*
145@@ -58,9 +51,9 @@
146 var td = node.one('td');
147 Y.Assert.isNull(td.one('p'));
148 }
149- }));
150+ }));
151
152- suite.add(new Y.Test.Case({
153+ tests.suite.add(new Y.Test.Case({
154 name: 'Tests for bmp_diff_loader and bmp_get_diff_url',
155
156 setUp: function() {
157@@ -131,21 +124,10 @@
158 'fake-link-base/2/null:',
159 module.bmp_get_diff_url(0, 2));
160 }
161- }));
162-
163- var handle_complete = function(data) {
164- window.status = '::::' + JSON.stringify(data);
165- };
166- Y.Test.Runner.on('complete', handle_complete);
167- Y.Test.Runner.add(suite);
168-
169- var console = new Y.Console({newestOnTop: false});
170- console.render('#log');
171-
172- // Start the test runner on Y.after to ensure all setup has had a
173- // chance to complete.
174- Y.after('domready', function() {
175- Y.Test.Runner.run();
176- });
177+ }));
178+
179+
180+}, '0.1', {
181+ requires: ['test', 'lp.testing.helpers', 'console',
182+ 'lp.code.branch.revisionexpander', 'lp.client', 'node-event-simulate']
183 });
184-
185
186=== modified file 'lib/lp/code/javascript/tests/test_bugspeclinks.html'
187--- lib/lp/code/javascript/tests/test_bugspeclinks.html 2012-03-14 04:41:36 +0000
188+++ lib/lp/code/javascript/tests/test_bugspeclinks.html 2012-07-02 13:28:24 +0000
189@@ -42,8 +42,7 @@
190 </head>
191 <body class="yui3-skin-sam">
192 <ul id="suites">
193- <!-- <li>lp.large_indicator.test</li> -->
194- <li>lp.bugspeclinks.test</li>
195+ <li>lp.code.branch.bugspeclinks.test</li>
196 </ul>
197 </body>
198 </html>
199
200=== modified file 'lib/lp/code/javascript/tests/test_bugspeclinks.js'
201--- lib/lp/code/javascript/tests/test_bugspeclinks.js 2011-08-04 19:57:38 +0000
202+++ lib/lp/code/javascript/tests/test_bugspeclinks.js 2012-07-02 13:28:24 +0000
203@@ -1,21 +1,13 @@
204-/* Copyright 2011 Canonical Ltd. This software is licensed under the
205- * GNU Affero General Public License version 3 (see the file LICENSE).
206- *
207- * Tests for lp.code.branch.bugspeclinks.
208- *
209- */
210-
211-YUI({
212- base: '../../../../canonical/launchpad/icing/yui/',
213- filter: 'raw', combine: false
214- }).use('test', 'console', 'node-event-simulate',
215- 'lp.code.branch.bugspeclinks', function(Y) {
216-
217+/* Copyright (c) 2012-2012 Canonical Ltd. All rights reserved. */
218+
219+YUI.add('lp.code.branch.bugspeclinks.test', function (Y) {
220 var module = Y.lp.code.branch.bugspeclinks;
221 var extract_candidate_bug_id = module._extract_candidate_bug_id;
222- var suite = new Y.Test.Suite("lp.code.branch.bugspeclinks Tests");
223-
224- suite.add(new Y.Test.Case({
225+
226+ var tests = Y.namespace('lp.code.branch.bugspeclinks.test');
227+ tests.suite = new Y.Test.Suite('code.branch.bugspeclinks Tests');
228+
229+ tests.suite.add(new Y.Test.Case({
230 name: 'Test bug ID guessing',
231
232 test_no_bug_id_present: function() {
233@@ -65,20 +57,10 @@
234 extract_candidate_bug_id('123456-1234567'), '1234567');
235 }
236
237- }));
238-
239- var handle_complete = function(data) {
240- window.status = '::::' + JSON.stringify(data);
241- };
242- Y.Test.Runner.on('complete', handle_complete);
243- Y.Test.Runner.add(suite);
244-
245- var console = new Y.Console({newestOnTop: false});
246- console.render('#log');
247-
248- // Start the test runner on Y.after to ensure all setup has had a
249- // chance to complete.
250- Y.after('domready', function() {
251- Y.Test.Runner.run();
252- });
253+ }));
254+
255+
256+}, '0.1', {
257+ requires: ['test', 'lp.testing.helpers', 'console',
258+ 'lp.code.branch.bugspeclinks', 'node-event-simulate']
259 });
260
261=== modified file 'lib/lp/code/javascript/tests/test_util.js'
262--- lib/lp/code/javascript/tests/test_util.js 2012-04-27 23:42:05 +0000
263+++ lib/lp/code/javascript/tests/test_util.js 2012-07-02 13:28:24 +0000
264@@ -34,15 +34,19 @@
265 var listener = this.listener;
266 Y.one(form_selector).submit = function(e) {
267 listener.event_fired = true;
268- e.halt();
269- };
270+ // YUI 3.5 doesn't have an EventFacade passed into the simulated
271+ // event.
272+ if (e) {
273+ e.halt();
274+ }
275+ };
276 },
277
278 test_hookUpDailyBuildsFilterSubmission: function() {
279 this._setup_fixture('#daily-builds-form');
280 module.hookUpDailyBuildsFilterSubmission();
281 this._add_submit_listener('#filter_form');
282- Y.one('[id=field.when_completed_filter]').simulate('change');
283+ Y.one('[id="field.when_completed_filter"]').simulate('change');
284 Y.Assert.isTrue(this.listener.event_fired);
285 Y.Assert.isTrue(
286 Y.one('#filter_form_submit').hasClass('unseen'));
287@@ -52,10 +56,10 @@
288 this._setup_fixture('#branch-listing-form');
289 module.hookUpBranchFilterSubmission();
290 this._add_submit_listener('#filter_form');
291- Y.one('[id=field.lifecycle]').simulate('change');
292+ Y.one('[id="field.lifecycle"]').simulate('change');
293 Y.Assert.isTrue(this.listener.event_fired);
294 this.listener.event_fired = false;
295- Y.one('[id=field.sort_by]').simulate('change');
296+ Y.one('[id="field.sort_by"]').simulate('change');
297 Y.Assert.isTrue(this.listener.event_fired);
298 Y.Assert.isTrue(
299 Y.one('#filter_form_submit').hasClass('unseen'));
300@@ -65,7 +69,7 @@
301 this._setup_fixture('#merge-proposal-form');
302 module.hookUpMergeProposalFilterSubmission();
303 this._add_submit_listener('#filter_form');
304- Y.one('[id=field.status]').simulate('change');
305+ Y.one('[id="field.status"]').simulate('change');
306 Y.Assert.isTrue(this.listener.event_fired);
307 Y.Assert.isTrue(
308 Y.one('#filter_form_submit').hasClass('unseen'));
309@@ -80,7 +84,7 @@
310 Y.Assert.isTrue(this.listener.event_fired);
311 Y.Assert.isFalse(try_again_link.hasClass('unseen'));
312 Y.Assert.isTrue(
313- Y.one('[id=tryagain.actions.tryagain]').hasClass('unseen'));
314+ Y.one('[id="tryagain.actions.tryagain"]').hasClass('unseen'));
315 }
316
317 }));
318
319=== modified file 'lib/lp/code/javascript/util.js'
320--- lib/lp/code/javascript/util.js 2012-04-27 21:22:39 +0000
321+++ lib/lp/code/javascript/util.js 2012-07-02 13:28:24 +0000
322@@ -51,7 +51,7 @@
323 };
324
325 var hookUpMergeProposalFilterSubmission = function() {
326- Y.one("[id=field.status]").on('change', submit_filter);
327+ Y.one("[id='field.status']").on('change', submit_filter);
328 Y.one('#filter_form_submit').addClass('unseen');
329 };
330
331@@ -61,7 +61,7 @@
332 Y.one('#tryagain').submit();
333 });
334 try_again_link.removeClass('unseen');
335- Y.one('[id=tryagain.actions.tryagain]').addClass('unseen');
336+ Y.one('[id="tryagain.actions.tryagain"]').addClass('unseen');
337 };
338
339 ns.hookUpBranchFieldFunctions = hookUpBranchFieldFunctions;