mirror of
https://gerrit.wikimedia.org/r/mediawiki/skins/Vector.git
synced 2024-11-30 18:35:44 +00:00
7e7486c4a5
Change-Id: I350941a711d2304fc968b3ba1f1e0afa5878578e
33 lines
1.1 KiB
JavaScript
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.'
|
|
);
|
|
} );
|
|
} );
|