Merge lp:~michael.nelson/launchpad/db_soyuz_js_tests_broken into lp:launchpad/db-devel

Proposed by Michael Nelson
Status: Merged
Merged at revision: not available
Proposed branch: lp:~michael.nelson/launchpad/db_soyuz_js_tests_broken
Merge into: lp:launchpad/db-devel
Diff against target: 134 lines (+14/-24)
3 files modified
lib/canonical/launchpad/javascript/soyuz/lp_dynamic_dom_updater.js (+11/-21)
lib/canonical/launchpad/javascript/soyuz/tests/archivesubscribers_index.js (+2/-2)
lib/canonical/launchpad/javascript/soyuz/tests/lp_dynamic_dom_updater.js (+1/-1)
To merge this branch: bzr merge lp:~michael.nelson/launchpad/db_soyuz_js_tests_broken
Reviewer Review Type Date Requested Status
Māris Fogels (community) Approve
Review via email: mp+15204@code.launchpad.net
To post a comment you must log in.
Revision history for this message
Michael Nelson (michael.nelson) wrote :
Download full text (7.5 KiB)

= Summary =

This branch fixes two things. First, it updates the soyuz js unit-tests
so that they work. Second, it updates the DynamicDomUpdater plugin to
work with YUI3.

== Proposed fix ==

Update tests to use 'test' instead of 'yuitest'.

Update the plugin to use the new 'host' attribute rather than the
previous 'owner' attribute, for the node hosting the plugin.

== Pre-implementation notes ==

== Implementation details ==

== Tests ==

firefox
lib/canonical/launchpad/javascript/soyuz/tests/lp_dynamic_dom_updater.html

firefox
lib/canonical/launchpad/javascript/soyuz/tests/archivesubscribers_index.html

== Demo and Q/A ==

= Launchpad lint =

Lint seems to have linted more than just the files I've changed, but all
the files I've changed (under javascript/soyuz) are lint-free.

Checking for conflicts. and issues in doctests and templates.
Running jslint, xmllint, pyflakes, and pylint.
Using normal rules.

Linting changed files:
  lib/canonical/launchpad/javascript/soyuz/tests/lp_dynamic_dom_updater.js
  lib/canonical/launchpad/javascript/soyuz/tests/archivesubscribers_index.js
  lib/canonical/launchpad/javascript/soyuz/lp_dynamic_dom_updater.js

== JSLint notices ==
jslint: Lint found in
'/home/michael/canonical/lp-branches/db_soyuz_js_tests_broken/lib/canonical/launchpad/javascript/bugs/bug_tags_entry.js':
Line 68 character 42: Use '!==' to compare with ''.
            function(elem) { return elem != ''; });

