2018-11-16 16:33:52 +00:00
|
|
|
( function () {
|
2016-05-03 11:26:42 +00:00
|
|
|
var PointerView = mw.libs.revisionSlider.PointerView;
|
|
|
|
|
2020-03-29 21:18:30 +00:00
|
|
|
QUnit.module( 'ext.RevisionSlider.PointerView' );
|
2016-05-03 11:26:42 +00:00
|
|
|
|
|
|
|
QUnit.test( 'Initialize PointerView', function ( assert ) {
|
2016-07-01 10:13:53 +00:00
|
|
|
assert.ok( ( new PointerView( null, 'mw-revslider-pointer' ) ).render().hasClass( 'mw-revslider-pointer' ) );
|
2016-05-03 11:26:42 +00:00
|
|
|
} );
|
|
|
|
|
2017-07-11 08:17:24 +00:00
|
|
|
QUnit.test( 'Is newer pointer', function ( assert ) {
|
2016-05-30 10:06:44 +00:00
|
|
|
var pv = new PointerView( null, 'mw-revslider-pointer' );
|
2016-05-26 10:30:12 +00:00
|
|
|
pv.render();
|
2017-07-11 08:17:24 +00:00
|
|
|
assert.notOk( pv.isNewerPointer() );
|
2016-05-03 11:26:42 +00:00
|
|
|
|
2017-07-11 08:17:24 +00:00
|
|
|
pv.getElement().addClass( 'mw-revslider-pointer-newer' );
|
|
|
|
assert.ok( pv.isNewerPointer() );
|
2016-05-03 11:26:42 +00:00
|
|
|
} );
|
|
|
|
|
2016-05-26 10:30:12 +00:00
|
|
|
QUnit.test( 'Has offset', function ( assert ) {
|
2016-05-30 10:06:44 +00:00
|
|
|
var pv = new PointerView( null, 'mw-revslider-pointer' );
|
2016-05-26 10:30:12 +00:00
|
|
|
pv.render();
|
2018-09-13 20:54:39 +00:00
|
|
|
assert.strictEqual( pv.getOffset(), 0 );
|
2016-05-26 10:30:12 +00:00
|
|
|
|
2017-07-11 08:17:24 +00:00
|
|
|
pv.getElement().addClass( 'mw-revslider-pointer-newer' );
|
2018-09-13 20:54:39 +00:00
|
|
|
assert.strictEqual( pv.getOffset(), 16 );
|
2016-05-26 10:30:12 +00:00
|
|
|
} );
|
2018-11-16 16:33:52 +00:00
|
|
|
}() );
|