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

Proposed by Richard Harding
Status: Merged
Approved by: Curtis Hovey
Approved revision: no longer in the source branch.
Merged at revision: 15808
Proposed branch: lp:~rharding/launchpad/yui35_test_fix2
Merge into: lp:launchpad
Diff against target: 375 lines (+63/-64)
10 files modified
lib/lp/app/javascript/choiceedit/choiceedit.js (+2/-2)
lib/lp/app/javascript/choiceedit/tests/test_choiceedit.js (+3/-6)
lib/lp/app/javascript/testing/assert.js (+2/-1)
lib/lp/app/javascript/testing/helpers.js (+3/-3)
lib/lp/bugs/javascript/bug_picker.js (+5/-6)
lib/lp/bugs/javascript/tests/test_bug_picker.js (+6/-5)
lib/lp/bugs/javascript/tests/test_duplicates.js (+20/-19)
lib/lp/registry/javascript/sharing/granteepicker.js (+3/-3)
lib/lp/registry/javascript/sharing/granteetable.js (+3/-3)
lib/lp/registry/javascript/sharing/tests/test_granteetable.js (+16/-16)
To merge this branch: bzr merge lp:~rharding/launchpad/yui35_test_fix2
Reviewer Review Type Date Requested Status
Deryck Hodge (community) Approve
Curtis Hovey (community) code Approve
Review via email: mp+119603@code.launchpad.net

Commit message

Update JS and tests to pass under YUI 3.5.1.

Description of the change

This branch corrects tests and js code so that they all pas under YUI 3.5.1. This brings things back into alignment with the work previously done to update the JS code to prepare for testing YUI 3.5.1 behind the feature flag.

Since tests currently only run under 3.3.0, it's easy for them to get out of sync with the changes required for 3.5.1.

To post a comment you must log in.
Revision history for this message
Curtis Hovey (sinzui) wrote :

Thank you for these fixes.

review: Approve (code)
Revision history for this message
Deryck Hodge (deryck) wrote :

