Page MenuHomeWickedGov Phorge

icons.test.js
No OneTemporary

Size
2 KB
Referenced Files
None
Subscribers
None

icons.test.js

let sandbox, icons, spy;
const
sinon = require( 'sinon' ),
dom = require( '../utils/dom' ),
jQuery = require( '../utils/jQuery' ),
mediaWiki = require( '../utils/mw' ),
mustache = require( '../utils/mustache' ),
oo = require( '../utils/oo' );
QUnit.module( 'MobileFrontend icons.js', {
beforeEach: function () {
sandbox = sinon.sandbox.create();
dom.setUp( sandbox, global );
jQuery.setUp( sandbox, global );
oo.setUp( sandbox, global );
mediaWiki.setUp( sandbox, global );
mustache.setUp( sandbox, global );
icons = require( '../../../src/mobile.startup/icons' );
spy = sandbox.spy( icons, 'IconButton' );
},
afterEach: function () {
sandbox.restore();
jQuery.tearDown();
}
} );
QUnit.test( '#cancel()', function ( assert ) {
icons.cancel();
assert.propEqual( spy.getCall( 0 ).args[ 0 ], {
tagName: 'button',
icon: icons.CANCEL_GLYPH,
additionalClassNames: ' cancel',
label: mw.msg( 'mobile-frontend-overlay-close' ),
isTypeButton: true
}, 'Options are passed down' );
} );
QUnit.test( '#cancel(variant)', function ( assert ) {
icons.cancel( 'gray' );
assert.propEqual( spy.getCall( 0 ).args[ 0 ], {
tagName: 'button',
icon: icons.CANCEL_GLYPH + '-gray',
additionalClassNames: ' cancel',
label: mw.msg( 'mobile-frontend-overlay-close' ),
isTypeButton: true
}, 'Options are passed down' );
} );
QUnit.test( '#cancel(, props)', function ( assert ) {
icons.cancel( '', { additionalClassNames: 'test' } );
assert.propEqual( spy.getCall( 0 ).args[ 0 ], {
tagName: 'button',
icon: icons.CANCEL_GLYPH,
additionalClassNames: 'test cancel',
label: mw.msg( 'mobile-frontend-overlay-close' ),
isTypeButton: true
}, 'Options are passed down' );
} );
QUnit.test( '#spinner(props)', function ( assert ) {
icons.spinner( {
foo: 'will be passed down',
additionalClassNames: 'will-not-be-ignored'
} );
assert.propEqual( spy.getCall( 0 ).args[ 0 ], {
tagName: 'span',
foo: 'will be passed down',
additionalClassNames: 'will-not-be-ignored',
icon: 'spinner',
label: mw.msg( 'mobile-frontend-loading-message' )
}, 'Options are passed down' );
} );
QUnit.test( '#spinner()', function ( assert ) {
icons.spinner( {
foo: 'will be passed down'
} );
assert.propEqual( spy.getCall( 0 ).args[ 0 ], {
tagName: 'span',
foo: 'will be passed down',
additionalClassNames: 'spinner loading',
icon: 'spinner',
label: mw.msg( 'mobile-frontend-loading-message' )
}, 'Options are passed down' );
} );

File Metadata

Mime Type
text/plain
Expires
Wed, Aug 19, 02:39 (2 w, 2 d ago)
Storage Engine
local-disk
Storage Format
Raw Data
Storage Handle
4b/82/1620234c8dd0e0a962619e524cd8
Default Alt Text
icons.test.js (2 KB)

Event Timeline