← Back to team overview

launchpad-reviewers team mailing list archive

[Merge] ~cjwatson/launchpad:eslint-cleanup-unused-vars into launchpad:master

 

Colin Watson has proposed merging ~cjwatson/launchpad:eslint-cleanup-unused-vars into launchpad:master.

Commit message:
Fix/disable several no-unused-vars errors from eslint

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)

For more details, see:
https://code.launchpad.net/~cjwatson/launchpad/+git/launchpad/+merge/406049
-- 
Your team Launchpad code reviewers is requested to review the proposed merge of ~cjwatson/launchpad:eslint-cleanup-unused-vars into launchpad:master.
diff --git a/lib/lp/app/javascript/lp-links.js b/lib/lp/app/javascript/lp-links.js
index 2c625fd..60b49de 100644
--- a/lib/lp/app/javascript/lp-links.js
+++ b/lib/lp/app/javascript/lp-links.js
@@ -53,7 +53,7 @@ YUI.add('lp.app.links', function(Y) {
         });
     }
 
-    Y.lp.app.links.check_valid_lp_links = function(io_provider) {
+    namespace.check_valid_lp_links = function(io_provider) {
         // Grabs any lp: style links on the page and checks that they are
         // valid. Invalid ones have their class changed to "invalid-link".
         // ATM, we only handle +code and bug links.
diff --git a/lib/lp/app/javascript/overlay/tests/test_overlay.js b/lib/lp/app/javascript/overlay/tests/test_overlay.js
index 99aed19..fb9970e 100644
--- a/lib/lp/app/javascript/overlay/tests/test_overlay.js
+++ b/lib/lp/app/javascript/overlay/tests/test_overlay.js
@@ -333,7 +333,7 @@ YUI.add('lp.overlay.test', function (Y) {
                 halt: function() {halted = true;}
             };
             this.overlay._handleTab(fake_e);
-            Y.Assert.isFalse(halted);
+            Y.Assert.isFalse(focused);
             Y.Assert.isFalse(halted);
         }
     }));
diff --git a/lib/lp/app/javascript/testing/testrunner.js b/lib/lp/app/javascript/testing/testrunner.js
index 29e1368..27a61c8 100644
--- a/lib/lp/app/javascript/testing/testrunner.js
+++ b/lib/lp/app/javascript/testing/testrunner.js
@@ -1,6 +1,7 @@
 /* Copyright 2011 Canonical Ltd.  This software is licensed under the
  * GNU Affero General Public License version 3 (see the file LICENSE). */
 