Just make sure to drop the asset.js head link and this is good to go. Thanks for dropping the StartsWith asserts from the earlier version of this! Looks good otherwise.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'lib/lp/app/javascript/choiceedit/choiceedit.js'
--- lib/lp/app/javascript/choiceedit/choiceedit.js 2012-08-08 16:42:21 +0000
+++ lib/lp/app/javascript/choiceedit/choiceedit.js 2012-08-14 18:46:45 +0000
@@ -174,7 +174,7 @@
174 if (!this.get('clickable_content')) {174 if (!this.get('clickable_content')) {
175 var content = this.get('contentBox');175 var content = this.get('contentBox');
176 content.addClass('no-click');176 content.addClass('no-click');
177 };177 }
178 },178 },
179179
180 /**180 /**
@@ -652,7 +652,7 @@
652 }652 }
653 },653 },
654 /**654 /**
655 * The specialised version of the items attirbute is cloned and the name655 * The specialised version of the items attribute is cloned and the name
656 * of the null value is modified to add a remove icon next to it. If the656 * of the null value is modified to add a remove icon next to it. If the
657 * currently selected value is null, the null item is not displayed.657 * currently selected value is null, the null item is not displayed.
658 *658 *
659659
=== modified file 'lib/lp/app/javascript/choiceedit/tests/test_choiceedit.js'
--- lib/lp/app/javascript/choiceedit/tests/test_choiceedit.js 2012-08-08 16:55:17 +0000
+++ lib/lp/app/javascript/choiceedit/tests/test_choiceedit.js 2012-08-14 18:46:45 +0000
@@ -486,10 +486,9 @@
486 this.null_choice_edit.get('actionicon'),486 this.null_choice_edit.get('actionicon'),
487 this.null_choice_edit.get('addicon'),487 this.null_choice_edit.get('addicon'),
488 'Action icon is not the add icon like expected.');488 'Action icon is not the add icon like expected.');
489
490 Assert.areEqual(489 Assert.areEqual(
490 'inline',
491 this.null_choice_edit.get('addicon').getStyle('display'),491 this.null_choice_edit.get('addicon').getStyle('display'),
492 'inline',
493 'Add icon is not visible when it should be');492 'Add icon is not visible when it should be');
494 Assert.areEqual(493 Assert.areEqual(
495 this.null_choice_edit.get('editicon').getStyle('display'),494 this.null_choice_edit.get('editicon').getStyle('display'),
@@ -499,7 +498,7 @@
499 simulate(this.null_choice_edit.get('boundingBox'),498 simulate(this.null_choice_edit.get('boundingBox'),
500 '.value', 'click');499 '.value', 'click');
501 simulate(this.null_choice_edit._choice_list.get('boundingBox'),500 simulate(this.null_choice_edit._choice_list.get('boundingBox'),
502 'li a[href$=groucho]', 'click');501 'li a[href$="groucho"]', 'click');
503 this.null_choice_edit._uiClearWaiting();502 this.null_choice_edit._uiClearWaiting();
504503
505 Assert.areEqual(504 Assert.areEqual(
@@ -511,8 +510,8 @@
511 'none',510 'none',
512 "Add icon is visible when it shouldn't be");511 "Add icon is visible when it shouldn't be");
513 Assert.areEqual(512 Assert.areEqual(
513 'inline',
514 this.null_choice_edit.get('editicon').getStyle('display'),514 this.null_choice_edit.get('editicon').getStyle('display'),
515 'inline',
516 "Edit icon is not visible when it shouldn be");515 "Edit icon is not visible when it shouldn be");
517 },516 },
518517
@@ -553,8 +552,6 @@
553 }552 }
554 }));553 }));
555554
556
557
558}, '0.1', {555}, '0.1', {
559 'requires': ['test', 'console', 'lp.choiceedit', 'node', 'event',556 'requires': ['test', 'console', 'lp.choiceedit', 'node', 'event',
560 'event-simulate', 'widget-stack', 'lp.app.choice']557 'event-simulate', 'widget-stack', 'lp.app.choice']
561558
=== modified file 'lib/lp/app/javascript/testing/assert.js'
--- lib/lp/app/javascript/testing/assert.js 2011-10-18 15:36:34 +0000
+++ lib/lp/app/javascript/testing/assert.js 2012-08-14 18:46:45 +0000
@@ -14,4 +14,5 @@
14 namespace.assert_equal_structure = function(expected, actual){14 namespace.assert_equal_structure = function(expected, actual){
15 Y.Assert.areEqual(JSON.stringify(expected), JSON.stringify(actual));15 Y.Assert.areEqual(JSON.stringify(expected), JSON.stringify(actual));
16 };16 };
17}, '0.1', {'requires': []});17
18}, '0.1', {'requires': ['testing']});
1819
=== modified file 'lib/lp/app/javascript/testing/helpers.js'
--- lib/lp/app/javascript/testing/helpers.js 2012-08-01 14:09:19 +0000
+++ lib/lp/app/javascript/testing/helpers.js 2012-08-14 18:46:45 +0000
@@ -32,7 +32,7 @@
32 *32 *
33 * EXAMPLE:33 * EXAMPLE:
34 * var client = new ns.LPCLient();34 * var client = new ns.LPCLient();
35 * 35 *
36 * client.get.args = [];36 * client.get.args = [];
37 * client.get(function_arg1, function_arg2);37 * client.get(function_arg1, function_arg2);
38 */38 */
@@ -57,10 +57,10 @@
57 }57 }
58 /**58 /**
59 * Captures call data and simulates callbacks.59 * Captures call data and simulates callbacks.
60 * 60 *
61 * The function called and the arguments it's called with are added to the61 * The function called and the arguments it's called with are added to the
62 * LPCLient's `received` attribute.62 * LPCLient's `received` attribute.
63 * 63 *
64 * Callback behavior are governed by the args set on the callee.64 * Callback behavior are governed by the args set on the callee.
65 * @method65 * @method
66 */66 */
6767
=== modified file 'lib/lp/bugs/javascript/bug_picker.js'
--- lib/lp/bugs/javascript/bug_picker.js 2012-08-10 04:48:36 +0000
+++ lib/lp/bugs/javascript/bug_picker.js 2012-08-14 18:46:45 +0000
@@ -203,15 +203,14 @@
203 },203 },
204204
205 _private_warning_template: function(message) {205 _private_warning_template: function(message) {
206 var template = [206 return [
207 '{{#private_warning}}',207 '{{#private_warning}}',
208 '<tr><td><p id="privacy-warning" ',208 '<tr><td><p id="privacy-warning" ',
209 'class="block-sprite large-warning">',209 'class="block-sprite large-warning">',
210 '{message}',210 message,
211 '</p></td></tr>',211 '</p></td></tr>',
212 '{{/private_warning}}'212 '{{/private_warning}}'
213 ].join(' ');213 ].join(' ');
214 return Y.Lang.substitute(template, {message: message});
215 },214 },
216215
217 // Template for the bug confirmation form.216 // Template for the bug confirmation form.
@@ -237,12 +236,12 @@
237 var private_warning_message236 var private_warning_message
238 = this.get('private_warning_message');237 = this.get('private_warning_message');
239 var html = Y.lp.mustache.to_html(238 var html = Y.lp.mustache.to_html(
240 this._bug_confirmation_form_template(), bug_data,239 this._bug_confirmation_form_template(),
241 {240 bug_data, {
242 bug_details: this._bug_details_template(),241 bug_details: this._bug_details_template(),
243 private_warning:242 private_warning:
244 this._private_warning_template(private_warning_message)243 this._private_warning_template(private_warning_message)
245 });244 });
246 var bug_details_node = Y.Node.create(html);245 var bug_details_node = Y.Node.create(html);
247 var bug_link = bug_details_node.one('.bugtitle');246 var bug_link = bug_details_node.one('.bugtitle');
248 bug_link.on('click', function(e) {247 bug_link.on('click', function(e) {
249248
=== modified file 'lib/lp/bugs/javascript/tests/test_bug_picker.js'
--- lib/lp/bugs/javascript/tests/test_bug_picker.js 2012-08-08 11:59:48 +0000
+++ lib/lp/bugs/javascript/tests/test_bug_picker.js 2012-08-14 18:46:45 +0000
@@ -32,6 +32,12 @@
32 }32 }
33 },33 },
3434
35 // The specified error message is displayed.
36 _assert_error_display: function(message) {
37 var error_msg = Y.one('.yui3-picker-error');
38 Y.Assert.areEqual(message, error_msg.get('text').trim());
39 },
40
35 // The bug entry form is visible visible or not.41 // The bug entry form is visible visible or not.
36 _assert_form_state: function(bug_details_visible) {42 _assert_form_state: function(bug_details_visible) {
37 var bug_info = Y.one('.yui3-picker-results ' +43 var bug_info = Y.one('.yui3-picker-results ' +
@@ -140,11 +146,6 @@
140 Y.Assert.isTrue(save_bug_called);146 Y.Assert.isTrue(save_bug_called);
141 },147 },
142148
143 // The specified error message is displayed.
144 _assert_error_display: function(message) {
145 var error_msg = Y.one('.yui3-picker-error');
146 Y.Assert.areEqual(message, error_msg.get('text').trim());
147 },
148149
149 // The error is displayed as expected when the initial bug search150 // The error is displayed as expected when the initial bug search
150 // fails with a generic error.151 // fails with a generic error.
151152
=== modified file 'lib/lp/bugs/javascript/tests/test_duplicates.js'
--- lib/lp/bugs/javascript/tests/test_duplicates.js 2012-08-09 04:56:41 +0000
+++ lib/lp/bugs/javascript/tests/test_duplicates.js 2012-08-14 18:46:45 +0000
@@ -37,6 +37,7 @@
37 }37 }
38 delete this.mockio;38 delete this.mockio;
39 delete window.LP;39 delete window.LP;
40 delete this.lp_client;
40 },41 },
4142
42 test_library_exists: function () {43 test_library_exists: function () {
@@ -65,6 +66,25 @@
65 return widget;66 return widget;
66 },67 },
6768
69 // The expected data is submitted after searching for and selecting a
70 // bug.
71 _assert_dupe_submission: function(bug_id) {
72 this._assert_search_form_submission(bug_id);
73 this._assert_search_form_success(bug_id);
74 Y.one(
75 '.yui3-picker-footer-slot [name="field.actions.save"]')
76 .simulate('click');
77 this._assert_form_state(true);
78 Y.Assert.areEqual(
79 '/foobar/bug/1/+duplicate',
80 this.mockio.last_request.url);
81 var expected_link =
82 'field.actions.change=Set%20Duplicate' +
83 '&field.duplicateof=3';
84 Y.Assert.areEqual(
85 expected_link, this.mockio.last_request.config.data);
86 },
87
68 // The widget is created when there are no bug duplicates.88 // The widget is created when there are no bug duplicates.
69 test_widget_creation_no_duplicate_exists: function() {89 test_widget_creation_no_duplicate_exists: function() {
70 this.widget = this._createWidget(false);90 this.widget = this._createWidget(false);
@@ -140,25 +160,6 @@
140 privacy_message.get('text').trim());160 privacy_message.get('text').trim());
141 },161 },
142162
143 // The expected data is submitted after searching for and selecting a
144 // bug.
145 _assert_dupe_submission: function(bug_id) {
146 this._assert_search_form_submission(bug_id);
147 this._assert_search_form_success(bug_id);
148 Y.one(
149 '.yui3-picker-footer-slot [name="field.actions.save"]')
150 .simulate('click');
151 this._assert_form_state(true);
152 Y.Assert.areEqual(
153 '/foobar/bug/1/+duplicate',
154 this.mockio.last_request.url);
155 var expected_link =
156 'field.actions.change=Set%20Duplicate' +
157 '&field.duplicateof=3';
158 Y.Assert.areEqual(
159 expected_link, this.mockio.last_request.config.data);
160 },
161
162 // Submitting a bug dupe works as expected.163 // Submitting a bug dupe works as expected.
163 test_picker_form_submission_success: function() {164 test_picker_form_submission_success: function() {
164 this.widget = this._createWidget(false);165 this.widget = this._createWidget(false);
165166
=== modified file 'lib/lp/registry/javascript/sharing/granteepicker.js'
--- lib/lp/registry/javascript/sharing/granteepicker.js 2012-07-20 03:15:04 +0000
+++ lib/lp/registry/javascript/sharing/granteepicker.js 2012-08-14 18:46:45 +0000
@@ -171,7 +171,7 @@
171 if (Y.Lang.isObject(data.grantee_permissions)) {171 if (Y.Lang.isObject(data.grantee_permissions)) {
172 Y.each(data.grantee_permissions, function(perm, type) {172 Y.each(data.grantee_permissions, function(perm, type) {
173 var cb = step_two_content.one(173 var cb = step_two_content.one(
174 'input[name=field.permission.'+type+']' +174 'input[name="field.permission.'+type+'"]' +
175 '[value="' + perm + '"]');175 '[value="' + perm + '"]');
176 if (Y.Lang.isValue(cb)) {176 if (Y.Lang.isValue(cb)) {
177 cb.set('checked', true);177 cb.set('checked', true);
@@ -221,7 +221,7 @@
221 var contentBox = this.get('contentBox');221 var contentBox = this.get('contentBox');
222 var selected_permissions = {};222 var selected_permissions = {};
223 Y.Array.each(this.get('information_types'), function(info_type) {223 Y.Array.each(this.get('information_types'), function(info_type) {
224 contentBox.all('input[name=field.permission.'+info_type.value+']')224 contentBox.all('input[name="field.permission.'+info_type.value+'"]')
225 .each(function(node) {225 .each(function(node) {
226 if (node.get('checked')) {226 if (node.get('checked')) {
227 selected_permissions[info_type.value] = node.get('value');227 selected_permissions[info_type.value] = node.get('value');
@@ -295,7 +295,7 @@
295 // Disable the radio buttons 'Some' for selected info types.295 // Disable the radio buttons 'Some' for selected info types.
296 var disable_some_button = function(info_type) {296 var disable_some_button = function(info_type) {
297 var selector =297 var selector =
298 'input[name=field.permission.' + info_type + '][value=SOME]';298 'input[name="field.permission.' + info_type + '"][value="SOME"]';
299 policies.all(selector).each(function(permission_node) {299 policies.all(selector).each(function(permission_node) {
300 permission_node.set('disabled', true);300 permission_node.set('disabled', true);
301 permission_node.set(301 permission_node.set(
302302
=== modified file 'lib/lp/registry/javascript/sharing/granteetable.js'
--- lib/lp/registry/javascript/sharing/granteetable.js 2012-07-26 20:29:27 +0000
+++ lib/lp/registry/javascript/sharing/granteetable.js 2012-08-14 18:46:45 +0000
@@ -234,10 +234,10 @@
234 });234 });
235235
236 var id = 'permission-'+grantee.name;236 var id = 'permission-'+grantee.name;
237 var grantee_row = this.get('grantee_table').one('[id=' + id + ']');237 var grantee_row = this.get('grantee_table').one('[id="' + id + '"]');
238 var permission_node = grantee_row.one('[id=td-' + id + ']');238 var permission_node = grantee_row.one('[id="td-' + id + '"]');
239 var contentBox = permission_node.one(239 var contentBox = permission_node.one(
240 '[id=' + policy + '-' + id + ']');240 '[id="' + policy + '-' + id + '"]');
241 var value_location = contentBox.one('.value');241 var value_location = contentBox.one('.value');
242 var editicon = permission_node.one('a.editicon');242 var editicon = permission_node.one('a.editicon');
243243
244244
=== modified file 'lib/lp/registry/javascript/sharing/tests/test_granteetable.js'
--- lib/lp/registry/javascript/sharing/tests/test_granteetable.js 2012-07-21 03:04:06 +0000
+++ lib/lp/registry/javascript/sharing/tests/test_granteetable.js 2012-08-14 18:46:45 +0000
@@ -127,8 +127,8 @@
127 // The given grantee is correctly rendered.127 // The given grantee is correctly rendered.
128 _test_grantee_rendered: function(grantee) {128 _test_grantee_rendered: function(grantee) {
129 // The grantee row129 // The grantee row
130 var grantee_row = Y.one('#grantee-table tr[id=permission-'130 var grantee_row = Y.one('#grantee-table tr[id="permission-'
131 + grantee.name + ']');131 + grantee.name + '"]');
132 Y.Assert.isNotNull(grantee_row);132 Y.Assert.isNotNull(grantee_row);
133 // The sprite or branding icon.133 // The sprite or branding icon.
134 if (Y.Lang.isValue(grantee.icon_url)) {134 if (Y.Lang.isValue(grantee.icon_url)) {
@@ -139,20 +139,20 @@
139 }139 }
140 // The update link140 // The update link
141 Y.Assert.isNotNull(141 Y.Assert.isNotNull(
142 Y.one('#grantee-table span[id=update-'142 Y.one('#grantee-table span[id="update-'
143 + grantee.name + '] a'));143 + grantee.name + '"] a'));
144 // The delete link144 // The delete link
145 Y.Assert.isNotNull(145 Y.Assert.isNotNull(
146 Y.one('#grantee-table span[id=remove-'146 Y.one('#grantee-table span[id="remove-'
147 + grantee.name + '] a'));147 + grantee.name + '"] a'));
148 // The sharing permissions148 // The sharing permissions
149 var self = this;149 var self = this;
150 Y.each(grantee.permissions, function(permission, info_type) {150 Y.each(grantee.permissions, function(permission, info_type) {
151 var permission_node =151 var permission_node =
152 Y.one('#grantee-table td[id=td-permission-'152 Y.one('#grantee-table td[id="td-permission-'
153 + grantee.name + '] ul li '153 + grantee.name + '"] ul li '
154 + 'span[id=' + info_type + '-permission-'154 + 'span[id="' + info_type + '-permission-'
155 + grantee.name + '] span.value');155 + grantee.name + '"] span.value');
156 Y.Assert.isNotNull(permission_node);156 Y.Assert.isNotNull(permission_node);
157 var expected_content =157 var expected_content =
158 self.information_types[info_type] + ': ' +158 self.information_types[info_type] + ': ' +
@@ -165,7 +165,7 @@
165 if (grantee.shared_items_exist) {165 if (grantee.shared_items_exist) {
166 Y.Assert.isNotNull(166 Y.Assert.isNotNull(
167 shared_items_cell.one(167 shared_items_cell.one(
168 'a[href=+sharing/' + grantee.name + ']'));168 'a[href="+sharing/' + grantee.name + '"]'));
169 } else {169 } else {
170 Y.Assert.areEqual(170 Y.Assert.areEqual(
171 'No items shared through subscriptions.',171 'No items shared through subscriptions.',
@@ -201,7 +201,7 @@
201 }201 }
202 );202 );
203 var update_link_to_click =203 var update_link_to_click =
204 Y.one('#grantee-table span[id=update-fred] a');204 Y.one('#grantee-table span[id="update-fred"] a');
205 update_link_to_click.simulate('click');205 update_link_to_click.simulate('click');
206 Y.Assert.isTrue(event_fired);206 Y.Assert.isTrue(event_fired);
207 },207 },
@@ -252,7 +252,7 @@
252 }252 }
253 );253 );
254 var delete_link_to_click =254 var delete_link_to_click =
255 Y.one('#grantee-table span[id=remove-fred] a');255 Y.one('#grantee-table span[id="remove-fred"] a');
256 delete_link_to_click.simulate('click');256 delete_link_to_click.simulate('click');
257 Y.Assert.isTrue(event_fired);257 Y.Assert.isTrue(event_fired);
258 },258 },
@@ -286,10 +286,10 @@
286 }286 }
287 );287 );
288 var permission_popup =288 var permission_popup =
289 Y.one('#grantee-table span[id=P1-permission-fred] a');289 Y.one('#grantee-table span[id="P1-permission-fred"] a');
290 permission_popup.simulate('click');290 permission_popup.simulate('click');
291 var permission_choice = Y.one(291 var permission_choice = Y.one(
292 '.yui3-ichoicelist-content a[href=#s2]');292 '.yui3-ichoicelist-content a[href="#s2"]');
293 permission_choice.simulate('click');293 permission_choice.simulate('click');
294 Y.Assert.isTrue(event_fired);294 Y.Assert.isTrue(event_fired);
295 },295 },
@@ -378,7 +378,7 @@
378 // A named grantee operation error is displayed correctly.378 // A named grantee operation error is displayed correctly.
379 this.grantee_table = this._create_Widget();379 this.grantee_table = this._create_Widget();
380 this.grantee_table.render();380 this.grantee_table.render();
381 var row_fred = Y.one('#grantee-table tr[id=permission-fred]');381 var row_fred = Y.one('#grantee-table tr[id="permission-fred"]');
382 var success = false;382 var success = false;
383 Y.lp.app.errors.display_error = function(flash_node, msg) {383 Y.lp.app.errors.display_error = function(flash_node, msg) {
384 Y.Assert.areEqual(row_fred, flash_node);384 Y.Assert.areEqual(row_fred, flash_node);