mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/RevisionSlider
synced 2024-12-11 06:56:09 +00:00
b900446572
Reintroduces IIFE closures in test files because variables were declared in the global namespace, and "const" now causes hard errors. Bug: T339323 Change-Id: I69e9d7a29591137f185f3e5ab02dea590ec4dff6
28 lines
896 B
JavaScript
28 lines
896 B
JavaScript
( function () {
|
|
const PointerView = require( 'ext.RevisionSlider.Slider' ).private.PointerView;
|
|
|
|
QUnit.module( 'ext.RevisionSlider.PointerView' );
|
|
|
|
QUnit.test( 'Initialize PointerView', function ( assert ) {
|
|
assert.true( ( new PointerView( null, 'mw-revslider-pointer' ) ).render().hasClass( 'mw-revslider-pointer' ) );
|
|
} );
|
|
|
|
QUnit.test( 'Is newer pointer', function ( assert ) {
|
|
const pv = new PointerView( null, 'mw-revslider-pointer' );
|
|
pv.render();
|
|
assert.false( pv.isNewerPointer() );
|
|
|
|
pv.getElement().addClass( 'mw-revslider-pointer-newer' );
|
|
assert.true( pv.isNewerPointer() );
|
|
} );
|
|
|
|
QUnit.test( 'Has offset', function ( assert ) {
|
|
const pv = new PointerView( null, 'mw-revslider-pointer' );
|
|
pv.render();
|
|
assert.strictEqual( pv.getOffset(), 0 );
|
|
|
|
pv.getElement().addClass( 'mw-revslider-pointer-newer' );
|
|
assert.strictEqual( pv.getOffset(), 16 );
|
|
} );
|
|
}() );
|