launchpad-reviewers team mailing list archive
-
launchpad-reviewers team
-
Mailing list archive
-
Message #09457
[Merge] lp:~rharding/launchpad/code_yui35_one into lp:launchpad
Richard Harding has proposed merging lp:~rharding/launchpad/code_yui35_one into lp:launchpad.
Requested reviews:
Launchpad code reviewers (launchpad-reviewers)
For more details, see:
https://code.launchpad.net/~rharding/launchpad/code_yui35_one/+merge/113031
= 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.
--
https://code.launchpad.net/~rharding/launchpad/code_yui35_one/+merge/113031
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~rharding/launchpad/code_yui35_one into lp:launchpad.
=== modified file 'lib/lp/code/javascript/productseries-setbranch.js'
--- lib/lp/code/javascript/productseries-setbranch.js 2010-03-19 18:21:22 +0000
+++ lib/lp/code/javascript/productseries-setbranch.js 2012-07-02 13:28:24 +0000
@@ -74,9 +74,9 @@
};
module.setup = function() {
- Y.all('input[name=field.rcs_type]').on(
+ Y.all('input[name="field.rcs_type"]').on(
'click', module.onclick_rcs_type);
- Y.all('input[name=field.branch_type]').on(
+ Y.all('input[name="field.branch_type"]').on(
'click', module.onclick_branch_type);
// Set the initial state.
=== modified file 'lib/lp/code/javascript/tests/test_branchdiff.html'
--- lib/lp/code/javascript/tests/test_branchdiff.html 2012-03-14 04:41:36 +0000
+++ lib/lp/code/javascript/tests/test_branchdiff.html 2012-07-02 13:28:24 +0000
@@ -43,7 +43,7 @@
<body class="yui3-skin-sam">
<ul id="suites">
<!-- <li>lp.large_indicator.test</li> -->
- <li>lp.branchmergeproposal.test</li>
+ <li>lp.code.branch.mergeproposal.test</li>
</ul>
<div id="test-diff-popup">
=== modified file 'lib/lp/code/javascript/tests/test_branchdiff.js'
--- lib/lp/code/javascript/tests/test_branchdiff.js 2011-12-22 09:05:46 +0000
+++ lib/lp/code/javascript/tests/test_branchdiff.js 2012-07-02 13:28:24 +0000
@@ -1,18 +1,7 @@
-/* Copyright 2010-2011 Canonical Ltd. This software is licensed under the
- * GNU Affero General Public License version 3 (see the file LICENSE).
- *
- * Tests for lp.code.branchmergeproposal.diff.
- *
- */
-
-YUI({
- base: '../../../../canonical/launchpad/icing/yui/',
- filter: 'raw', combine: false
- }).use('test', 'console', 'node-event-simulate', 'lp.client',
- 'lp.code.branchmergeproposal.diff', function(Y) {
-
+/* Copyright (c) 2010-2012, Canonical Ltd. All rights reserved. */
+
+YUI.add('lp.code.branch.mergeproposal.test', function (Y) {
var module = Y.lp.code.branchmergeproposal.diff;
- var suite = new Y.Test.Suite("branchmergeproposal.diff Tests");
/*
* A Mock client that always calls success on get.
@@ -25,7 +14,10 @@
}
};
- suite.add(new Y.Test.Case({
+ var tests = Y.namespace('lp.code.branch.mergeproposal.test');
+ tests.suite = new Y.Test.Suite('code.branch.mergeproposal Tests');
+
+ tests.suite.add(new Y.Test.Case({
name: 'Test branch diff functions',
/*
@@ -63,21 +55,8 @@
}));
- var handle_complete = function(data) {
- window.status = '::::' + JSON.stringify(data);
- };
- Y.Test.Runner.on('complete', handle_complete);
- Y.Test.Runner.add(suite);
-
- // Keep the default console object so we can debug with our dev tools
- // while still allowing us to log to the YUI Console via Y.log and
- // yconsole.
- var yconsole = new Y.Console({newestOnTop: false});
- yconsole.render('#log');
-
- // Start the test runner on Y.after to ensure all setup has had a
- // chance to complete.
- Y.after('domready', function() {
- Y.Test.Runner.run();
- });
+
+}, '0.1', {
+ requires: ['test', 'lp.testing.helpers', 'console',
+ 'lp.code.branchmergeproposal.diff', 'node-event-simulate', 'lp.client']
});
=== modified file 'lib/lp/code/javascript/tests/test_branchrevisionexpander.html'
--- lib/lp/code/javascript/tests/test_branchrevisionexpander.html 2012-03-14 04:41:36 +0000
+++ lib/lp/code/javascript/tests/test_branchrevisionexpander.html 2012-07-02 13:28:24 +0000
@@ -52,7 +52,7 @@
<body class="yui3-skin-sam">
<ul id="suites">
<!-- <li>lp.large_indicator.test</li> -->
- <li>lp.branchrevisionexpander.test</li>
+ <li>lp.code.branch.revisionexpander.test</li>
</ul>
</body>
</html>
=== modified file 'lib/lp/code/javascript/tests/test_branchrevisionexpander.js'
--- lib/lp/code/javascript/tests/test_branchrevisionexpander.js 2011-07-19 06:37:54 +0000
+++ lib/lp/code/javascript/tests/test_branchrevisionexpander.js 2012-07-02 13:28:24 +0000
@@ -1,18 +1,7 @@
-/* Copyright 2010 Canonical Ltd. This software is licensed under the
- * GNU Affero General Public License version 3 (see the file LICENSE).
- *
- * Tests for lp.code.branch.revisionexpander.
- *
- */
-
-YUI({
- base: '../../../../canonical/launchpad/icing/yui/',
- filter: 'raw', combine: false
- }).use('test', 'console', 'node-event-simulate', 'lp.client',
- 'lp.code.branch.revisionexpander', function(Y) {
-
+/* Copyright (c) 2010-2012, Canonical Ltd. All rights reserved. */
+
+YUI.add('lp.code.branch.revisionexpander.test', function (Y) {
var module = Y.lp.code.branch.revisionexpander;
- var suite = new Y.Test.Suite("branch.revisionexpander Tests");
var MockClient = function() {};
MockClient.prototype = {
@@ -34,7 +23,11 @@
" =========\n" +
" \n");
- suite.add(new Y.Test.Case({
+
+ var tests = Y.namespace('lp.code.branch.revisionexpander.test');
+ tests.suite = new Y.Test.Suite('code.branch.revisionexpander Tests');
+
+ tests.suite.add(new Y.Test.Case({
name: 'Test difftext_to_node',
/*
@@ -58,9 +51,9 @@
var td = node.one('td');
Y.Assert.isNull(td.one('p'));
}
- }));
+ }));
- suite.add(new Y.Test.Case({
+ tests.suite.add(new Y.Test.Case({
name: 'Tests for bmp_diff_loader and bmp_get_diff_url',
setUp: function() {
@@ -131,21 +124,10 @@
'fake-link-base/2/null:',
module.bmp_get_diff_url(0, 2));
}
- }));
-
- var handle_complete = function(data) {
- window.status = '::::' + JSON.stringify(data);
- };
- Y.Test.Runner.on('complete', handle_complete);
- Y.Test.Runner.add(suite);
-
- var console = new Y.Console({newestOnTop: false});
- console.render('#log');
-
- // Start the test runner on Y.after to ensure all setup has had a
- // chance to complete.
- Y.after('domready', function() {
- Y.Test.Runner.run();
- });
+ }));
+
+
+}, '0.1', {
+ requires: ['test', 'lp.testing.helpers', 'console',
+ 'lp.code.branch.revisionexpander', 'lp.client', 'node-event-simulate']
});
-
=== modified file 'lib/lp/code/javascript/tests/test_bugspeclinks.html'
--- lib/lp/code/javascript/tests/test_bugspeclinks.html 2012-03-14 04:41:36 +0000
+++ lib/lp/code/javascript/tests/test_bugspeclinks.html 2012-07-02 13:28:24 +0000
@@ -42,8 +42,7 @@
</head>
<body class="yui3-skin-sam">
<ul id="suites">
- <!-- <li>lp.large_indicator.test</li> -->
- <li>lp.bugspeclinks.test</li>
+ <li>lp.code.branch.bugspeclinks.test</li>
</ul>
</body>
</html>
=== modified file 'lib/lp/code/javascript/tests/test_bugspeclinks.js'
--- lib/lp/code/javascript/tests/test_bugspeclinks.js 2011-08-04 19:57:38 +0000
+++ lib/lp/code/javascript/tests/test_bugspeclinks.js 2012-07-02 13:28:24 +0000
@@ -1,21 +1,13 @@
-/* Copyright 2011 Canonical Ltd. This software is licensed under the
- * GNU Affero General Public License version 3 (see the file LICENSE).
- *
- * Tests for lp.code.branch.bugspeclinks.
- *
- */
-
-YUI({
- base: '../../../../canonical/launchpad/icing/yui/',
- filter: 'raw', combine: false
- }).use('test', 'console', 'node-event-simulate',
- 'lp.code.branch.bugspeclinks', function(Y) {
-
+/* Copyright (c) 2012-2012 Canonical Ltd. All rights reserved. */
+
+YUI.add('lp.code.branch.bugspeclinks.test', function (Y) {
var module = Y.lp.code.branch.bugspeclinks;
var extract_candidate_bug_id = module._extract_candidate_bug_id;
- var suite = new Y.Test.Suite("lp.code.branch.bugspeclinks Tests");
-
- suite.add(new Y.Test.Case({
+
+ var tests = Y.namespace('lp.code.branch.bugspeclinks.test');
+ tests.suite = new Y.Test.Suite('code.branch.bugspeclinks Tests');
+
+ tests.suite.add(new Y.Test.Case({
name: 'Test bug ID guessing',
test_no_bug_id_present: function() {
@@ -65,20 +57,10 @@
extract_candidate_bug_id('123456-1234567'), '1234567');
}
- }));
-
- var handle_complete = function(data) {
- window.status = '::::' + JSON.stringify(data);
- };
- Y.Test.Runner.on('complete', handle_complete);
- Y.Test.Runner.add(suite);
-
- var console = new Y.Console({newestOnTop: false});
- console.render('#log');
-
- // Start the test runner on Y.after to ensure all setup has had a
- // chance to complete.
- Y.after('domready', function() {
- Y.Test.Runner.run();
- });
+ }));
+
+
+}, '0.1', {
+ requires: ['test', 'lp.testing.helpers', 'console',
+ 'lp.code.branch.bugspeclinks', 'node-event-simulate']
});
=== modified file 'lib/lp/code/javascript/tests/test_util.js'
--- lib/lp/code/javascript/tests/test_util.js 2012-04-27 23:42:05 +0000
+++ lib/lp/code/javascript/tests/test_util.js 2012-07-02 13:28:24 +0000
@@ -34,15 +34,19 @@
var listener = this.listener;
Y.one(form_selector).submit = function(e) {
listener.event_fired = true;
- e.halt();
- };
+ // YUI 3.5 doesn't have an EventFacade passed into the simulated
+ // event.
+ if (e) {
+ e.halt();
+ }
+ };
},
test_hookUpDailyBuildsFilterSubmission: function() {
this._setup_fixture('#daily-builds-form');
module.hookUpDailyBuildsFilterSubmission();
this._add_submit_listener('#filter_form');
- Y.one('[id=field.when_completed_filter]').simulate('change');
+ Y.one('[id="field.when_completed_filter"]').simulate('change');
Y.Assert.isTrue(this.listener.event_fired);
Y.Assert.isTrue(
Y.one('#filter_form_submit').hasClass('unseen'));
@@ -52,10 +56,10 @@
this._setup_fixture('#branch-listing-form');
module.hookUpBranchFilterSubmission();
this._add_submit_listener('#filter_form');
- Y.one('[id=field.lifecycle]').simulate('change');
+ Y.one('[id="field.lifecycle"]').simulate('change');
Y.Assert.isTrue(this.listener.event_fired);
this.listener.event_fired = false;
- Y.one('[id=field.sort_by]').simulate('change');
+ Y.one('[id="field.sort_by"]').simulate('change');
Y.Assert.isTrue(this.listener.event_fired);
Y.Assert.isTrue(
Y.one('#filter_form_submit').hasClass('unseen'));
@@ -65,7 +69,7 @@
this._setup_fixture('#merge-proposal-form');
module.hookUpMergeProposalFilterSubmission();
this._add_submit_listener('#filter_form');
- Y.one('[id=field.status]').simulate('change');
+ Y.one('[id="field.status"]').simulate('change');
Y.Assert.isTrue(this.listener.event_fired);
Y.Assert.isTrue(
Y.one('#filter_form_submit').hasClass('unseen'));
@@ -80,7 +84,7 @@
Y.Assert.isTrue(this.listener.event_fired);
Y.Assert.isFalse(try_again_link.hasClass('unseen'));
Y.Assert.isTrue(
- Y.one('[id=tryagain.actions.tryagain]').hasClass('unseen'));
+ Y.one('[id="tryagain.actions.tryagain"]').hasClass('unseen'));
}
}));
=== modified file 'lib/lp/code/javascript/util.js'
--- lib/lp/code/javascript/util.js 2012-04-27 21:22:39 +0000
+++ lib/lp/code/javascript/util.js 2012-07-02 13:28:24 +0000
@@ -51,7 +51,7 @@
};
var hookUpMergeProposalFilterSubmission = function() {
- Y.one("[id=field.status]").on('change', submit_filter);
+ Y.one("[id='field.status']").on('change', submit_filter);
Y.one('#filter_form_submit').addClass('unseen');
};
@@ -61,7 +61,7 @@
Y.one('#tryagain').submit();
});
try_again_link.removeClass('unseen');
- Y.one('[id=tryagain.actions.tryagain]').addClass('unseen');
+ Y.one('[id="tryagain.actions.tryagain"]').addClass('unseen');
};
ns.hookUpBranchFieldFunctions = hookUpBranchFieldFunctions;
Follow ups