You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
svelte/test/runtime/samples/binding-audio-currenttime-d.../_config.js

28 lines
892 B

export default {
// not sure if we can really test this in JSDOM. Refer to
// https://svelte.technology/repl?example=media-elements
// instead
skip: true,
test ( assert, component, target, window ) {
assert.equal( component.get( 't' ), 0 );
assert.equal( component.get( 'd' ), 0 );
assert.equal( component.get( 'paused' ), true );
const audio = target.querySelector( 'audio' );
const timeupdate = new window.Event( 'timeupdate' );
const durationchange = new window.Event( 'durationchange' );
audio.currentTime = 10;
audio.duration = 20;
audio.dispatchEvent( timeupdate );
audio.dispatchEvent( durationchange );
audio.play();
assert.equal( component.get( 't' ), 10 );
assert.equal( component.get( 'd' ), 0 ); // not 20, because read-only. Not sure how to test this!
assert.equal( component.get( 'paused' ), true ); // ditto...
component.destroy();
}
};