[qunit] Use strict and wrap test scope

Wrapping the test mainly to avoid that declared vars or functions
bleed into other tests.

Includes lint auto-fixes

Change-Id: Ia4577f7496ddecf4985525de674ade46f53e03a6
This commit is contained in:
WMDE-Fisch 2024-12-19 18:30:11 +01:00
parent 589e77cbfc
commit 8f0ae21eca
3 changed files with 344 additions and 323 deletions

View file

@ -1,174 +1,186 @@
function createStubTitle( fragment = null ) { 'use strict';
return {
getFragment() {
return fragment;
}
};
}
( mw.loader.getModuleNames().indexOf( 'ext.popups.main' ) !== -1 ? ( function () {
QUnit.module : function createStubTitle( fragment = null ) {
QUnit.module.skip )( 'ext.cite.referencePreviews#createReferenceGateway', { return {
beforeEach: function () { getFragment() {
this.sandbox.stub( mw, 'msg', ( key ) => `<${ key }>` ); return fragment;
this.sandbox.stub( mw, 'message', ( key ) => ( { }
exists: () => !key.endsWith( 'generic' ), };
text: () => `<${ key }>`
} ) );
this.$sourceElement = $( '<a>' ).appendTo(
$( '<sup>' ).attr( 'id', 'cite_ref-1' ).appendTo( document.body )
);
this.$references = $( '<ul>' ).append(
$( '<li>' ).attr( 'id', 'cite_note-1' ).append(
$( '<span>' ).addClass( 'mw-reference-text' ).text( 'Footnote 1' )
),
$( '<li>' ).attr( 'id', 'cite_note-2' ).append(
$( '<span>' ).addClass( 'reference-text' ).append(
$( '<cite>' ).addClass( 'journal web unknown' ).text( 'Footnote 2' )
)
),
$( '<li>' ).attr( 'id', 'cite_note-3' ).append(
$( '<span>' ).addClass( 'reference-text' ).append(
$( '<cite>' ).addClass( 'news' ).text( 'Footnote 3' ),
$( '<cite>' ).addClass( 'news citation' ),
$( '<cite>' ).addClass( 'citation' )
)
),
$( '<li>' ).attr( 'id', 'cite_note-4' ).append(
$( '<span>' ).addClass( 'reference-text' ).append(
$( '<cite>' ).addClass( 'news' ).text( 'Footnote 4' ),
$( '<cite>' ).addClass( 'web' )
)
),
$( '<li>' ).attr( 'id', 'cite_note-5' ).append(
$( '<span>' ).addClass( 'mw-reference-text' ).html( '&nbsp;' )
)
).appendTo( document.body );
},
afterEach() {
this.$sourceElement.parent().remove();
this.$references.remove();
} }
} );
QUnit.test( 'Reference preview gateway returns the correct data', function ( assert ) { ( mw.loader.getModuleNames().indexOf( 'ext.popups.main' ) !== -1 ?
const gateway = require( 'ext.cite.referencePreviews' ).private.createReferenceGateway(), QUnit.module :
title = createStubTitle( 'cite note-1' ); QUnit.module.skip )( 'ext.cite.referencePreviews#createReferenceGateway', {
beforeEach: function () {
this.sandbox.stub( mw, 'msg', ( key ) => `<${ key }>` );
this.sandbox.stub( mw, 'message', ( key ) => ( {
exists: () => !key.endsWith( 'generic' ),
text: () => `<${ key }>`
} ) );
return gateway.fetchPreviewForTitle( title, this.$sourceElement[ 0 ] ).then( ( result ) => { this.$sourceElement = $( '<a>' ).appendTo(
assert.propEqual( $( '<sup>' ).attr( 'id', 'cite_ref-1' ).appendTo( document.body )
result, );
{
url: '#cite_note-1', this.$references = $( '<ul>' ).append(
extract: 'Footnote 1', $( '<li>' ).attr( 'id', 'cite_note-1' ).append(
type: 'reference', $( '<span>' ).addClass( 'mw-reference-text' ).text( 'Footnote 1' )
referenceType: null, ),
sourceElementId: 'cite_ref-1' $( '<li>' ).attr( 'id', 'cite_note-2' ).append(
} $( '<span>' ).addClass( 'reference-text' ).append(
); $( '<cite>' ).addClass( 'journal web unknown' ).text( 'Footnote 2' )
)
),
$( '<li>' ).attr( 'id', 'cite_note-3' ).append(
$( '<span>' ).addClass( 'reference-text' ).append(
$( '<cite>' ).addClass( 'news' ).text( 'Footnote 3' ),
$( '<cite>' ).addClass( 'news citation' ),
$( '<cite>' ).addClass( 'citation' )
)
),
$( '<li>' ).attr( 'id', 'cite_note-4' ).append(
$( '<span>' ).addClass( 'reference-text' ).append(
$( '<cite>' ).addClass( 'news' ).text( 'Footnote 4' ),
$( '<cite>' ).addClass( 'web' )
)
),
$( '<li>' ).attr( 'id', 'cite_note-5' ).append(
$( '<span>' ).addClass( 'mw-reference-text' ).html( '&nbsp;' )
)
).appendTo( document.body );
},
afterEach() {
this.$sourceElement.parent().remove();
this.$references.remove();
}
} ); } );
} );
QUnit.test( 'Reference preview gateway accepts alternative text node class name', function ( assert ) { QUnit.test( 'Reference preview gateway returns the correct data', function ( assert ) {
const gateway = require( 'ext.cite.referencePreviews' ).private.createReferenceGateway(), const gateway = require( 'ext.cite.referencePreviews' ).private.createReferenceGateway(),
title = createStubTitle( 'cite note-2' ); title = createStubTitle( 'cite note-1' );
return gateway.fetchPreviewForTitle( title, this.$sourceElement[ 0 ] ).then( ( result ) => { return gateway.fetchPreviewForTitle( title, this.$sourceElement[ 0 ] ).then( ( result ) => {
assert.propEqual( assert.propEqual(
result, result,
{ {
url: '#cite_note-2', url: '#cite_note-1',
extract: '<cite class="journal web unknown">Footnote 2</cite>', extract: 'Footnote 1',
type: 'reference', type: 'reference',
referenceType: 'web', referenceType: null,
sourceElementId: 'cite_ref-1' sourceElementId: 'cite_ref-1'
} }
); );
} );
} ); } );
} );
QUnit.test( 'Reference preview gateway accepts duplicated types', function ( assert ) { QUnit.test( 'Reference preview gateway accepts alternative text node class name', function ( assert ) {
const gateway = require( 'ext.cite.referencePreviews' ).private.createReferenceGateway(), const gateway = require( 'ext.cite.referencePreviews' ).private.createReferenceGateway(),
title = createStubTitle( 'cite note-3' ); title = createStubTitle( 'cite note-2' );
return gateway.fetchPreviewForTitle( title, this.$sourceElement[ 0 ] ).then( ( result ) => { return gateway.fetchPreviewForTitle( title, this.$sourceElement[ 0 ] ).then( ( result ) => {
assert.propEqual( assert.propEqual(
result, result,
{ {
url: '#cite_note-3', url: '#cite_note-2',
extract: '<cite class="news">Footnote 3</cite><cite class="news citation"></cite><cite class="citation"></cite>', extract: '<cite class="journal web unknown">Footnote 2</cite>',
type: 'reference', type: 'reference',
referenceType: 'news', referenceType: 'web',
sourceElementId: 'cite_ref-1' sourceElementId: 'cite_ref-1'
} }
); );
} );
} ); } );
} );
QUnit.test( 'Reference preview gateway ignores conflicting types', function ( assert ) { QUnit.test( 'Reference preview gateway accepts duplicated types', function ( assert ) {
const gateway = require( 'ext.cite.referencePreviews' ).private.createReferenceGateway(), const gateway = require( 'ext.cite.referencePreviews' ).private.createReferenceGateway(),
title = createStubTitle( 'cite note-4' ); title = createStubTitle( 'cite note-3' );
return gateway.fetchPreviewForTitle( title, this.$sourceElement[ 0 ] ).then( ( result ) => { return gateway.fetchPreviewForTitle( title, this.$sourceElement[ 0 ] ).then( ( result ) => {
assert.propEqual( assert.propEqual(
result, result,
{ {
url: '#cite_note-4', url: '#cite_note-3',
extract: '<cite class="news">Footnote 4</cite><cite class="web"></cite>', extract: '<cite class="news">Footnote 3</cite><cite class="news citation"></cite><cite class="citation"></cite>',
type: 'reference', type: 'reference',
referenceType: 'news', referenceType: 'news',
sourceElementId: 'cite_ref-1' sourceElementId: 'cite_ref-1'
} }
); );
} );
} ); } );
} );
QUnit.test( 'Reference preview gateway returns source element id', function ( assert ) { QUnit.test( 'Reference preview gateway ignores conflicting types', function ( assert ) {
const gateway = require( 'ext.cite.referencePreviews' ).private.createReferenceGateway(), const gateway = require( 'ext.cite.referencePreviews' ).private.createReferenceGateway(),
title = createStubTitle( 'cite note-1' ); title = createStubTitle( 'cite note-4' );
return gateway.fetchPreviewForTitle( title, this.$sourceElement[ 0 ] ).then( ( result ) => { return gateway.fetchPreviewForTitle( title, this.$sourceElement[ 0 ] ).then( ( result ) => {
assert.propEqual( assert.propEqual(
result, result,
{ {
url: '#cite_note-1', url: '#cite_note-4',
extract: 'Footnote 1', extract: '<cite class="news">Footnote 4</cite><cite class="web"></cite>',
type: 'reference', type: 'reference',
referenceType: null, referenceType: 'news',
sourceElementId: 'cite_ref-1' sourceElementId: 'cite_ref-1'
} }
); );
} );
} ); } );
} );
QUnit.test( 'Reference preview gateway rejects non-existing references', function ( assert ) { QUnit.test( 'Reference preview gateway returns source element id', function ( assert ) {
const gateway = require( 'ext.cite.referencePreviews' ).private.createReferenceGateway(), const gateway = require( 'ext.cite.referencePreviews' ).private.createReferenceGateway(),
title = createStubTitle( 'undefined' ); title = createStubTitle( 'cite note-1' );
return gateway.fetchPreviewForTitle( title, this.$sourceElement[ 0 ] ).then( () => { return gateway.fetchPreviewForTitle( title, this.$sourceElement[ 0 ] ).then( ( result ) => {
assert.true( false, 'It should not resolve' ); assert.propEqual(
} ).catch( ( result ) => { result,
assert.propEqual( result, { textStatus: 'abort', textContext: 'Footnote not found or empty', xhr: { readyState: 0 } } ); {
url: '#cite_note-1',
extract: 'Footnote 1',
type: 'reference',
referenceType: null,
sourceElementId: 'cite_ref-1'
}
);
} );
} ); } );
} );
QUnit.test( 'Reference preview gateway rejects all-whitespace references', function ( assert ) { QUnit.test( 'Reference preview gateway rejects non-existing references', function ( assert ) {
const gateway = require( 'ext.cite.referencePreviews' ).private.createReferenceGateway(), const gateway = require( 'ext.cite.referencePreviews' ).private.createReferenceGateway(),
title = createStubTitle( 'cite note-5' ); title = createStubTitle( 'undefined' );
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 }
} );
} );
} ); } );
} );
QUnit.test( 'Reference preview gateway is abortable', function ( assert ) { QUnit.test( 'Reference preview gateway rejects all-whitespace references', function ( assert ) {
const gateway = require( 'ext.cite.referencePreviews' ).private.createReferenceGateway(), const gateway = require( 'ext.cite.referencePreviews' ).private.createReferenceGateway(),
title = createStubTitle( 'cite note-1' ), title = createStubTitle( 'cite note-5' );
promise = gateway.fetchPreviewForTitle( title, this.$sourceElement[ 0 ] );
assert.strictEqual( typeof promise.abort, 'function' ); 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 }
} );
} );
} );
QUnit.test( 'Reference preview gateway is abortable', function ( assert ) {
const gateway = require( 'ext.cite.referencePreviews' ).private.createReferenceGateway(),
title = createStubTitle( 'cite note-1' ),
promise = gateway.fetchPreviewForTitle( title, this.$sourceElement[ 0 ] );
assert.strictEqual( typeof promise.abort, 'function' );
} );
}() );

