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

33 lines
1.1 KiB

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().v, 0.5 );
assert.equal( component.get().paused, true );
const audio = target.querySelector( 'audio' );
const timeupdate = new window.Event( 'timeupdate' );
const durationchange = new window.Event( 'durationchange' );
const volumechange = new window.Event( 'volumechange' );
audio.currentTime = 10;
audio.duration = 20;
audio.volume = 0.75;
audio.dispatchEvent( timeupdate );
audio.dispatchEvent( durationchange );
audio.dispatchEvent( volumechange );
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().v, 0.75 );
assert.equal( component.get().paused, true ); // ditto...
component.destroy();
}
};