Fix test case with type with space in it

Types should not have spaces in them. In the current example this
results in a page preview element with an additional class "<"\'>"
I'm not sure what this is protecting against since we can trust types
to always be in a sensible class friendly form. It would be better
to throw an error in the mw.popups.register function than allow this.

Change-Id: If08c5162c1ca0fc3db4944092231061e22113263
This commit is contained in:
Jon Robson 2023-05-12 16:12:48 -07:00
parent 76973662d1
commit 3bd4275023

View file

@ -254,7 +254,7 @@ QUnit.test( 'createEmptyPreview(null model)', ( assert ) => {
QUnit.test( 'createPreviewWithType(model with unknown type)', ( assert ) => {
const model = {
url: '/wiki/Unknown <"\'>',
type: 'unknown <"\'>'
type: 'unknown'
},
emptyPreview = renderer.createPreviewWithType( model );
@ -265,12 +265,12 @@ QUnit.test( 'createPreviewWithType(model with unknown type)', ( assert ) => {
);
assert.strictEqual(
emptyPreview.el.attr( 'class' ),
'mwe-popups mwe-popups-type-unknown <"\'>',
'mwe-popups mwe-popups-type-unknown',
'Popup type is safely espaced'
);
assert.strictEqual(
emptyPreview.el.find( '.mw-ui-icon' ).attr( 'class' ),
'mw-ui-icon mw-ui-icon-element mw-ui-icon-preview-unknown <"\'>',
'mw-ui-icon mw-ui-icon-element mw-ui-icon-preview-unknown',
'Icon type is safely espaced'
);
} );