View file

@ -1,106 +1,111 @@
function createStubUserSettings( expectEnabled ) { 'use strict';
return {
isPreviewTypeEnabled() {
return expectEnabled !== false;
}
};
}
function createStubUser( isAnon, options ) { ( function () {
return { function createStubUserSettings( expectEnabled ) {
isNamed() { return {
return !isAnon; isPreviewTypeEnabled() {
}, return expectEnabled !== false;
isAnon() { }
return isAnon; };
}, }
options
};
}
const options = { get: () => '1' }; function createStubUser( isAnon, options ) {
return {
( mw.loader.getModuleNames().indexOf( 'ext.popups.main' ) !== -1 ? isNamed() {
QUnit.module : return !isAnon;
QUnit.module.skip )( 'ext.cite.referencePreviews#isReferencePreviewsEnabled' );
QUnit.test( 'relevant combinations of anonymous flags', ( assert ) => {
[
{
testCase: 'enabled for an anonymous user',
wgCiteReferencePreviewsActive: true,
isAnon: true,
enabledByAnon: true,
expected: true
},
{
testCase: 'turned off via the feature flag (anonymous user)',
wgCiteReferencePreviewsActive: false,
isAnon: true,
enabledByAnon: true,
expected: null
},
{
testCase: 'manually disabled by the anonymous user',
wgCiteReferencePreviewsActive: true,
isAnon: true,
enabledByAnon: false,
expected: false
}
].forEach( ( data ) => {
const user = {
isNamed: () => !data.isAnon && !data.isIPMasked,
isAnon: () => data.isAnon,
options: {
get: () => {}
}
}, },
isPreviewTypeEnabled = () => { isAnon() {
if ( !data.isAnon ) { return isAnon;
assert.true( false, 'not expected to be called' );
}
return data.enabledByAnon;
}, },
options
};
}
const options = { get: () => '1' };
( mw.loader.getModuleNames().indexOf( 'ext.popups.main' ) !== -1 ?
QUnit.module :
QUnit.module.skip )( 'ext.cite.referencePreviews#isReferencePreviewsEnabled' );
QUnit.test( 'relevant combinations of anonymous flags', ( assert ) => {
[
{
testCase: 'enabled for an anonymous user',
wgCiteReferencePreviewsActive: true,
isAnon: true,
enabledByAnon: true,
expected: true
},
{
testCase: 'turned off via the feature flag (anonymous user)',
wgCiteReferencePreviewsActive: false,
isAnon: true,
enabledByAnon: true,
expected: null
},
{
testCase: 'manually disabled by the anonymous user',
wgCiteReferencePreviewsActive: true,
isAnon: true,
enabledByAnon: false,
expected: false
}
].forEach( ( data ) => {
const user = {
isNamed: () => !data.isAnon && !data.isIPMasked,
isAnon: () => data.isAnon,
options: {
get: () => {
}
}
},
isPreviewTypeEnabled = () => {
if ( !data.isAnon ) {
assert.true( false, 'not expected to be called' );
}
return data.enabledByAnon;
},
config = new Map();
config.set( 'wgCiteReferencePreviewsActive', data.wgCiteReferencePreviewsActive );
if ( data.isAnon ) {
user.options.get = () => assert.true( false, 'not expected to be called 2' );
} else {
user.options.get = () => data.enabledByRegistered ? '1' : '0';
}
assert.strictEqual(
require( 'ext.cite.referencePreviews' ).private.isReferencePreviewsEnabled( user, isPreviewTypeEnabled, config ),
data.expected,
data.testCase
);
} );
} );
QUnit.test( 'it should display reference previews when conditions are fulfilled', ( assert ) => {
const user = createStubUser( false, options ),
userSettings = createStubUserSettings( false ),
config = new Map(); config = new Map();
config.set( 'wgCiteReferencePreviewsActive', data.wgCiteReferencePreviewsActive );
if ( data.isAnon ) { config.set( 'wgCiteReferencePreviewsActive', true );
user.options.get = () => assert.true( false, 'not expected to be called 2' );
} else {
user.options.get = () => data.enabledByRegistered ? '1' : '0';
}
assert.strictEqual( assert.true(
require( 'ext.cite.referencePreviews' ).private.isReferencePreviewsEnabled( user, isPreviewTypeEnabled, config ), require( 'ext.cite.referencePreviews' ).private.isReferencePreviewsEnabled( user, userSettings, config ),
data.expected, 'If the user is logged in and the user is in the on group, then it\'s enabled.'
data.testCase
); );
} ); } );
} );
QUnit.test( 'it should display reference previews when conditions are fulfilled', ( assert ) => { QUnit.test( 'it should not be enabled when the global is disabling it', ( assert ) => {
const user = createStubUser( false, options ), const user = createStubUser( false ),
userSettings = createStubUserSettings( false ), userSettings = createStubUserSettings( false ),
config = new Map(); config = new Map();
config.set( 'wgCiteReferencePreviewsActive', true ); config.set( 'wgCiteReferencePreviewsActive', false );
assert.true( assert.strictEqual(
require( 'ext.cite.referencePreviews' ).private.isReferencePreviewsEnabled( user, userSettings, config ), require( 'ext.cite.referencePreviews' ).private.isReferencePreviewsEnabled( user, userSettings, config ),
'If the user is logged in and the user is in the on group, then it\'s enabled.' null,
); 'Reference Previews is disabled.'
} ); );
} );
QUnit.test( 'it should not be enabled when the global is disabling it', ( assert ) => { }() );
const user = createStubUser( false ),
userSettings = createStubUserSettings( false ),
config = new Map();
config.set( 'wgCiteReferencePreviewsActive', false );
assert.strictEqual(
require( 'ext.cite.referencePreviews' ).private.isReferencePreviewsEnabled( user, userSettings, config ),
null,
'Reference Previews is disabled.'
);
} );

