Tone.js/Tone/core/clock/TransportRepeatEvent.test.ts

44 lines
1.1 KiB
TypeScript
Raw Normal View History

2019-05-22 03:37:03 +00:00
import { expect } from "chai";
import { Offline } from "test/helper/Offline";
import { Transport } from "./Transport";
import { TransportRepeatEvent } from "./TransportRepeatEvent";
describe("TransportRepeatEvent", () => {
it("can be created and disposed", () => {
return Offline((context) => {
2019-09-16 03:32:40 +00:00
const transport = new Transport({ context });
2019-05-22 03:37:03 +00:00
const event = new TransportRepeatEvent(transport, {
duration: 100,
interval: 4,
time: 0,
});
event.dispose();
});
});
it("generates a unique event ID", () => {
return Offline((context) => {
2019-09-16 03:32:40 +00:00
const transport = new Transport({ context });
2019-05-22 03:37:03 +00:00
const event = new TransportRepeatEvent(transport, {
time: 0,
});
expect(event.id).to.be.a("number");
event.dispose();
});
});
it("is removed from the Transport when disposed", () => {
return Offline((context) => {
2019-09-16 03:32:40 +00:00
const transport = new Transport({ context });
2019-05-22 03:37:03 +00:00
const event = new TransportRepeatEvent(transport, {
time: 0,
});
event.dispose();
// @ts-ignore
expect(transport._timeline.length).to.equal(0);
});
});
});