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

Proposed by Richard Harding on 2012-07-05
Status: Merged
Approved by: j.c.sackett on 2012-07-05
Approved revision: no longer in the source branch.
Merged at revision: 15562
Proposed branch: lp:~rharding/launchpad/fix_attr_quotes
Merge into: lp:launchpad
Diff against target: 249 lines (+31/-31)
8 files modified
lib/lp/app/javascript/formwidgets/tests/test_formwidgets.js (+4/-4)
lib/lp/app/widgets/templates/license.pt (+2/-2)
lib/lp/bugs/javascript/official_bug_tags.js (+1/-1)
lib/lp/code/javascript/sourcepackagerecipe.new.js (+2/-2)
lib/lp/registry/javascript/sharing/shareepicker.js (+3/-3)
lib/lp/registry/javascript/sharing/tests/test_shareepicker.js (+16/-16)
lib/lp/registry/javascript/tests/test_team.js (+2/-2)
lib/lp/registry/templates/distroseries-localdifferences.pt (+1/-1)
To merge this branch: bzr merge lp:~rharding/launchpad/fix_attr_quotes
Reviewer Review Type Date Requested Status
j.c.sackett (community) 2012-07-05 Approve on 2012-07-05
Review via email: mp+113610@code.launchpad.net

Commit Message

Add quotes to JS selectors using attributes.

Description of the Change

= Summary =

In YUI 3.5 all selectors based on attribute values must be quoted. This is a
clean up based on the search through the codebase for selectors missing the
quotes.

== Implementation Notes ==

The search used was:

grep -P "\([\"']\w+\[[^'\"]*\]" lib/lp/**/*.(pt|js)

This only changes quotes and no other changes to the files/setup.

== Tests ==

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

== LoC Qualification ==

This is an even LoC change. We're only changing quotes not adding/removing any
maint.

