mirror of
https://gerrit.wikimedia.org/r/mediawiki/skins/Vector.git
synced 2024-12-23 21:22:52 +00:00
c3e57e0ecd
With T178356 ES6 is the default, so these can now be managed in the same module. Keeping them in the same module will hopefully allow us to make more optimizations on the long term. Change-Id: I3fe9e50143b85b4cdc3d9171a60c3720a7c26b4b
35 lines
980 B
JavaScript
35 lines
980 B
JavaScript
const features = require( '../../../resources/skins.vector.js/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();
|
|
} );
|
|
} );
|