From cbea4fabd5273554fa65ea9f291ee7051adb2405 Mon Sep 17 00:00:00 2001 From: Stephen Niedzielski Date: Wed, 10 Apr 2019 14:23:58 -0600 Subject: [PATCH] Hygiene: remove unused downloadPageAction argument Remove unused Skin parameter from downloadPageAction. Change-Id: I27cd85b1e4f2328d3d4fd0ece5580c4432181757 --- .../downloadPageAction.js | 10 ++++---- .../downloadPageAction.test.js | 24 ++++--------------- 2 files changed, 9 insertions(+), 25 deletions(-) diff --git a/resources/skins.minerva.scripts/downloadPageAction.js b/resources/skins.minerva.scripts/downloadPageAction.js index c577348..ee57715 100644 --- a/resources/skins.minerva.scripts/downloadPageAction.js +++ b/resources/skins.minerva.scripts/downloadPageAction.js @@ -65,11 +65,10 @@ } /** * onClick handler for button that invokes print function - * @param {Skin} skin * @param {Icon} icon * @param {Icon} spinner */ - function onClick( skin, icon, spinner ) { + function onClick( icon, spinner ) { function doPrint() { icon.timeout = clearTimeout( icon.timeout ); track( 'minerva.downloadAsPDF', { @@ -105,13 +104,12 @@ * Gets a click handler for the download icon * Expects to be run in the context of an icon using `Function.bind` * - * @param {Skin} skin * @param {Icon} spinner * @returns {function} */ - function getOnClickHandler( skin, spinner ) { + function getOnClickHandler( spinner ) { return function () { - onClick( skin, this, spinner ); + onClick( this, spinner ); }; } @@ -140,7 +138,7 @@ tagName: 'button', events: { // will be bound to `this` - click: getOnClickHandler( skin, spinner ) + click: getOnClickHandler( spinner ) } } ); diff --git a/tests/qunit/skins.minerva.scripts/downloadPageAction.test.js b/tests/qunit/skins.minerva.scripts/downloadPageAction.test.js index 34af332..a504be5 100644 --- a/tests/qunit/skins.minerva.scripts/downloadPageAction.test.js +++ b/tests/qunit/skins.minerva.scripts/downloadPageAction.test.js @@ -2,7 +2,6 @@ var VALID_UA = 'Mozilla/5.0 (Linux; Android 5.1.1; Nexus 6 Build/LYZ28E) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/61.0.3163.100 Mobile Safari/537.36', VALID_SUPPORTED_NAMESPACES = [ 0 ], mobile = M.require( 'mobile.startup' ), - Skin = mobile.Skin, icons = mobile.icons, Deferred = $.Deferred, windowChrome = { chrome: true }, @@ -16,20 +15,14 @@ QUnit.module( 'Minerva DownloadIcon', { beforeEach: function () { - this.skin = new Skin( { - eventBus: { - on: function () {}, - off: function () {} - } - } ); - this.getOnClickHandler = function ( skin ) { - return getOnClickHandler( skin, icons.spinner() ).bind( downloadIcon ); + this.getOnClickHandler = function () { + return getOnClickHandler( icons.spinner() ).bind( downloadIcon ); }; } } ); QUnit.test( '#getOnClickHandler (print after image download)', function ( assert ) { - var handler = this.getOnClickHandler( this.skin ), + var handler = this.getOnClickHandler(), d = Deferred(), spy = this.sandbox.stub( window, 'print' ); @@ -45,7 +38,7 @@ } ); QUnit.test( '#getOnClickHandler (print via timeout)', function ( assert ) { - var handler = this.getOnClickHandler( this.skin ), + var handler = this.getOnClickHandler(), d = Deferred(), spy = this.sandbox.stub( window, 'print' ); @@ -66,7 +59,7 @@ } ); QUnit.test( '#getOnClickHandler (multiple clicks)', function ( assert ) { - var handler = this.getOnClickHandler( this.skin ), + var handler = this.getOnClickHandler(), d = Deferred(), spy = this.sandbox.stub( window, 'print' ); @@ -95,13 +88,6 @@ isMainPage: false } ); this.page = page; - this.skin = new Skin( { - eventBus: { - on: function () {}, - off: function () {} - }, - page: page - } ); this.isAvailable = function ( ua ) { return isAvailable( windowChrome, page, ua, VALID_SUPPORTED_NAMESPACES );