Hygiene: remove unused downloadPageAction argument

Remove unused Skin parameter from downloadPageAction.

Change-Id: I27cd85b1e4f2328d3d4fd0ece5580c4432181757
This commit is contained in:
Stephen Niedzielski 2019-04-10 14:23:58 -06:00
parent effda33eab
commit cbea4fabd5
2 changed files with 9 additions and 25 deletions

View File

@ -65,11 +65,10 @@
} }
/** /**
* onClick handler for button that invokes print function * onClick handler for button that invokes print function
* @param {Skin} skin
* @param {Icon} icon * @param {Icon} icon
* @param {Icon} spinner * @param {Icon} spinner
*/ */
function onClick( skin, icon, spinner ) { function onClick( icon, spinner ) {
function doPrint() { function doPrint() {
icon.timeout = clearTimeout( icon.timeout ); icon.timeout = clearTimeout( icon.timeout );
track( 'minerva.downloadAsPDF', { track( 'minerva.downloadAsPDF', {
@ -105,13 +104,12 @@
* Gets a click handler for the download icon * Gets a click handler for the download icon
* Expects to be run in the context of an icon using `Function.bind` * Expects to be run in the context of an icon using `Function.bind`
* *
* @param {Skin} skin
* @param {Icon} spinner * @param {Icon} spinner
* @returns {function} * @returns {function}
*/ */
function getOnClickHandler( skin, spinner ) { function getOnClickHandler( spinner ) {
return function () { return function () {
onClick( skin, this, spinner ); onClick( this, spinner );
}; };
} }
@ -140,7 +138,7 @@
tagName: 'button', tagName: 'button',
events: { events: {
// will be bound to `this` // will be bound to `this`
click: getOnClickHandler( skin, spinner ) click: getOnClickHandler( spinner )
} }
} ); } );

View File

@ -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', 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 ], VALID_SUPPORTED_NAMESPACES = [ 0 ],
mobile = M.require( 'mobile.startup' ), mobile = M.require( 'mobile.startup' ),
Skin = mobile.Skin,
icons = mobile.icons, icons = mobile.icons,
Deferred = $.Deferred, Deferred = $.Deferred,
windowChrome = { chrome: true }, windowChrome = { chrome: true },
@ -16,20 +15,14 @@
QUnit.module( 'Minerva DownloadIcon', { QUnit.module( 'Minerva DownloadIcon', {
beforeEach: function () { beforeEach: function () {
this.skin = new Skin( { this.getOnClickHandler = function () {
eventBus: { return getOnClickHandler( icons.spinner() ).bind( downloadIcon );
on: function () {},
off: function () {}
}
} );
this.getOnClickHandler = function ( skin ) {
return getOnClickHandler( skin, icons.spinner() ).bind( downloadIcon );
}; };
} }
} ); } );
QUnit.test( '#getOnClickHandler (print after image download)', function ( assert ) { QUnit.test( '#getOnClickHandler (print after image download)', function ( assert ) {
var handler = this.getOnClickHandler( this.skin ), var handler = this.getOnClickHandler(),
d = Deferred(), d = Deferred(),
spy = this.sandbox.stub( window, 'print' ); spy = this.sandbox.stub( window, 'print' );
@ -45,7 +38,7 @@
} ); } );
QUnit.test( '#getOnClickHandler (print via timeout)', function ( assert ) { QUnit.test( '#getOnClickHandler (print via timeout)', function ( assert ) {
var handler = this.getOnClickHandler( this.skin ), var handler = this.getOnClickHandler(),
d = Deferred(), d = Deferred(),
spy = this.sandbox.stub( window, 'print' ); spy = this.sandbox.stub( window, 'print' );
@ -66,7 +59,7 @@
} ); } );
QUnit.test( '#getOnClickHandler (multiple clicks)', function ( assert ) { QUnit.test( '#getOnClickHandler (multiple clicks)', function ( assert ) {
var handler = this.getOnClickHandler( this.skin ), var handler = this.getOnClickHandler(),
d = Deferred(), d = Deferred(),
spy = this.sandbox.stub( window, 'print' ); spy = this.sandbox.stub( window, 'print' );
@ -95,13 +88,6 @@
isMainPage: false isMainPage: false
} ); } );
this.page = page; this.page = page;
this.skin = new Skin( {
eventBus: {
on: function () {},
off: function () {}
},
page: page
} );
this.isAvailable = function ( ua ) { this.isAvailable = function ( ua ) {
return isAvailable( windowChrome, page, ua, return isAvailable( windowChrome, page, ua,
VALID_SUPPORTED_NAMESPACES ); VALID_SUPPORTED_NAMESPACES );