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
1=== modified file 'lib/lp/app/javascript/choiceedit/choiceedit.js'
2--- lib/lp/app/javascript/choiceedit/choiceedit.js 2012-08-08 16:42:21 +0000
3+++ lib/lp/app/javascript/choiceedit/choiceedit.js 2012-08-14 18:46:45 +0000
4@@ -174,7 +174,7 @@
5 if (!this.get('clickable_content')) {
6 var content = this.get('contentBox');
7 content.addClass('no-click');
8- };
9+ }
10 },
11
12 /**
13@@ -652,7 +652,7 @@
14 }
15 },
16 /**
17- * The specialised version of the items attirbute is cloned and the name
18+ * The specialised version of the items attribute is cloned and the name
19 * of the null value is modified to add a remove icon next to it. If the
20 * currently selected value is null, the null item is not displayed.
21 *
22
23=== modified file 'lib/lp/app/javascript/choiceedit/tests/test_choiceedit.js'
24--- lib/lp/app/javascript/choiceedit/tests/test_choiceedit.js 2012-08-08 16:55:17 +0000
25+++ lib/lp/app/javascript/choiceedit/tests/test_choiceedit.js 2012-08-14 18:46:45 +0000
26@@ -486,10 +486,9 @@
27 this.null_choice_edit.get('actionicon'),
28 this.null_choice_edit.get('addicon'),
29 'Action icon is not the add icon like expected.');
30-
31 Assert.areEqual(
32+ 'inline',
33 this.null_choice_edit.get('addicon').getStyle('display'),
34- 'inline',
35 'Add icon is not visible when it should be');
36 Assert.areEqual(
37 this.null_choice_edit.get('editicon').getStyle('display'),
38@@ -499,7 +498,7 @@
39 simulate(this.null_choice_edit.get('boundingBox'),
40 '.value', 'click');
41 simulate(this.null_choice_edit._choice_list.get('boundingBox'),
42- 'li a[href$=groucho]', 'click');
43+ 'li a[href$="groucho"]', 'click');
44 this.null_choice_edit._uiClearWaiting();
45
46 Assert.areEqual(
47@@ -511,8 +510,8 @@
48 'none',
49 "Add icon is visible when it shouldn't be");
50 Assert.areEqual(
51+ 'inline',
52 this.null_choice_edit.get('editicon').getStyle('display'),
53- 'inline',
54 "Edit icon is not visible when it shouldn be");
55 },
56
57@@ -553,8 +552,6 @@
58 }
59 }));
60
61-
62-
63 }, '0.1', {
64 'requires': ['test', 'console', 'lp.choiceedit', 'node', 'event',
65 'event-simulate', 'widget-stack', 'lp.app.choice']
66
67=== modified file 'lib/lp/app/javascript/testing/assert.js'
68--- lib/lp/app/javascript/testing/assert.js 2011-10-18 15:36:34 +0000
69+++ lib/lp/app/javascript/testing/assert.js 2012-08-14 18:46:45 +0000
70@@ -14,4 +14,5 @@
71 namespace.assert_equal_structure = function(expected, actual){
72 Y.Assert.areEqual(JSON.stringify(expected), JSON.stringify(actual));
73 };
74-}, '0.1', {'requires': []});
75+
76+}, '0.1', {'requires': ['testing']});
77
78=== modified file 'lib/lp/app/javascript/testing/helpers.js'
79--- lib/lp/app/javascript/testing/helpers.js 2012-08-01 14:09:19 +0000
80+++ lib/lp/app/javascript/testing/helpers.js 2012-08-14 18:46:45 +0000
81@@ -32,7 +32,7 @@
82 *
83 * EXAMPLE:
84 * var client = new ns.LPCLient();
85- *
86+ *
87 * client.get.args = [];
88 * client.get(function_arg1, function_arg2);
89 */
90@@ -57,10 +57,10 @@
91 }
92 /**
93 * Captures call data and simulates callbacks.
94- *
95+ *
96 * The function called and the arguments it's called with are added to the
97 * LPCLient's `received` attribute.
98- *
99+ *
100 * Callback behavior are governed by the args set on the callee.
101 * @method
102 */
103
104=== modified file 'lib/lp/bugs/javascript/bug_picker.js'
105--- lib/lp/bugs/javascript/bug_picker.js 2012-08-10 04:48:36 +0000
106+++ lib/lp/bugs/javascript/bug_picker.js 2012-08-14 18:46:45 +0000
107@@ -203,15 +203,14 @@
108 },
109
110 _private_warning_template: function(message) {
111- var template = [
112+ return [
113 '{{#private_warning}}',
114 '<tr><td><p id="privacy-warning" ',
115 'class="block-sprite large-warning">',
116- '{message}',
117+ message,
118 '</p></td></tr>',
119 '{{/private_warning}}'
120 ].join(' ');
121- return Y.Lang.substitute(template, {message: message});
122 },
123
124 // Template for the bug confirmation form.
125@@ -237,12 +236,12 @@
126 var private_warning_message
127 = this.get('private_warning_message');
128 var html = Y.lp.mustache.to_html(
129- this._bug_confirmation_form_template(), bug_data,
130- {
131+ this._bug_confirmation_form_template(),
132+ bug_data, {
133 bug_details: this._bug_details_template(),
134 private_warning:
135 this._private_warning_template(private_warning_message)
136- });
137+ });
138 var bug_details_node = Y.Node.create(html);
139 var bug_link = bug_details_node.one('.bugtitle');
140 bug_link.on('click', function(e) {
141
142=== modified file 'lib/lp/bugs/javascript/tests/test_bug_picker.js'
143--- lib/lp/bugs/javascript/tests/test_bug_picker.js 2012-08-08 11:59:48 +0000
144+++ lib/lp/bugs/javascript/tests/test_bug_picker.js 2012-08-14 18:46:45 +0000
145@@ -32,6 +32,12 @@
146 }
147 },
148
149+ // The specified error message is displayed.
150+ _assert_error_display: function(message) {
151+ var error_msg = Y.one('.yui3-picker-error');
152+ Y.Assert.areEqual(message, error_msg.get('text').trim());
153+ },
154+
155 // The bug entry form is visible visible or not.
156 _assert_form_state: function(bug_details_visible) {
157 var bug_info = Y.one('.yui3-picker-results ' +
158@@ -140,11 +146,6 @@
159 Y.Assert.isTrue(save_bug_called);
160 },
161
162- // The specified error message is displayed.
163- _assert_error_display: function(message) {
164- var error_msg = Y.one('.yui3-picker-error');
165- Y.Assert.areEqual(message, error_msg.get('text').trim());
166- },
167
168 // The error is displayed as expected when the initial bug search
169 // fails with a generic error.
170
171=== modified file 'lib/lp/bugs/javascript/tests/test_duplicates.js'
172--- lib/lp/bugs/javascript/tests/test_duplicates.js 2012-08-09 04:56:41 +0000
173+++ lib/lp/bugs/javascript/tests/test_duplicates.js 2012-08-14 18:46:45 +0000
174@@ -37,6 +37,7 @@
175 }
176 delete this.mockio;
177 delete window.LP;
178+ delete this.lp_client;
179 },
180
181 test_library_exists: function () {
182@@ -65,6 +66,25 @@
183 return widget;
184 },
185
186+ // The expected data is submitted after searching for and selecting a
187+ // bug.
188+ _assert_dupe_submission: function(bug_id) {
189+ this._assert_search_form_submission(bug_id);
190+ this._assert_search_form_success(bug_id);
191+ Y.one(
192+ '.yui3-picker-footer-slot [name="field.actions.save"]')
193+ .simulate('click');
194+ this._assert_form_state(true);
195+ Y.Assert.areEqual(
196+ '/foobar/bug/1/+duplicate',
197+ this.mockio.last_request.url);
198+ var expected_link =
199+ 'field.actions.change=Set%20Duplicate' +
200+ '&field.duplicateof=3';
201+ Y.Assert.areEqual(
202+ expected_link, this.mockio.last_request.config.data);
203+ },
204+
205 // The widget is created when there are no bug duplicates.
206 test_widget_creation_no_duplicate_exists: function() {
207 this.widget = this._createWidget(false);
208@@ -140,25 +160,6 @@
209 privacy_message.get('text').trim());
210 },
211
212- // The expected data is submitted after searching for and selecting a
213- // bug.
214- _assert_dupe_submission: function(bug_id) {
215- this._assert_search_form_submission(bug_id);
216- this._assert_search_form_success(bug_id);
217- Y.one(
218- '.yui3-picker-footer-slot [name="field.actions.save"]')
219- .simulate('click');
220- this._assert_form_state(true);
221- Y.Assert.areEqual(
222- '/foobar/bug/1/+duplicate',
223- this.mockio.last_request.url);
224- var expected_link =
225- 'field.actions.change=Set%20Duplicate' +
226- '&field.duplicateof=3';
227- Y.Assert.areEqual(
228- expected_link, this.mockio.last_request.config.data);
229- },
230-
231 // Submitting a bug dupe works as expected.
232 test_picker_form_submission_success: function() {
233 this.widget = this._createWidget(false);
234
235=== modified file 'lib/lp/registry/javascript/sharing/granteepicker.js'
236--- lib/lp/registry/javascript/sharing/granteepicker.js 2012-07-20 03:15:04 +0000
237+++ lib/lp/registry/javascript/sharing/granteepicker.js 2012-08-14 18:46:45 +0000
238@@ -171,7 +171,7 @@
239 if (Y.Lang.isObject(data.grantee_permissions)) {
240 Y.each(data.grantee_permissions, function(perm, type) {
241 var cb = step_two_content.one(
242- 'input[name=field.permission.'+type+']' +
243+ 'input[name="field.permission.'+type+'"]' +
244 '[value="' + perm + '"]');
245 if (Y.Lang.isValue(cb)) {
246 cb.set('checked', true);
247@@ -221,7 +221,7 @@
248 var contentBox = this.get('contentBox');
249 var selected_permissions = {};
250 Y.Array.each(this.get('information_types'), function(info_type) {
251- contentBox.all('input[name=field.permission.'+info_type.value+']')
252+ contentBox.all('input[name="field.permission.'+info_type.value+'"]')
253 .each(function(node) {
254 if (node.get('checked')) {
255 selected_permissions[info_type.value] = node.get('value');
256@@ -295,7 +295,7 @@
257 // Disable the radio buttons 'Some' for selected info types.
258 var disable_some_button = function(info_type) {
259 var selector =
260- 'input[name=field.permission.' + info_type + '][value=SOME]';
261+ 'input[name="field.permission.' + info_type + '"][value="SOME"]';
262 policies.all(selector).each(function(permission_node) {
263 permission_node.set('disabled', true);
264 permission_node.set(
265
266=== modified file 'lib/lp/registry/javascript/sharing/granteetable.js'
267--- lib/lp/registry/javascript/sharing/granteetable.js 2012-07-26 20:29:27 +0000
268+++ lib/lp/registry/javascript/sharing/granteetable.js 2012-08-14 18:46:45 +0000
269@@ -234,10 +234,10 @@
270 });
271
272 var id = 'permission-'+grantee.name;
273- var grantee_row = this.get('grantee_table').one('[id=' + id + ']');
274- var permission_node = grantee_row.one('[id=td-' + id + ']');
275+ var grantee_row = this.get('grantee_table').one('[id="' + id + '"]');
276+ var permission_node = grantee_row.one('[id="td-' + id + '"]');
277 var contentBox = permission_node.one(
278- '[id=' + policy + '-' + id + ']');
279+ '[id="' + policy + '-' + id + '"]');
280 var value_location = contentBox.one('.value');
281 var editicon = permission_node.one('a.editicon');
282
283
284=== modified file 'lib/lp/registry/javascript/sharing/tests/test_granteetable.js'
285--- lib/lp/registry/javascript/sharing/tests/test_granteetable.js 2012-07-21 03:04:06 +0000
286+++ lib/lp/registry/javascript/sharing/tests/test_granteetable.js 2012-08-14 18:46:45 +0000
287@@ -127,8 +127,8 @@
288 // The given grantee is correctly rendered.
289 _test_grantee_rendered: function(grantee) {
290 // The grantee row
291- var grantee_row = Y.one('#grantee-table tr[id=permission-'
292- + grantee.name + ']');
293+ var grantee_row = Y.one('#grantee-table tr[id="permission-'
294+ + grantee.name + '"]');
295 Y.Assert.isNotNull(grantee_row);
296 // The sprite or branding icon.
297 if (Y.Lang.isValue(grantee.icon_url)) {
298@@ -139,20 +139,20 @@
299 }
300 // The update link
301 Y.Assert.isNotNull(
302- Y.one('#grantee-table span[id=update-'
303- + grantee.name + '] a'));
304+ Y.one('#grantee-table span[id="update-'
305+ + grantee.name + '"] a'));
306 // The delete link
307 Y.Assert.isNotNull(
308- Y.one('#grantee-table span[id=remove-'
309- + grantee.name + '] a'));
310+ Y.one('#grantee-table span[id="remove-'
311+ + grantee.name + '"] a'));
312 // The sharing permissions
313 var self = this;
314 Y.each(grantee.permissions, function(permission, info_type) {
315 var permission_node =
316- Y.one('#grantee-table td[id=td-permission-'
317- + grantee.name + '] ul li '
318- + 'span[id=' + info_type + '-permission-'
319- + grantee.name + '] span.value');
320+ Y.one('#grantee-table td[id="td-permission-'
321+ + grantee.name + '"] ul li '
322+ + 'span[id="' + info_type + '-permission-'
323+ + grantee.name + '"] span.value');
324 Y.Assert.isNotNull(permission_node);
325 var expected_content =
326 self.information_types[info_type] + ': ' +
327@@ -165,7 +165,7 @@
328 if (grantee.shared_items_exist) {
329 Y.Assert.isNotNull(
330 shared_items_cell.one(
331- 'a[href=+sharing/' + grantee.name + ']'));
332+ 'a[href="+sharing/' + grantee.name + '"]'));
333 } else {
334 Y.Assert.areEqual(
335 'No items shared through subscriptions.',
336@@ -201,7 +201,7 @@
337 }
338 );
339 var update_link_to_click =
340- Y.one('#grantee-table span[id=update-fred] a');
341+ Y.one('#grantee-table span[id="update-fred"] a');
342 update_link_to_click.simulate('click');
343 Y.Assert.isTrue(event_fired);
344 },
345@@ -252,7 +252,7 @@
346 }
347 );
348 var delete_link_to_click =
349- Y.one('#grantee-table span[id=remove-fred] a');
350+ Y.one('#grantee-table span[id="remove-fred"] a');
351 delete_link_to_click.simulate('click');
352 Y.Assert.isTrue(event_fired);
353 },
354@@ -286,10 +286,10 @@
355 }
356 );
357 var permission_popup =
358- Y.one('#grantee-table span[id=P1-permission-fred] a');
359+ Y.one('#grantee-table span[id="P1-permission-fred"] a');
360 permission_popup.simulate('click');
361 var permission_choice = Y.one(
362- '.yui3-ichoicelist-content a[href=#s2]');
363+ '.yui3-ichoicelist-content a[href="#s2"]');
364 permission_choice.simulate('click');
365 Y.Assert.isTrue(event_fired);
366 },
367@@ -378,7 +378,7 @@
368 // A named grantee operation error is displayed correctly.
369 this.grantee_table = this._create_Widget();
370 this.grantee_table.render();
371- var row_fred = Y.one('#grantee-table tr[id=permission-fred]');
372+ var row_fred = Y.one('#grantee-table tr[id="permission-fred"]');
373 var success = false;
374 Y.lp.app.errors.display_error = function(flash_node, msg) {
375 Y.Assert.areEqual(row_fred, flash_node);