mirror of
https://github.com/material-components/material-web.git
synced 2024-09-21 02:27:12 +03:00
30c95aeee1
In particular, this allows external build tools like Rollup and @web/dev-server to understand imports of Lit, which is configured to require the ".js" extension via its export conditions (so that Lit import maps can remain minimal). PiperOrigin-RevId: 469772992
58 lines
1.6 KiB
TypeScript
58 lines
1.6 KiB
TypeScript
/**
|
|
* @license
|
|
* Copyright 2022 Google LLC
|
|
* SPDX-License-Identifier: Apache-2.0
|
|
*/
|
|
|
|
import 'jasmine';
|
|
|
|
import {AnimationSignal, createAnimationSignal} from './animation.js';
|
|
|
|
describe('createAnimationSignal()', () => {
|
|
let task: AnimationSignal;
|
|
|
|
beforeEach(() => {
|
|
task = createAnimationSignal();
|
|
});
|
|
|
|
describe('start()', () => {
|
|
it('should return an AbortSignal', () => {
|
|
const signal = task.start();
|
|
expect(signal).toBeInstanceOf(AbortSignal);
|
|
});
|
|
|
|
it('should abort previous signal on subsequent calls', () => {
|
|
const firstSignal = task.start();
|
|
expect(firstSignal.aborted)
|
|
.withContext('first signal should not be aborted by default')
|
|
.toBeFalse();
|
|
const secondSignal = task.start();
|
|
expect(firstSignal.aborted)
|
|
.withContext('first signal should abort after start is called again')
|
|
.toBeTrue();
|
|
expect(secondSignal.aborted)
|
|
.withContext('second signal should not be aborted by default')
|
|
.toBeFalse();
|
|
});
|
|
});
|
|
|
|
describe('finish()', () => {
|
|
it('should not abort the AbortSignal', () => {
|
|
const signal = task.start();
|
|
task.finish();
|
|
expect(signal.aborted)
|
|
.withContext('finishing a task should not signal an abort')
|
|
.toBeFalse();
|
|
});
|
|
|
|
it('should not abort previous tasks when starting after finishing', () => {
|
|
const firstSignal = task.start();
|
|
task.finish();
|
|
task.start();
|
|
expect(firstSignal.aborted)
|
|
.withContext('starting a new task should not finished tasks')
|
|
.toBeFalse();
|
|
});
|
|
});
|
|
});
|