mediawiki-skins-Vector/tests/integration-qunit/integration.test.js
Ed Sanders 7e7486c4a5 build: Update eslint-config-wikimedia to 0.28.0 and autofix
Change-Id: I350941a711d2304fc968b3ba1f1e0afa5878578e
2024-06-06 16:22:05 +01:00

33 lines
1.1 KiB
JavaScript

/* global QUnit */
const clientPreferences = require( 'skins.vector.clientPreferences' );
/*!
* Vector integration tests.
*
* This should only be used to test APIs that Vector depends on to work.
* For unit tests please see tests/jest.
*/
QUnit.module( 'Vector (integration)', () => {
QUnit.test( 'Client preferences: Behaves same for all users', function ( assert ) {
const sandbox = this.sandbox;
const helper = ( feature, isNamedReturnValue ) => {
document.documentElement.setAttribute( 'class', `${ feature }-clientpref-0` );
const stub = sandbox.stub( mw.user, 'isNamed', () => isNamedReturnValue );
clientPreferences.toggleDocClassAndSave( feature, '1', {
'vector-feature-limited-width': {
options: [ '1', '0' ],
preferenceKey: 'vector-limited-width'
}
} );
stub.restore();
return document.documentElement.getAttribute( 'class' );
};
assert.strictEqual(
helper( 'vector-feature-limited-width', false ),
helper( 'vector-feature-limited-width', true ),
'The same classes are modified regardless of the user status.'
);
} );
} );