Debian Codegraph @

skins/Vector/tests/integration-qunit/integration.test.js

raw symbols SCIP
1 /* global QUnit */
2 const clientPreferences = require( 'skins.vector.clientPreferences' );
3
4 /*!
5 * Vector integration tests.
6 *
7 * This should only be used to test APIs that Vector depends on to work.
8 * For unit tests please see tests/jest.
9 */
10 QUnit.module( 'Vector (integration)', () => {
11 QUnit.test( 'Client preferences: Behaves same for all users', function ( assert ) {
12 const sandbox = this.sandbox;
13 const helper = ( feature, isNamedReturnValue ) => {
14 document.documentElement.setAttribute( 'class', `${ feature }-clientpref-0` );
15 const stub = sandbox.stub( mw.user, 'isNamed', () => isNamedReturnValue );
16 clientPreferences.toggleDocClassAndSave( feature, '1', {
17 'vector-feature-limited-width': {
18 options: [ '1', '0' ],
19 preferenceKey: 'vector-limited-width'
20 }
21 } );
22 stub.restore();
23 return document.documentElement.getAttribute( 'class' );
24 };
25
26 assert.strictEqual(
27 helper( 'vector-feature-limited-width', false ),
28 helper( 'vector-feature-limited-width', true ),
29 'The same classes are modified regardless of the user status.'
30 );
31 } );
32 } );