mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/Popups
synced 2024-11-23 15:16:50 +00:00
Hygiene: QUnit setup -> beforeEach & teardown -> afterEach
The setup and teardown hooks on QUnit.module are deprecated on the latest versions. See https://api.qunitjs.com/QUnit/module mw-node-qunit supports them but we shouldn't be using them. Bug: T160406 Change-Id: I32c07f22d01d16449a6e37f46ff20c577a1f14c6
This commit is contained in:
parent
2516299bd2
commit
698a93f5bc
|
@ -100,7 +100,7 @@ function setupEl( module ) {
|
|||
}
|
||||
|
||||
QUnit.module( 'ext.popups/actions#linkDwell @integration', {
|
||||
setup: function () {
|
||||
beforeEach: function () {
|
||||
var that = this;
|
||||
|
||||
this.state = {
|
||||
|
@ -116,7 +116,7 @@ QUnit.module( 'ext.popups/actions#linkDwell @integration', {
|
|||
setupWait( this );
|
||||
setupEl( this );
|
||||
},
|
||||
teardown: function () {
|
||||
afterEach: function () {
|
||||
teardownWait();
|
||||
}
|
||||
} );
|
||||
|
@ -264,7 +264,7 @@ QUnit.test( '#linkDwell dispatches the fetch action', function ( assert ) {
|
|||
} );
|
||||
|
||||
QUnit.module( 'ext.popups/actions#fetch', {
|
||||
setup: function () {
|
||||
beforeEach: function () {
|
||||
var that = this;
|
||||
|
||||
// Setup the mw.now stub before actions is re-required in setupWait
|
||||
|
@ -292,7 +292,7 @@ QUnit.module( 'ext.popups/actions#fetch', {
|
|||
actions.fetch( that.gateway, that.el, that.token )( that.dispatch );
|
||||
};
|
||||
},
|
||||
teardown: function () {
|
||||
afterEach: function () {
|
||||
teardownWait();
|
||||
}
|
||||
} );
|
||||
|
@ -392,10 +392,10 @@ QUnit.test( 'it should delay dispatching the FETCH_COMPLETE action', function (
|
|||
} );
|
||||
|
||||
QUnit.module( 'ext.popups/actions#abandon', {
|
||||
setup: function () {
|
||||
beforeEach: function () {
|
||||
setupWait( this );
|
||||
},
|
||||
teardown: function () {
|
||||
afterEach: function () {
|
||||
teardownWait();
|
||||
}
|
||||
} );
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
var eventLogging = require( '../../../src/changeListeners/eventLogging' );
|
||||
|
||||
QUnit.module( 'ext.popups/eventLogging', {
|
||||
setup: function () {
|
||||
beforeEach: function () {
|
||||
this.boundActions = {
|
||||
eventLogged: this.sandbox.spy()
|
||||
};
|
||||
|
|
|
@ -3,7 +3,7 @@ var footerLink = require( '../../../src/changeListeners/footerLink' );
|
|||
// Since footerLink manipulates the DOM, this test is, by necessity, an
|
||||
// integration test.
|
||||
QUnit.module( 'ext.popups/changeListeners/footerLink @integration', {
|
||||
setup: function () {
|
||||
beforeEach: function () {
|
||||
var boundActions = {};
|
||||
|
||||
// Stub internal usage of mw.message
|
||||
|
@ -37,7 +37,7 @@ QUnit.module( 'ext.popups/changeListeners/footerLink @integration', {
|
|||
return this.$footer.find( 'li' );
|
||||
};
|
||||
},
|
||||
teardown: function () {
|
||||
afterEach: function () {
|
||||
this.$footer.remove();
|
||||
}
|
||||
} );
|
||||
|
|
|
@ -3,7 +3,7 @@ var linkTitle = require( '../../../src/changeListeners/linkTitle' );
|
|||
// Since footerLink manipulates the DOM, this test is, by necessity, an
|
||||
// integration test.
|
||||
QUnit.module( 'ext.popups/changeListeners/footerLink @integration', {
|
||||
setup: function () {
|
||||
beforeEach: function () {
|
||||
this.$link = $( '<a>' )
|
||||
.attr( 'title', 'Foo' );
|
||||
|
||||
|
|
|
@ -2,7 +2,7 @@ var mock = require( 'mock-require' ),
|
|||
render;
|
||||
|
||||
QUnit.module( 'ext.popups/changeListeners/render', {
|
||||
setup: function () {
|
||||
beforeEach: function () {
|
||||
this.preview = {
|
||||
show: this.sandbox.stub().returns( $.Deferred().resolve() )
|
||||
};
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
var settings = require( '../../../src/changeListeners/settings' );
|
||||
|
||||
QUnit.module( 'ext.popups/changeListeners/settings', {
|
||||
setup: function () {
|
||||
beforeEach: function () {
|
||||
this.render = this.sandbox.stub();
|
||||
this.rendered = {
|
||||
appendTo: this.sandbox.spy(),
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
var statsv = require( '../../../src/changeListeners/statsv' );
|
||||
|
||||
QUnit.module( 'ext.popups/changeListeners/statsv', {
|
||||
setup: function () {
|
||||
beforeEach: function () {
|
||||
this.boundActions = {
|
||||
statsvLogged: this.sandbox.spy()
|
||||
};
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
var syncUserSettings = require( '../../../src/changeListeners/syncUserSettings' );
|
||||
|
||||
QUnit.module( 'ext.popups/changeListeners/syncUserSettings', {
|
||||
setup: function () {
|
||||
beforeEach: function () {
|
||||
this.userSettings = {
|
||||
setPreviewCount: this.sandbox.spy(),
|
||||
setIsEnabled: this.sandbox.spy()
|
||||
|
|
|
@ -42,7 +42,7 @@ function constant( x ) { return function () { return x; }; }
|
|||
*/
|
||||
|
||||
QUnit.module( 'ext.popups preview @integration', {
|
||||
setup: function () {
|
||||
beforeEach: function () {
|
||||
var that = this,
|
||||
reducers, actions, registerChangeListener;
|
||||
|
||||
|
|
|
@ -15,7 +15,7 @@ function createStubUserSettings( isEnabled ) {
|
|||
}
|
||||
|
||||
QUnit.module( 'ext.popups#isEnabled (logged out)', {
|
||||
setup: function () {
|
||||
beforeEach: function () {
|
||||
this.user = stubs.createStubUser( /* isAnon = */ true );
|
||||
}
|
||||
} );
|
||||
|
|
|
@ -2,7 +2,7 @@ var createPreviewBehavior = require( '../../src/previewBehavior' ),
|
|||
createStubUser = require( './stubs' ).createStubUser;
|
||||
|
||||
QUnit.module( 'ext.popups.preview.settingsBehavior', {
|
||||
setup: function () {
|
||||
beforeEach: function () {
|
||||
function newFromText( title ) {
|
||||
return { getUrl: function () { return 'url/' + title; } };
|
||||
}
|
||||
|
|
|
@ -3,7 +3,7 @@ var counts = require( '../../../src/counts' ),
|
|||
eventLogging = require( '../../../src/reducers/eventLogging' );
|
||||
|
||||
QUnit.module( 'ext.popups/reducers#eventLogging', {
|
||||
setup: function () {
|
||||
beforeEach: function () {
|
||||
this.initialState = eventLogging( undefined, {
|
||||
type: '@@INIT'
|
||||
} );
|
||||
|
@ -148,7 +148,7 @@ QUnit.test( 'PREVIEW_SHOW', function ( assert ) {
|
|||
} );
|
||||
|
||||
QUnit.module( 'ext.popups/reducers#eventLogging @integration', {
|
||||
setUp: function () {
|
||||
beforeEach: function () {
|
||||
this.link = $( '<a>' );
|
||||
}
|
||||
} );
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
var preview = require( '../../../src/reducers/preview' );
|
||||
|
||||
QUnit.module( 'ext.popups/reducers#preview', {
|
||||
setup: function () {
|
||||
beforeEach: function () {
|
||||
this.el = 'active link';
|
||||
}
|
||||
} );
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
var statsv = require( '../../../src/reducers/statsv' );
|
||||
|
||||
QUnit.module( 'ext.popups/reducers#eventLogging', {
|
||||
setup: function () {
|
||||
beforeEach: function () {
|
||||
this.initialState = statsv( undefined, {
|
||||
type: '@@INIT'
|
||||
} );
|
||||
|
|
|
@ -3,7 +3,7 @@ var mw = mediaWiki,
|
|||
createStubMap = require( './stubs' ).createStubMap;
|
||||
|
||||
QUnit.module( 'ext.popups/schema', {
|
||||
setup: function () {
|
||||
beforeEach: function () {
|
||||
this.config = createStubMap();
|
||||
|
||||
this.config.set( 'wgPopupsSchemaSamplingRate', 1 );
|
||||
|
|
|
@ -2,7 +2,7 @@ var stubs = require( './stubs' ),
|
|||
statsv = require( '../../src/statsvInstrumentation' );
|
||||
|
||||
QUnit.module( 'ext.popups/statsvInstrumentation', {
|
||||
setup: function () {
|
||||
beforeEach: function () {
|
||||
this.user = stubs.createStubUser();
|
||||
this.config = stubs.createStubMap();
|
||||
}
|
||||
|
|
|
@ -4,7 +4,7 @@ var stubs = require( './stubs' ),
|
|||
createUserSettings = require( '../../src/userSettings' );
|
||||
|
||||
QUnit.module( 'ext.popups/userSettings', {
|
||||
setup: function () {
|
||||
beforeEach: function () {
|
||||
var stubUser = createStubUser( /* isAnon = */ true );
|
||||
|
||||
this.storage = createStubMap();
|
||||
|
|
Loading…
Reference in a new issue