2022-12-07 22:10:09 +00:00
|
|
|
const features = require( '../../../resources/skins.vector.es6/features.js' );
|
2022-10-21 18:14:54 +00:00
|
|
|
|
|
|
|
describe( 'features', () => {
|
|
|
|
beforeEach( () => {
|
|
|
|
document.body.setAttribute( 'class', 'vector-feature-foo-disabled vector-feature-bar-enabled hello' );
|
|
|
|
} );
|
|
|
|
|
|
|
|
test( 'toggle', () => {
|
|
|
|
features.toggle( 'foo' );
|
|
|
|
features.toggle( 'bar' );
|
|
|
|
|
|
|
|
expect(
|
|
|
|
document.body.classList.contains( 'vector-feature-foo-enabled' )
|
|
|
|
).toBe( true );
|
|
|
|
expect(
|
|
|
|
document.body.classList.contains( 'vector-feature-foo-disabled' )
|
|
|
|
).toBe( false );
|
|
|
|
expect(
|
|
|
|
document.body.classList.contains( 'vector-feature-bar-disabled' )
|
|
|
|
).toBe( true );
|
|
|
|
expect(
|
|
|
|
document.body.classList.contains( 'vector-feature-bar-enabled' )
|
|
|
|
).toBe( false );
|
|
|
|
expect(
|
|
|
|
document.body.classList.contains( 'hello' )
|
|
|
|
).toBe( true );
|
|
|
|
} );
|
|
|
|
|
|
|
|
test( 'toggle unknown feature', () => {
|
|
|
|
expect( () => {
|
|
|
|
features.toggle( 'unknown' );
|
|
|
|
} ).toThrow();
|
|
|
|
} );
|
|
|
|
} );
|