View file

@ -1,92 +1,96 @@
let createReferencePreview; 'use strict';
const previewTypes = { TYPE_REFERENCE: 'reference' };
( mw.loader.getModuleNames().indexOf( 'ext.popups.main' ) !== -1 ? ( function () {
QUnit.module : let createReferencePreview;
QUnit.module.skip )( 'ext.cite.referencePreviews#renderer', { const previewTypes = { TYPE_REFERENCE: 'reference' };
before() {
createReferencePreview = require( 'ext.cite.referencePreviews' ).private.createReferencePreview;
},
beforeEach: function () {
this.sandbox.stub( mw, 'msg', ( key ) => `<${ key }>` );
this.sandbox.stub( mw, 'message', ( key ) => ( {
exists: () => !key.endsWith( 'generic' ),
text: () => `<${ key }>`
} ) );
this.sandbox.stub( mw.html, 'escape', ( str ) => str && str.replace( /'/g, '&apos;' ).replace( /</g, '&lt;' ) );
}
} );
QUnit.test( 'createReferencePreview(model)', ( assert ) => { ( mw.loader.getModuleNames().indexOf( 'ext.popups.main' ) !== -1 ?
const model = { QUnit.module :
url: '#custom_id', QUnit.module.skip )( 'ext.cite.referencePreviews#renderer', {
extract: 'Custom <i>extract</i> with an <a href="/wiki/Internal">internal</a> and an <a href="//wikipedia.de" class="external">external</a> link', before() {
type: previewTypes.TYPE_REFERENCE, createReferencePreview = require( 'ext.cite.referencePreviews' ).private.createReferencePreview;
referenceType: 'web'
}, },
preview = createReferencePreview( model ); beforeEach: function () {
this.sandbox.stub( mw, 'msg', ( key ) => `<${ key }>` );
this.sandbox.stub( mw, 'message', ( key ) => ( {
exists: () => !key.endsWith( 'generic' ),
text: () => `<${ key }>`
} ) );
this.sandbox.stub( mw.html, 'escape', ( str ) => str && str.replace( /'/g, '&apos;' ).replace( /</g, '&lt;' ) );
}
} );
assert.strictEqual( preview.hasThumbnail, false ); QUnit.test( 'createReferencePreview(model)', ( assert ) => {
assert.strictEqual( preview.isTall, false ); const model = {
url: '#custom_id',
extract: 'Custom <i>extract</i> with an <a href="/wiki/Internal">internal</a> and an <a href="//wikipedia.de" class="external">external</a> link',
type: previewTypes.TYPE_REFERENCE,
referenceType: 'web'
},
preview = createReferencePreview( model );
assert.strictEqual( assert.strictEqual( preview.hasThumbnail, false );
$( preview.el ).find( '.mwe-popups-title' ).text().trim(), assert.strictEqual( preview.isTall, false );
'<cite-reference-previews-web>'
);
assert.strictEqual(
$( preview.el ).find( '.mw-parser-output' ).text().trim(),
'Custom extract with an internal and an external link'
);
assert.strictEqual(
$( preview.el ).find( 'a[target="_blank"]' ).length,
1,
'only external links open in new tabs'
);
} );
QUnit.test( 'createReferencePreview default title', ( assert ) => { assert.strictEqual(
const model = { $( preview.el ).find( '.mwe-popups-title' ).text().trim(),
url: '', '<cite-reference-previews-web>'
extract: '', );
type: previewTypes.TYPE_REFERENCE assert.strictEqual(
}, $( preview.el ).find( '.mw-parser-output' ).text().trim(),
preview = createReferencePreview( model ); 'Custom extract with an internal and an external link'
);
assert.strictEqual(
$( preview.el ).find( 'a[target="_blank"]' ).length,
1,
'only external links open in new tabs'
);
} );
assert.strictEqual( QUnit.test( 'createReferencePreview default title', ( assert ) => {
$( preview.el ).find( '.mwe-popups-title' ).text().trim(), const model = {
'<cite-reference-previews-reference>' url: '',
); extract: '',
} ); type: previewTypes.TYPE_REFERENCE
},
preview = createReferencePreview( model );
QUnit.test( 'createReferencePreview updates fade-out effect on scroll', ( assert ) => { assert.strictEqual(
const model = { $( preview.el ).find( '.mwe-popups-title' ).text().trim(),
url: '', '<cite-reference-previews-reference>'
extract: '', );
type: previewTypes.TYPE_REFERENCE } );
},
preview = createReferencePreview( model ),
$extract = $( preview.el ).find( '.mwe-popups-extract' );
$extract.children()[ 0 ].dispatchEvent( new Event( 'scroll' ) ); QUnit.test( 'createReferencePreview updates fade-out effect on scroll', ( assert ) => {
const model = {
url: '',
extract: '',
type: previewTypes.TYPE_REFERENCE
},
preview = createReferencePreview( model ),
$extract = $( preview.el ).find( '.mwe-popups-extract' );
assert.false( $extract.children()[ 0 ].isScrolling ); $extract.children()[ 0 ].dispatchEvent( new Event( 'scroll' ) );
assert.false( $extract.hasClass( 'mwe-popups-fade-out' ) );
} );
QUnit.test( 'createReferencePreview collapsible/sortable handling', ( assert ) => { assert.false( $extract.children()[ 0 ].isScrolling );
const model = { assert.false( $extract.hasClass( 'mwe-popups-fade-out' ) );
url: '', } );
extract: '<table class="mw-collapsible"></table>' +
'<table class="sortable"><th class="headerSort" tabindex="1" title="Click here"></th></table>',
type: previewTypes.TYPE_REFERENCE
},
preview = createReferencePreview( model );
assert.strictEqual( $( preview.el ).find( '.mw-collapsible, .sortable, .headerSort' ).length, 0 ); QUnit.test( 'createReferencePreview collapsible/sortable handling', ( assert ) => {
assert.strictEqual( $( preview.el ).find( 'th' ).attr( 'tabindex' ), undefined ); const model = {
assert.strictEqual( $( preview.el ).find( 'th' ).attr( 'title' ), undefined ); url: '',
assert.strictEqual( extract: '<table class="mw-collapsible"></table>' +
$( preview.el ).find( '.mwe-collapsible-placeholder' ).text(), '<table class="sortable"><th class="headerSort" tabindex="1" title="Click here"></th></table>',
'<cite-reference-previews-collapsible-placeholder>' type: previewTypes.TYPE_REFERENCE
); },
} ); preview = createReferencePreview( model );
assert.strictEqual( $( preview.el ).find( '.mw-collapsible, .sortable, .headerSort' ).length, 0 );
assert.strictEqual( $( preview.el ).find( 'th' ).attr( 'tabindex' ), undefined );
assert.strictEqual( $( preview.el ).find( 'th' ).attr( 'title' ), undefined );
assert.strictEqual(
$( preview.el ).find( '.mwe-collapsible-placeholder' ).text(),
'<cite-reference-previews-collapsible-placeholder>'
);
} );
}() );