File "isBusy.test.ts"
Full path: /home/fsibplc/public_html/sommilito-bank2/splide-4.1.3/src/js/components/Controller/test/isBusy.test.ts
File
size: 1.48 B
MIME-type: text/x-java
Charset: utf-8
Download Open Edit Advanced Editor Back
import { fire, init } from '../../../test';
describe( 'Controller#isBusy', () => {
test( 'can check if the slider is moving or not.', () => {
const splide = init( { width: 200, height: 100, waitForTransition: true } );
const { Controller, Move } = splide.Components;
expect( Controller.isBusy() ).toBe( false );
Move.move( 1, 1, -1 );
expect( Controller.isBusy() ).toBe( true );
fire( splide.Components.Elements.list, 'transitionend' );
expect( Controller.isBusy() ).toBe( false );
} );
test( 'can check if the slider is being scrolled or not.', () => {
const splide = init( { width: 200, height: 100, waitForTransition: true } );
const { Controller, Scroll } = splide.Components;
expect( Controller.isBusy() ).toBe( false );
Scroll.scroll( 10, 10 );
expect( Controller.isBusy() ).toBe( true );
Scroll.cancel();
expect( Controller.isBusy() ).toBe( false );
} );
test( 'should always return true if `waitForTransition` is false.', () => {
const splide = init( { width: 200, height: 100, waitForTransition: false } );
const { Controller, Move, Scroll } = splide.Components;
expect( Controller.isBusy() ).toBe( false );
Move.move( 1, 1, -1 );
expect( Controller.isBusy() ).toBe( false );
Move.cancel();
expect( Controller.isBusy() ).toBe( false );
Scroll.scroll( 10, 10 );
expect( Controller.isBusy() ).toBe( false );
Scroll.cancel();
expect( Controller.isBusy() ).toBe( false );
} );
} );