To post a comment you must log in.
j.c.sackett (jcsackett) :
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/formwidgets/tests/test_formwidgets.js'
2--- lib/lp/app/javascript/formwidgets/tests/test_formwidgets.js 2012-06-15 04:07:30 +0000
3+++ lib/lp/app/javascript/formwidgets/tests/test_formwidgets.js 2012-07-05 16:50:24 +0000
4@@ -394,7 +394,7 @@
5 .set("choices", ["a", "b"]);
6 ArrayAssert.itemsAreSame(
7 [], this.widget.get("choice"));
8- this.widget.fieldNode.one("input[value=a]")
9+ this.widget.fieldNode.one("input[value='a']")
10 .set("checked", "checked");
11 ArrayAssert.itemsAreSame(
12 ["a"], attrselect("value")(this.widget.get("choice")));
13@@ -407,12 +407,12 @@
14 .set("multiple", false)
15 .set("choices", ["a", "b"]);
16 Assert.isNull(this.widget.get("choice"));
17- this.widget.fieldNode.one("input[value=a]")
18+ this.widget.fieldNode.one("input[value='a']")
19 .set("checked", "checked");
20 Assert.areSame("a", this.widget.get("choice").value);
21- this.widget.fieldNode.one("input[value=b]")
22+ this.widget.fieldNode.one("input[value='b']")
23 .set("checked", "checked");
24- if (this.widget.fieldNode.one("input[value=a]").get("checked")) {
25+ if (this.widget.fieldNode.one("input[value='a']").get("checked")) {
26 // This assertion can only be made if the DOM/JS is broken
27 // in the host browser.
28 Assert.isUndefined(this.widget.get("choice"));
29
30=== modified file 'lib/lp/app/widgets/templates/license.pt'
31--- lib/lp/app/widgets/templates/license.pt 2012-05-24 21:38:54 +0000
32+++ lib/lp/app/widgets/templates/license.pt 2012-07-05 16:50:24 +0000
33@@ -131,8 +131,8 @@
34
35 // When Other/Proprietary or Other/Open Source is chosen, the
36 // license_info widget is displayed.
37- var other_com = Y.one('input[value=OTHER_PROPRIETARY]');
38- var other_os = Y.one('input[value=OTHER_OPEN_SOURCE]');
39+ var other_com = Y.one('input[value="OTHER_PROPRIETARY"]');
40+ var other_os = Y.one('input[value="OTHER_OPEN_SOURCE"]');
41 var details = Y.one('#license-details');
42 var proprietary = Y.one('#proprietary');
43
44
45=== modified file 'lib/lp/bugs/javascript/official_bug_tags.js'
46--- lib/lp/bugs/javascript/official_bug_tags.js 2012-04-26 19:11:37 +0000
47+++ lib/lp/bugs/javascript/official_bug_tags.js 2012-07-05 16:50:24 +0000
48@@ -429,7 +429,7 @@
49 });
50
51 // All went well, hide the plain html form.
52- Y.one('form[name=launchpadform]').setStyle('display', 'none');
53+ Y.one('form[name="launchpadform"]').setStyle('display', 'none');
54 };
55 }, "0.1", {
56 "requires": [
57
58=== modified file 'lib/lp/code/javascript/sourcepackagerecipe.new.js'
59--- lib/lp/code/javascript/sourcepackagerecipe.new.js 2010-12-13 08:23:15 +0000
60+++ lib/lp/code/javascript/sourcepackagerecipe.new.js 2012-07-05 16:50:24 +0000
61@@ -30,7 +30,7 @@
62 }
63
64 module.onclick_use_ppa = function(e) {
65- var value = getRadioSelectedValue('input[name=field.use_ppa]');
66+ var value = getRadioSelectedValue('input[name="field.use_ppa"]');
67 if (value == 'create-new') {
68 set_enabled(PPA_NAME_ID, true);
69 set_enabled(PPA_SELECTOR_ID, false);
70@@ -42,7 +42,7 @@
71 };
72
73 module.setup = function() {
74- Y.all('input[name=field.use_ppa]').on(
75+ Y.all('input[name="field.use_ppa"]').on(
76 'click', module.onclick_use_ppa);
77
78 // Set the initial state.
79
80=== modified file 'lib/lp/registry/javascript/sharing/shareepicker.js'
81--- lib/lp/registry/javascript/sharing/shareepicker.js 2012-06-22 03:25:33 +0000
82+++ lib/lp/registry/javascript/sharing/shareepicker.js 2012-07-05 16:50:24 +0000
83@@ -122,7 +122,7 @@
84 sharing_permissions, disabled_some_types);
85 step_two_content.one('div.step-links')
86 .insert(policy_selector, 'before');
87- step_two_content.all('input[name^=field.permission]')
88+ step_two_content.all('input[name^="field.permission"]')
89 .on('click', function(e) {
90 self._disable_select_if_all_info_choices_nothing(step_two_content);
91 });
92@@ -162,7 +162,7 @@
93 }
94 }, '.next', this);
95 // Initially set all radio buttons to Nothing.
96- step_two_content.all('input[name^=field.permission][value=NOTHING]')
97+ step_two_content.all('input[name^="field.permission"][value="NOTHING"]')
98 .each(function(radio_button) {
99 radio_button.set('checked', true);
100 });
101@@ -190,7 +190,7 @@
102 */
103 _all_info_choices_nothing: function(content) {
104 var all_unticked = true;
105- content.all('input[name^=field.permission]')
106+ content.all('input[name^="field.permission"]')
107 .each(function(info_node) {
108 if (info_node.get('value') !== 'NOTHING') {
109 all_unticked &= !info_node.get('checked');
110
111=== modified file 'lib/lp/registry/javascript/sharing/tests/test_shareepicker.js'
112--- lib/lp/registry/javascript/sharing/tests/test_shareepicker.js 2012-06-22 03:25:33 +0000
113+++ lib/lp/registry/javascript/sharing/tests/test_shareepicker.js 2012-07-05 16:50:24 +0000
114@@ -128,8 +128,8 @@
115 Y.Array.each(this.information_types, function(info_type) {
116 Y.Array.each(this.sharing_permissions, function(permission) {
117 var rb = step_two_content.one(
118- 'input[name=field.permission.' + info_type.value +
119- '][value="' + permission.value + '"]');
120+ 'input[name="field.permission.' + info_type.value +
121+ '"][value="' + permission.value + '"]');
122 Y.Assert.isNotNull(rb);
123 });
124 });
125@@ -187,11 +187,11 @@
126 'Update sharing policies for Fred', steptitle);
127 // By default, selections only for ALL and NOTHING are available
128 // (and no others).
129- Y.Assert.isNotNull(cb.one('input[value=ALL]'));
130- Y.Assert.isNotNull(cb.one('input[value=NOTHING]'));
131- Y.Assert.isNull(cb.one('input[value=SOME]'));
132+ Y.Assert.isNotNull(cb.one('input[value="ALL"]'));
133+ Y.Assert.isNotNull(cb.one('input[value="NOTHING"]'));
134+ Y.Assert.isNull(cb.one('input[value="SOME"]'));
135 // Selected permission checkboxes should be ticked.
136- cb.all('input[name=field.permission.P1]')
137+ cb.all('input[name="field.permission.P1"]')
138 .each(function(node) {
139 if (node.get('checked')) {
140 Y.Assert.areEqual('ALL', node.get('value'));
141@@ -200,7 +200,7 @@
142 }
143 });
144 Y.Array.each(['P2', 'P3'], function(info_type) {
145- cb.all('input[name=field.permission.' + info_type + ']')
146+ cb.all('input[name="field.permission.' + info_type + '"]')
147 .each(function(node) {
148 if (node.get('checked')) {
149 Y.Assert.areEqual('NOTHING', node.get('value'));
150@@ -232,9 +232,9 @@
151 allowed_permissions: ['SOME']
152 });
153 var cb = this.picker.get('contentBox');
154- Y.Assert.isNull(cb.one('input[value=ALL]'));
155- Y.Assert.isNull(cb.one('input[value=NOTHING]'));
156- Y.Assert.isNotNull(cb.one('input[value=SOME]'));
157+ Y.Assert.isNull(cb.one('input[value="ALL"]'));
158+ Y.Assert.isNull(cb.one('input[value="NOTHING"]'));
159+ Y.Assert.isNotNull(cb.one('input[value="SOME"]'));
160 },
161
162 // Test that selected radio buttons for permission type 'Some' can be
163@@ -261,7 +261,7 @@
164 Y.Assert.areEqual(expected_disabled, node.get('disabled'));
165 };
166 var cb = this.picker.get('contentBox');
167- cb.all('input[type=radio][name^=field.permission]').each(
168+ cb.all('input[type="radio"][name^="field.permission"]').each(
169 check_permission_node);
170 },
171
172@@ -314,7 +314,7 @@
173 var step_two_content = cb.one('.picker-content-two');
174 // Select an access policy.
175 step_two_content
176- .one('input[name=field.permission.P2][value="ALL"]')
177+ .one('input[name="field.permission.P2"][value="ALL"]')
178 .simulate('click');
179 var select_link = step_two_content.one('a.next');
180 select_link.simulate('click');
181@@ -354,7 +354,7 @@
182 '.yui3-picker-results li:nth-child(2)').simulate('click');
183 // Select an access policy.
184 step_two_content
185- .one('input[name=field.permission.P2][value="ALL"]')
186+ .one('input[name="field.permission.P2"][value="ALL"]')
187 .simulate('click');
188 var select_link = step_two_content.one('a.next');
189 select_link.simulate('click');
190@@ -398,13 +398,13 @@
191 select_link.simulate('click');
192 Y.Assert.isFalse(save_called);
193 // Select one info type and check submit links are enabled.
194- cb.one('input[name=field.permission.P1][value=ALL]')
195+ cb.one('input[name="field.permission.P1"][value="ALL"]')
196 .simulate('click');
197 cb.all('a.next', function(link) {
198 Y.Assert.isFalse(link.hasClass('invalid-link'));
199 });
200 // De-select info type and submit links are disabled again.
201- cb.one('input[name=field.permission.P1][value=NOTHING]')
202+ cb.one('input[name="field.permission.P1"][value="NOTHING"]')
203 .simulate('click');
204 cb.all('a.next', function(link) {
205 Y.Assert.isTrue(link.hasClass('invalid-link'));
206@@ -412,7 +412,7 @@
207 select_link.simulate('click');
208 Y.Assert.isFalse(save_called);
209 // Once at least one info type is selected, save is called.
210- cb.one('input[name=field.permission.P1][value=ALL]')
211+ cb.one('input[name="field.permission.P1"][value="ALL"]')
212 .simulate('click');
213 select_link.simulate('click');
214 Y.Assert.isTrue(save_called);
215
216=== modified file 'lib/lp/registry/javascript/tests/test_team.js'
217--- lib/lp/registry/javascript/tests/test_team.js 2012-04-06 17:28:25 +0000
218+++ lib/lp/registry/javascript/tests/test_team.js 2012-07-05 16:50:24 +0000
219@@ -63,7 +63,7 @@
220 test_visibility_change_private: function() {
221 namespace.visibility_changed('PRIVATE');
222 var nr_radio_buttons = 0;
223- Y.all('input[type=radio]').each(function(radio_button) {
224+ Y.all('input[type="radio"]').each(function(radio_button) {
225 if (radio_button.ancestor('tr').hasClass('unseen')
226 || !radio_button.get('checked')) {
227 return;
228@@ -103,7 +103,7 @@
229
230 namespace.visibility_changed('PUBLIC');
231 var nr_radio_buttons = 0;
232- Y.all('input[type=radio]').each(function(radio_button) {
233+ Y.all('input[type="radio"]').each(function(radio_button) {
234 Y.Assert.isFalse(
235 radio_button.ancestor('tr').hasClass('unseen'));
236 var help_row = radio_button.ancestor('tr')
237
238=== modified file 'lib/lp/registry/templates/distroseries-localdifferences.pt'
239--- lib/lp/registry/templates/distroseries-localdifferences.pt 2012-03-02 16:17:46 +0000
240+++ lib/lp/registry/templates/distroseries-localdifferences.pt 2012-07-05 16:50:24 +0000
241@@ -65,7 +65,7 @@
242 'lp.app.confirmationoverlay',function(Y) {
243 Y.on('domready', function() {
244 var dsd_details = Y.lp.registry.distroseriesdifferences_details;
245- Y.all('input[name=field.actions.sync]').each(function(button) {
246+ Y.all('input[name="field.actions.sync"]').each(function(button) {
247 // Cleanup the button's title which says the button is disabled if
248 // Javascript is disabled.
249 button.set('title', '');