mirror of
https://github.com/DanielnetoDotCom/YouPHPTube
synced 2025-10-05 02:39:46 +02:00
23 lines
820 B
JavaScript
23 lines
820 B
JavaScript
QUnit.test( 'contain', function( assert ) {
|
|
|
|
let flkty = new Flickity( '#contain', {
|
|
contain: true,
|
|
} );
|
|
|
|
assert.equal( Math.round( flkty.x + flkty.cursorPosition ), 0,
|
|
'selected at 0, position left edge' );
|
|
flkty.select( 1 );
|
|
flkty.positionSliderAtSelected();
|
|
assert.equal( Math.round( flkty.x + flkty.cursorPosition ), 0,
|
|
'selected at 1, position left edge' );
|
|
flkty.select( 4 );
|
|
flkty.positionSliderAtSelected();
|
|
let endLimit = flkty.slideableWidth - flkty.size.innerWidth * ( 1 - flkty.cellAlign );
|
|
assert.equal( Math.round( -endLimit ), Math.round( flkty.x ),
|
|
'selected at 4, position right edge' );
|
|
flkty.select( 5 );
|
|
flkty.positionSliderAtSelected();
|
|
assert.equal( Math.round( -endLimit ), Math.round( flkty.x ),
|
|
'selected at 5, position right edge' );
|
|
|
|
} );
|