2023-04-10 19:31:50 +00:00
|
|
|
const features = require( '../../../resources/skins.vector.js/features.js' );
|
2022-10-21 18:14:54 +00:00
|
|
|
|
|
|
|
describe( 'features', () => {
|
|
|
|
beforeEach( () => {
|
2023-02-07 20:23:19 +00:00
|
|
|
document.documentElement.setAttribute( 'class', 'vector-feature-foo-disabled vector-feature-bar-enabled hello' );
|
2022-10-21 18:14:54 +00:00
|
|
|
} );
|
|
|
|
|
|
|
|
test( 'toggle', () => {
|
|
|
|
features.toggle( 'foo' );
|
|
|
|
features.toggle( 'bar' );
|
|
|
|
|
|
|
|
expect(
|
2023-02-07 20:23:19 +00:00
|
|
|
document.documentElement.classList.contains( 'vector-feature-foo-enabled' )
|
2022-10-21 18:14:54 +00:00
|
|
|
).toBe( true );
|
|
|
|
expect(
|
2023-02-07 20:23:19 +00:00
|
|
|
document.documentElement.classList.contains( 'vector-feature-foo-disabled' )
|
2022-10-21 18:14:54 +00:00
|
|
|
).toBe( false );
|
|
|
|
expect(
|
2023-02-07 20:23:19 +00:00
|
|
|
document.documentElement.classList.contains( 'vector-feature-bar-disabled' )
|
2022-10-21 18:14:54 +00:00
|
|
|
).toBe( true );
|
|
|
|
expect(
|
2023-02-07 20:23:19 +00:00
|
|
|
document.documentElement.classList.contains( 'vector-feature-bar-enabled' )
|
2022-10-21 18:14:54 +00:00
|
|
|
).toBe( false );
|
|
|
|
expect(
|
2023-02-07 20:23:19 +00:00
|
|
|
document.documentElement.classList.contains( 'hello' )
|
2022-10-21 18:14:54 +00:00
|
|
|
).toBe( true );
|
|
|
|
} );
|
|
|
|
|
|
|
|
test( 'toggle unknown feature', () => {
|
|
|
|
expect( () => {
|
|
|
|
features.toggle( 'unknown' );
|
|
|
|
} ).toThrow();
|
|
|
|
} );
|
|
|
|
} );
|