+// eslint-disable-next-line no-unused-vars
 var YUI_config = {
     filter: 'raw',
     combine: false,
diff --git a/lib/lp/bugs/javascript/tests/test_filebug.js b/lib/lp/bugs/javascript/tests/test_filebug.js
index d6e274f..4b25894 100644
--- a/lib/lp/bugs/javascript/tests/test_filebug.js
+++ b/lib/lp/bugs/javascript/tests/test_filebug.js
@@ -141,6 +141,7 @@ YUI.add('lp.bugs.filebug.test', function (Y) {
             // The second one will fire ISPUBLIC and the banner disappears.
             Y.one('[id="field.information_type.0"]').simulate('click');
             Y.Assert.isTrue(fired);
+            ev.detach();
         },
 
         // When non bug supervisors select a security related bug the privacy
@@ -178,6 +179,7 @@ YUI.add('lp.bugs.filebug.test', function (Y) {
 
             Y.one('[id="field.security_related"]').simulate('click');
             Y.Assert.isTrue(fired);
+            ev.detach();
         },
 
         // When non bug supervisors unselect a security related bug the privacy
@@ -186,11 +188,11 @@ YUI.add('lp.bugs.filebug.test', function (Y) {
             window.LP.cache.bug_private_by_default = true;
             var public = 0;
             var private = 0;
-            var ev = Y.on(info_type.EV_ISPUBLIC, function (ev) {
+            var ev_public = Y.on(info_type.EV_ISPUBLIC, function (ev) {
                 public = public + 1;
             });
 
-            var ev = Y.on(info_type.EV_ISPRIVATE, function (ev) {
+            var ev_private = Y.on(info_type.EV_ISPRIVATE, function (ev) {
                 private = private + 1;
             });
 
@@ -206,6 +208,8 @@ YUI.add('lp.bugs.filebug.test', function (Y) {
             Y.Assert.areEqual(
                 3, private,
                 "It also fires an ISPRIVATE since that's the default state.");
+            ev_private.detach();
+            ev_public.detach();
         },
 
         // The dupe finder functionality is setup.
@@ -370,6 +374,7 @@ YUI.add('lp.bugs.filebug.test', function (Y) {
             information_type_choice.simulate('click');
 
             Y.Assert.isTrue(fired);
+            ev.detach();
         }
     }));
 
diff --git a/lib/lp/registry/javascript/tests/test_distroseriesdifferences_details.js b/lib/lp/registry/javascript/tests/test_distroseriesdifferences_details.js
index c9b6466..7f72f19 100644
--- a/lib/lp/registry/javascript/tests/test_distroseriesdifferences_details.js
+++ b/lib/lp/registry/javascript/tests/test_distroseriesdifferences_details.js
@@ -597,7 +597,9 @@ YUI.add('lp.registry.distroseriesdifferences_details.test', function (Y) {
             };
             this.widget.on('slid_out', listener);
             this.widget.slide_out();
-            this.wait(1000);
+            this.wait(function () {
+                Y.Assert.isTrue(fired);
+            }, 1000);
         },
 
         assertIsLocked: function() {
@@ -639,7 +641,9 @@ YUI.add('lp.registry.distroseriesdifferences_details.test', function (Y) {
             };
             this.widget.on('slid_out', listener);
             input.simulate('click');
-            this.wait();
+            this.wait(function () {
+                Y.Assert.isTrue(fired);
+            });
         },
 
         test_wire_comment_added_calls_display_new_comment: function() {
diff --git a/lib/lp/registry/javascript/tests/test_structural_subscription.js b/lib/lp/registry/javascript/tests/test_structural_subscription.js
index 1cf1f70..af4433c 100644
--- a/lib/lp/registry/javascript/tests/test_structural_subscription.js
+++ b/lib/lp/registry/javascript/tests/test_structural_subscription.js
@@ -1512,8 +1512,7 @@ YUI.add('lp.structural_subscription.test', function (Y) {
                 1, subs_list.all('div.subscription-filter').size());
             var target_node = subs_list.one('#subscription-0>span>span');
             Assert.areEqual(
-                'Subscriptions to MY TARGET',
-                subs_list.one('#subscription-0>span>span').get('text'));
+                'Subscriptions to MY TARGET', target_node.get('text'));
             var filter_node = subs_list.one('#subscription-filter-0');
             Assert.areEqual(
                 'Your subscription: "Filter name"',
diff --git a/lib/lp/registry/javascript/tests/timeline.js b/lib/lp/registry/javascript/tests/timeline.js
index c06074e..79860e2 100644
--- a/lib/lp/registry/javascript/tests/timeline.js
+++ b/lib/lp/registry/javascript/tests/timeline.js
@@ -43,6 +43,8 @@ var MEDIUM_CONFIG = {
     ]
 };
 
+// Used by disabled test: bug=794597
+// eslint-disable-next-line no-unused-vars
 var RESIZING_CONFIG = {
     timeline: [
         {name: '1', landmarks: [], is_development_focus: true},
@@ -72,6 +74,8 @@ var RESIZING_CONFIG = {
  * A wrapper for the Y.Event.simulate() function.  The wrapper accepts
  * CSS selectors and Node instances instead of raw nodes.
  */
+// Used by disabled test: bug=794597
+// eslint-disable-next-line no-unused-vars
 function simulate(widget, selector, evtype, options) {
     var bounding_box = widget.get('boundingBox');
     var rawnode = Y.Node.getDOMNode(bounding_box.one(selector));
@@ -114,7 +118,7 @@ suite.add(new Y.Test.Case({
 
         var zoom_out = this.content_box.one('a.yui3-timelinegraph-zoom-out');
         Assert.isNotNull(
-            zoom_in,
+            zoom_out,
             'zoom_out link not found.');
     },