Line 106 character 40: Use '===' to compare with ''.
            if (Y.Lang.trim(tags_html) == '') {

Line 132 character 23: Line breaking error ')'.
    autocomplete.hide()

Line 132 character 24: Missing semicolon.
    autocomplete.hide()

Line 134 character 53: Use '===' to compare with ''.
    if (Y.Lang.trim(tag_list_span.get('innerHTML')) == '') {

Line 164 character 25: ['me'] is better written in dot notation.
    if (LP.client.links['me'] === undefined) { return; }

Line 217 character 43: Line breaking error ')'.
    edit_tags_trigger.addClass('js-action')

Line 217 character 44: Missing semicolon.
    edit_tags_trigger.addClass('js-action')

Line 228 character 22: Use '!==' to compare with 'null'.
        if (e.newVal != null) {

jslint: No problem found in
'/home/michael/canonical/lp-branches/db_soyuz_js_tests_broken/lib/canonical/launchpad/javascript/bugs/bugtask-index.js'.

jslint: No problem found in
'/home/michael/canonical/lp-branches/db_soyuz_js_tests_broken/lib/canonical/launchpad/javascript/bugs/filebug-dupefinder.js'.

jslint: Lint found in
'/home/michael/canonical/lp-branches/db_soyuz_js_tests_broken/lib/canonical/launchpad/javascript/bugs/offical_bug_tags.js':
Line 81 character 19: Use '===' to compare with 'null'.
        if (count == null) {

Line 147 character 20: Use '===' to compare with '0'.
    if (item.count == 0) {

Line 304 character 23: Use '===' to compare with 'null'.
            if (count == null) {

Line 403 character 57: Use '===' to compare with ''.
        Y.one('#new-tag-add').set('disabled', new_value == '');

jslint: No problem found in
'/home/michael/canonical/lp-branches/db_soyuz_js_tests_broken/lib/canonical/launchpad/javascript/bugs/subscriber.js'.

jslint: No problem foun...

Read more...

Revision history for this message
Māris Fogels (mars) wrote :

Hi Michael,

Thanks for running lint. Seems it has slipped out from under our regular review process :)

Your changes look good. r=mars

I though of one future enhancement for this code, now that we have some more YUI experience: it could be lightened up to only use 'plugin-base', instead of pulling in the whole 'plugin' module and its dependencies. But that is for another day.

Maris

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'lib/canonical/launchpad/javascript/soyuz/lp_dynamic_dom_updater.js'
2--- lib/canonical/launchpad/javascript/soyuz/lp_dynamic_dom_updater.js 2009-11-24 09:30:01 +0000
3+++ lib/canonical/launchpad/javascript/soyuz/lp_dynamic_dom_updater.js 2009-11-24 17:00:32 +0000
4@@ -41,17 +41,7 @@
5
6 DomUpdater.ATTRS = {
7 /**
8- * The dom node to which this plugin instance is attached.
9- *
10- * @attribute owner
11- * @type Node
12- */
13- owner: {
14- value: null
15- },
16-
17- /**
18- * The function that updates the owner's dom subtree.
19+ * The function that updates the host's dom subtree.
20 *
21 * @attribute domUpdateFunction
22 * @type Function
23@@ -62,7 +52,7 @@
24 }
25 };
26
27- Y.extend(DomUpdater, Y.Plugin, {
28+ Y.extend(DomUpdater, Y.Plugin.Base, {
29
30 /**
31 * The update method simply passes through to the user provided
32@@ -73,11 +63,11 @@
33 * passed to the users domUpdateFunction.
34 */
35 update: function(update_data) {
36- Y.log("Updating Dom subtree for " + this.get("owner"),
37+ Y.log("Updating Dom subtree for " + this.get("host"),
38 "info", "DomUpdater");
39 var domUpdateFunction = this.get("domUpdateFunction");
40 if (domUpdateFunction !== null){
41- domUpdateFunction(this.get("owner"), update_data);
42+ domUpdateFunction(this.get("host"), update_data);
43 }
44 }
45
46@@ -219,7 +209,7 @@
47 * @protected
48 */
49 initializer: function(){
50- Y.log("Initializing updater for " + this.get("owner") +
51+ Y.log("Initializing updater for " + this.get("host") +
52 " with an interval of " + this.get("interval") + "ms.",
53 "info", "LPDynamicDomUpdater");
54
55@@ -253,15 +243,15 @@
56 * @method dynamicUpdate
57 */
58 dynamicUpdate: function() {
59- Y.log("Starting update for " + this.get("owner"),
60+ Y.log("Starting update for " + this.get("host"),
61 "info", "LP.DynamicDomUpdater");
62 var uri = this.get("uri");
63 var api_method_name = this.get("api_method_name");
64
65 // Check whether we should stop updating now...
66- if (this.get("stopUpdatesCheckFunction")(this.get("owner"))){
67+ if (this.get("stopUpdatesCheckFunction")(this.get("host"))){
68 Y.log(
69- "Cancelling updates for " + this.get("owner") +
70+ "Cancelling updates for " + this.get("host") +
71 "after stopUpdatesCheckFunction returned true.", "info",
72 "LP DynamicDomUpdater");
73 return;
74@@ -272,7 +262,7 @@
75 "parameterEvaluatorFunction");
76 if (parameterEvaluatorFunction !== null){
77 this._lp_api_config.parameters = parameterEvaluatorFunction(
78- this.get("owner"));
79+ this.get("host"));
80 }
81
82 // Finally, call the LP api method as required...
83@@ -301,7 +291,7 @@
84 var elapsed_time = new Date().getTime() - this._request_start;
85 Y.log([
86 "Data received for ",
87- this.get("owner"),
88+ this.get("host"),
89 " after ",
90 elapsed_time,
91 "ms."
92@@ -354,7 +344,7 @@
93 * @private
94 */
95 _handleFailure: function(id, request) {
96- Y.fail("LP.DynamicDomUpdater for " + this.get("owner") +
97+ Y.fail("LP.DynamicDomUpdater for " + this.get("host") +
98 " failed to get dynamic data.");
99 }
100 });
101
102=== modified file 'lib/canonical/launchpad/javascript/soyuz/tests/archivesubscribers_index.js'
103--- lib/canonical/launchpad/javascript/soyuz/tests/archivesubscribers_index.js 2009-11-04 19:59:16 +0000
104+++ lib/canonical/launchpad/javascript/soyuz/tests/archivesubscribers_index.js 2009-11-24 17:00:32 +0000
105@@ -6,7 +6,7 @@
106 filter: 'raw',
107 combine: false
108 }).use(
109- 'yuitest', 'console', 'soyuz.archivesubscribers_index', function(Y) {
110+ 'test', 'console', 'soyuz.archivesubscribers_index', function(Y) {
111
112 var Assert = Y.Assert; // For easy access to isTrue(), etc.
113
114@@ -114,7 +114,7 @@
115 Assert.areEqual(
116 '<a class="js-action sprite add" href="#">Add access</a>',
117 this.add_subscriber_placeholder.get('innerHTML'),
118- "The 'Add access' link should be created during setup.")
119+ "The 'Add access' link should be created during setup.");
120 },
121
122 test_click_add_access_displays_add_row: function() {
123
124=== modified file 'lib/canonical/launchpad/javascript/soyuz/tests/lp_dynamic_dom_updater.js'
125--- lib/canonical/launchpad/javascript/soyuz/tests/lp_dynamic_dom_updater.js 2009-07-17 00:26:05 +0000
126+++ lib/canonical/launchpad/javascript/soyuz/tests/lp_dynamic_dom_updater.js 2009-11-24 17:00:32 +0000
127@@ -5,7 +5,7 @@
128 base: '../../../icing/yui/current/build/',
129 filter: 'raw',
130 combine: false
131- }).use('yuitest', 'console', 'soyuz.dynamic_dom_updater', function(Y) {
132+ }).use('test', 'console', 'soyuz.dynamic_dom_updater', function(Y) {
133
134 var Assert = Y.Assert; // For easy access to isTrue(), etc.
135

Subscribers

People subscribed via source and target branches

to status/vote changes: