mediawiki-extensions-Revisi.../tests/qunit/RevisionSlider.PointerView.test.js
Adam Wight b900446572 Migrate JS to ES6
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
2023-06-23 08:01:31 +02:00

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 );
} );
}() );