mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/Cite
synced 2025-01-10 04:24:31 +00:00
Merge "[qunit] Use strict and wrap test scope"
This commit is contained in:
commit
20ede4b0f4
|
@ -1,3 +1,6 @@
|
||||||
|
'use strict';
|
||||||
|
|
||||||
|
( function () {
|
||||||
function createStubTitle( fragment = null ) {
|
function createStubTitle( fragment = null ) {
|
||||||
return {
|
return {
|
||||||
getFragment() {
|
getFragment() {
|
||||||
|
@ -150,7 +153,11 @@ QUnit.test( 'Reference preview gateway rejects non-existing references', functio
|
||||||
return gateway.fetchPreviewForTitle( title, this.$sourceElement[ 0 ] ).then( () => {
|
return gateway.fetchPreviewForTitle( title, this.$sourceElement[ 0 ] ).then( () => {
|
||||||
assert.true( false, 'It should not resolve' );
|
assert.true( false, 'It should not resolve' );
|
||||||
} ).catch( ( result ) => {
|
} ).catch( ( result ) => {
|
||||||
assert.propEqual( result, { textStatus: 'abort', textContext: 'Footnote not found or empty', xhr: { readyState: 0 } } );
|
assert.propEqual( result, {
|
||||||
|
textStatus: 'abort',
|
||||||
|
textContext: 'Footnote not found or empty',
|
||||||
|
xhr: { readyState: 0 }
|
||||||
|
} );
|
||||||
} );
|
} );
|
||||||
} );
|
} );
|
||||||
|
|
||||||
|
@ -161,7 +168,11 @@ QUnit.test( 'Reference preview gateway rejects all-whitespace references', funct
|
||||||
return gateway.fetchPreviewForTitle( title, this.$sourceElement[ 0 ] ).then( () => {
|
return gateway.fetchPreviewForTitle( title, this.$sourceElement[ 0 ] ).then( () => {
|
||||||
assert.true( false, 'It should not resolve' );
|
assert.true( false, 'It should not resolve' );
|
||||||
} ).catch( ( result ) => {
|
} ).catch( ( result ) => {
|
||||||
assert.propEqual( result, { textStatus: 'abort', textContext: 'Footnote not found or empty', xhr: { readyState: 0 } } );
|
assert.propEqual( result, {
|
||||||
|
textStatus: 'abort',
|
||||||
|
textContext: 'Footnote not found or empty',
|
||||||
|
xhr: { readyState: 0 }
|
||||||
|
} );
|
||||||
} );
|
} );
|
||||||
} );
|
} );
|
||||||
|
|
||||||
|
@ -172,3 +183,4 @@ QUnit.test( 'Reference preview gateway is abortable', function ( assert ) {
|
||||||
|
|
||||||
assert.strictEqual( typeof promise.abort, 'function' );
|
assert.strictEqual( typeof promise.abort, 'function' );
|
||||||
} );
|
} );
|
||||||
|
}() );
|
||||||
|
|
|
@ -1,3 +1,6 @@
|
||||||
|
'use strict';
|
||||||
|
|
||||||
|
( function () {
|
||||||
function createStubUserSettings( expectEnabled ) {
|
function createStubUserSettings( expectEnabled ) {
|
||||||
return {
|
return {
|
||||||
isPreviewTypeEnabled() {
|
isPreviewTypeEnabled() {
|
||||||
|
@ -52,7 +55,8 @@ QUnit.test( 'relevant combinations of anonymous flags', ( assert ) => {
|
||||||
isNamed: () => !data.isAnon && !data.isIPMasked,
|
isNamed: () => !data.isAnon && !data.isIPMasked,
|
||||||
isAnon: () => data.isAnon,
|
isAnon: () => data.isAnon,
|
||||||
options: {
|
options: {
|
||||||
get: () => {}
|
get: () => {
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
isPreviewTypeEnabled = () => {
|
isPreviewTypeEnabled = () => {
|
||||||
|
@ -104,3 +108,4 @@ QUnit.test( 'it should not be enabled when the global is disabling it', ( assert
|
||||||
'Reference Previews is disabled.'
|
'Reference Previews is disabled.'
|
||||||
);
|
);
|
||||||
} );
|
} );
|
||||||
|
}() );
|
||||||
|
|
|
@ -1,3 +1,6 @@
|
||||||
|
'use strict';
|
||||||
|
|
||||||
|
( function () {
|
||||||
let createReferencePreview;
|
let createReferencePreview;
|
||||||
const previewTypes = { TYPE_REFERENCE: 'reference' };
|
const previewTypes = { TYPE_REFERENCE: 'reference' };
|
||||||
|
|
||||||
|
@ -90,3 +93,4 @@ QUnit.test( 'createReferencePreview collapsible/sortable handling', ( assert ) =
|
||||||
'<cite-reference-previews-collapsible-placeholder>'
|
'<cite-reference-previews-collapsible-placeholder>'
|
||||||
);
|
);
|
||||||
} );
|
} );
|
||||||
|
}() );
|
||||||
|
|
Loading…
Reference in a new issue