Merge "[qunit] Use strict and wrap test scope"

This commit is contained in:
jenkins-bot 2024-12-20 11:23:17 +00:00 committed by Gerrit Code Review
commit 20ede4b0f4
3 changed files with 344 additions and 323 deletions

View file

@ -1,3 +1,6 @@
'use strict';
( function () {
function createStubTitle( fragment = null ) {
return {
getFragment() {
@ -150,7 +153,11 @@ QUnit.test( 'Reference preview gateway rejects non-existing references', functio
return gateway.fetchPreviewForTitle( title, this.$sourceElement[ 0 ] ).then( () => {
assert.true( false, 'It should not resolve' );
} ).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( () => {
assert.true( false, 'It should not resolve' );
} ).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' );
} );
}() );

View file

@ -1,3 +1,6 @@
'use strict';
( function () {
function createStubUserSettings( expectEnabled ) {
return {
isPreviewTypeEnabled() {
@ -52,7 +55,8 @@ QUnit.test( 'relevant combinations of anonymous flags', ( assert ) => {
isNamed: () => !data.isAnon && !data.isIPMasked,
isAnon: () => data.isAnon,
options: {
get: () => {}
get: () => {
}
}
},
isPreviewTypeEnabled = () => {
@ -104,3 +108,4 @@ QUnit.test( 'it should not be enabled when the global is disabling it', ( assert
'Reference Previews is disabled.'
);
} );
}() );

View file

@ -1,3 +1,6 @@
'use strict';
( function () {
let createReferencePreview;
const previewTypes = { TYPE_REFERENCE: 'reference' };
@ -90,3 +93,4 @@ QUnit.test( 'createReferencePreview collapsible/sortable handling', ( assert ) =
'<cite-reference-previews-collapsible-placeholder>'
);
} );
}() );