mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/Popups
synced 2024-09-23 18:29:35 +00:00
Hygiene: Lint JS files on tests/node-qunit too
For consistency. Bug: T160406 Change-Id: I2fd67649e9dc4bdb3b963b8ee70ed0234dbcb5ce
This commit is contained in:
parent
841c69ba2e
commit
2516299bd2
|
@ -24,6 +24,7 @@ module.exports = function ( grunt ) {
|
|||
'src/**',
|
||||
'resources/ext.popups/*.js',
|
||||
'resources/ext.popups/**/*.js',
|
||||
'tests/node-qunit/**/*.js',
|
||||
'!resources/dist/index.js',
|
||||
'!docs/**',
|
||||
'!node_modules/**'
|
||||
|
|
|
@ -324,7 +324,7 @@ QUnit.test( 'it should dispatch the FETCH_END action when the API request ends',
|
|||
|
||||
this.gatewayPromise.then( function () {
|
||||
assert.deepEqual(
|
||||
that.dispatch.getCall( 1 ).args[0],
|
||||
that.dispatch.getCall( 1 ).args[ 0 ],
|
||||
{
|
||||
type: 'FETCH_END',
|
||||
el: that.el,
|
||||
|
@ -343,7 +343,7 @@ QUnit.test( 'it should delay dispatching the FETCH_COMPLETE action', function (
|
|||
result = {},
|
||||
that = this,
|
||||
done = assert.async();
|
||||
|
||||
|
||||
whenSpy = this.sandbox.stub( $, 'when' )
|
||||
.returns( whenDeferred.promise() );
|
||||
|
||||
|
@ -360,7 +360,7 @@ QUnit.test( 'it should delay dispatching the FETCH_COMPLETE action', function (
|
|||
|
||||
// This assertion is disabled due to $.Promise#then and #fail returning a new
|
||||
// instance of $.Promise.
|
||||
//assert.strictEqual( args[ 0 ], this.gatewayPromise );
|
||||
// assert.strictEqual( args[ 0 ], this.gatewayPromise );
|
||||
|
||||
assert.strictEqual( args[ 1 ], this.waitPromises[ 0 ] );
|
||||
|
||||
|
|
|
@ -83,4 +83,3 @@ QUnit.test( 'it should not log when no action is given', function ( assert ) {
|
|||
'The statsvLoggged bound action is not called when no action is given.'
|
||||
);
|
||||
} );
|
||||
|
||||
|
|
|
@ -57,40 +57,40 @@ var createModel = require( '../../../src/preview/model' ).createModel,
|
|||
// See https://phabricator.wikimedia.org/T158632#3071104 onward for additional
|
||||
// context.
|
||||
RESTBASE_RESPONSE_WITH_SMALL_IMAGE = {
|
||||
title: "PreviewsNonFreeImage/sandbox",
|
||||
extract: "Hello, I am the non-free image and parenthetical page (YOU CAN'T SEE THIS). My preview should contain an image that is not free. My preview should contain a parenthetical you cannot see..",
|
||||
title: 'PreviewsNonFreeImage/sandbox',
|
||||
extract: 'Hello, I am the non-free image and parenthetical page (YOU CAN\'T SEE THIS). My preview should contain an image that is not free. My preview should contain a parenthetical you cannot see..',
|
||||
thumbnail: {
|
||||
source: "https://upload.wikimedia.org/wikipedia/commons/2/2c/RH-Fedora_logo-nonfree.png",
|
||||
source: 'https://upload.wikimedia.org/wikipedia/commons/2/2c/RH-Fedora_logo-nonfree.png',
|
||||
width: 300,
|
||||
height: 126,
|
||||
original: "https://upload.wikimedia.org/wikipedia/commons/2/2c/RH-Fedora_logo-nonfree.png"
|
||||
original: 'https://upload.wikimedia.org/wikipedia/commons/2/2c/RH-Fedora_logo-nonfree.png'
|
||||
},
|
||||
originalimage: {
|
||||
source: "https://upload.wikimedia.org/wikipedia/commons/2/2c/RH-Fedora_logo-nonfree.png",
|
||||
source: 'https://upload.wikimedia.org/wikipedia/commons/2/2c/RH-Fedora_logo-nonfree.png',
|
||||
width: 300,
|
||||
height: 126
|
||||
},
|
||||
lang: "en",
|
||||
dir: "ltr",
|
||||
timestamp: "2017-02-17T22:29:56Z"
|
||||
lang: 'en',
|
||||
dir: 'ltr',
|
||||
timestamp: '2017-02-17T22:29:56Z'
|
||||
},
|
||||
RESTBASE_RESPONSE_WITH_LANDSCAPE_IMAGE = {
|
||||
title: "Landscape",
|
||||
extract: "Landscape",
|
||||
title: 'Landscape',
|
||||
extract: 'Landscape',
|
||||
thumbnail: {
|
||||
source: "http://foo/bar/baz.png/500px-baz.png",
|
||||
source: 'http://foo/bar/baz.png/500px-baz.png',
|
||||
width: 500,
|
||||
height: 300,
|
||||
original: "http://foo/bar/baz.png"
|
||||
original: 'http://foo/bar/baz.png'
|
||||
},
|
||||
originalimage: {
|
||||
source: "http://foo/bar/baz.png",
|
||||
source: 'http://foo/bar/baz.png',
|
||||
width: 1000,
|
||||
height: 600
|
||||
},
|
||||
lang: "en",
|
||||
dir: "ltr",
|
||||
timestamp: "2017-02-17T22:29:56Z"
|
||||
lang: 'en',
|
||||
dir: 'ltr',
|
||||
timestamp: '2017-02-17T22:29:56Z'
|
||||
},
|
||||
RESTBASE_RESPONSE_PREVIEW_MODEL = createModel(
|
||||
'Barack Obama',
|
||||
|
@ -143,8 +143,7 @@ QUnit.test( 'RESTBase gateway is correctly converting the page data to a model '
|
|||
|
||||
QUnit.test( 'RESTBase gateway doesn\'t stretch thumbnails', function ( assert ) {
|
||||
var model,
|
||||
gateway = createRESTBaseGateway(),
|
||||
response;
|
||||
gateway = createRESTBaseGateway();
|
||||
|
||||
model = gateway.convertPageToModel( RESTBASE_RESPONSE, 2000 );
|
||||
|
||||
|
|
|
@ -14,7 +14,6 @@ function createStubUserSettings( isEnabled ) {
|
|||
};
|
||||
}
|
||||
|
||||
|
||||
QUnit.module( 'ext.popups#isEnabled (logged out)', {
|
||||
setup: function () {
|
||||
this.user = stubs.createStubUser( /* isAnon = */ true );
|
||||
|
@ -31,17 +30,17 @@ QUnit.test( 'is should handle logged out users', function ( assert ) {
|
|||
|
||||
cases = [
|
||||
[ undefined, true, true, 'When the user hasn\'t enabled or disabled' +
|
||||
' the feature and the user is in the sample.' ],
|
||||
' the feature and the user is in the sample.' ],
|
||||
[ undefined, false, false, 'When the user hasn\'t enabled or disabled' +
|
||||
' the feature and the user is not in the sample.' ],
|
||||
' the feature and the user is not in the sample.' ],
|
||||
[ false, true, false, 'When the user has disabled the feature' +
|
||||
' and the user is in the sample.'],
|
||||
' and the user is in the sample.' ],
|
||||
[ false, false, false, 'When the user has disabled the feature' +
|
||||
' and the user is not in the sample.'],
|
||||
' and the user is not in the sample.' ],
|
||||
[ true, true, true, 'When the user has enabled the feature' +
|
||||
' and the user is in the sample.' ],
|
||||
' and the user is in the sample.' ],
|
||||
[ true, false, true, 'When the user has enabled the feature' +
|
||||
' and the user is not in the sample.' ]
|
||||
' and the user is not in the sample.' ]
|
||||
];
|
||||
|
||||
for ( i = 0; i < cases.length; i++ ) {
|
||||
|
|
|
@ -236,7 +236,7 @@ QUnit.test(
|
|||
|
||||
state = eventLogging( state, {
|
||||
type: 'ABANDON_START',
|
||||
timestamp: now + 250,
|
||||
timestamp: now + 250
|
||||
} );
|
||||
|
||||
state = eventLogging( state, {
|
||||
|
@ -365,7 +365,7 @@ QUnit.test( 'FETCH_COMPLETE', function ( assert ) {
|
|||
initialState = {
|
||||
interaction: {
|
||||
token: token
|
||||
},
|
||||
}
|
||||
},
|
||||
state;
|
||||
|
||||
|
@ -421,8 +421,8 @@ QUnit.test( 'FETCH_COMPLETE', function ( assert ) {
|
|||
|
||||
QUnit.test( 'ABANDON_START', function ( assert ) {
|
||||
var state = {
|
||||
interaction: {}
|
||||
};
|
||||
interaction: {}
|
||||
};
|
||||
|
||||
state = eventLogging( state, {
|
||||
type: 'ABANDON_START',
|
||||
|
@ -471,8 +471,8 @@ QUnit.test( 'ABANDON_END', function ( assert ) {
|
|||
|
||||
QUnit.test( 'PREVIEW_DWELL', function ( assert ) {
|
||||
var state = {
|
||||
interaction: {}
|
||||
};
|
||||
interaction: {}
|
||||
};
|
||||
|
||||
state = eventLogging( state, {
|
||||
type: 'PREVIEW_DWELL'
|
||||
|
@ -522,7 +522,7 @@ QUnit.test( 'ABANDON_END should enqueue an event', function ( assert ) {
|
|||
|
||||
state = eventLogging( state, {
|
||||
type: 'ABANDON_END',
|
||||
token: token,
|
||||
token: token
|
||||
} );
|
||||
|
||||
assert.deepEqual(
|
||||
|
@ -557,7 +557,7 @@ QUnit.test( 'ABANDON_END should enqueue an event', function ( assert ) {
|
|||
|
||||
state = eventLogging( state, {
|
||||
type: 'ABANDON_END',
|
||||
token: token,
|
||||
token: token
|
||||
} );
|
||||
|
||||
assert.deepEqual(
|
||||
|
|
|
@ -34,7 +34,7 @@ QUnit.test( 'FETCH_START', function ( assert ) {
|
|||
} );
|
||||
|
||||
QUnit.test( 'FETCH_END', function ( assert ) {
|
||||
var startedAt, endedAt, delay, action, state;
|
||||
var startedAt, endedAt, action, state;
|
||||
|
||||
assert.expect( 1 );
|
||||
|
||||
|
@ -42,7 +42,7 @@ QUnit.test( 'FETCH_END', function ( assert ) {
|
|||
endedAt = 500;
|
||||
action = {
|
||||
type: 'FETCH_END',
|
||||
timestamp: endedAt,
|
||||
timestamp: endedAt
|
||||
};
|
||||
state = statsv( { fetchStartedAt: startedAt }, action );
|
||||
|
||||
|
@ -136,4 +136,3 @@ QUnit.test( 'STATSV_LOGGED', function ( assert ) {
|
|||
}
|
||||
);
|
||||
} );
|
||||
|
||||
|
|
|
@ -9,20 +9,19 @@ QUnit.module( 'ext.popups/statsvInstrumentation', {
|
|||
} );
|
||||
|
||||
QUnit.test( 'isEnabled', function ( assert ) {
|
||||
assert.expect( 2 );
|
||||
var experiments = stubs.createStubExperiments( true );
|
||||
|
||||
var experiments = stubs.createStubExperiments( true ),
|
||||
samplingRate;
|
||||
assert.expect( 2 );
|
||||
|
||||
assert.ok(
|
||||
statsv.isEnabled( this.user, this.config, experiments ),
|
||||
"Logging is enabled when the user is in the sample."
|
||||
'Logging is enabled when the user is in the sample.'
|
||||
);
|
||||
|
||||
experiments = stubs.createStubExperiments( false );
|
||||
|
||||
assert.notOk(
|
||||
statsv.isEnabled( this.user, this.config, experiments ),
|
||||
"Logging is disabled when the user is not in the sample."
|
||||
'Logging is disabled when the user is not in the sample.'
|
||||
);
|
||||
} );
|
||||
|
|
Loading…
Reference in a new issue