mirror of
https://gerrit.wikimedia.org/r/mediawiki/skins/Vector.git
synced 2024-11-24 23:55:53 +00:00
f415a556dd
Additional follow up to Id5afe2c60dc0067e7c74433eda5cd7858f54b0d7
(55bb37f2a
)
Change-Id: Id98161572a09b1d3fc340d75bd8e28b277d68e30
35 lines
981 B
JavaScript
35 lines
981 B
JavaScript
const features = require( '../../../resources/skins.vector.es6/features.js' );
|
|
|
|
describe( 'features', () => {
|
|
beforeEach( () => {
|
|
document.documentElement.setAttribute( 'class', 'vector-feature-foo-disabled vector-feature-bar-enabled hello' );
|
|
} );
|
|
|
|
test( 'toggle', () => {
|
|
features.toggle( 'foo' );
|
|
features.toggle( 'bar' );
|
|
|
|
expect(
|
|
document.documentElement.classList.contains( 'vector-feature-foo-enabled' )
|
|
).toBe( true );
|
|
expect(
|
|
document.documentElement.classList.contains( 'vector-feature-foo-disabled' )
|
|
).toBe( false );
|
|
expect(
|
|
document.documentElement.classList.contains( 'vector-feature-bar-disabled' )
|
|
).toBe( true );
|
|
expect(
|
|
document.documentElement.classList.contains( 'vector-feature-bar-enabled' )
|
|
).toBe( false );
|
|
expect(
|
|
document.documentElement.classList.contains( 'hello' )
|
|
).toBe( true );
|
|
} );
|
|
|
|
test( 'toggle unknown feature', () => {
|
|
expect( () => {
|
|
features.toggle( 'unknown' );
|
|
} ).toThrow();
|
|
} );
|
|
} );
|