mirror of
https://gerrit.wikimedia.org/r/mediawiki/skins/Vector.git
synced 2024-11-14 19:26:42 +00:00
7d5caf3f66
Bug: T354224 Change-Id: I6949c4f49ec34b8e47036da4222a5f3ff491af32
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)', function () {
|
|
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.'
|
|
);
|
|
} );
|
|
} );
|