add playbackrate to runtime test

pull/2328/head
Lukas 6 years ago
parent 1a1664341a
commit 598fa18e2d

@ -8,24 +8,29 @@ export default {
assert.equal(component.t, 0);
assert.equal(component.d, 0);
assert.equal(component.v, 0.5);
assert.equal(component.r, 1);
assert.equal(component.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');
const ratechange = new window.Event('ratechange');
audio.currentTime = 10;
audio.duration = 20;
audio.volume = 0.75;
audio.playbackRate = 2;
audio.dispatchEvent(timeupdate);
audio.dispatchEvent(durationchange);
audio.dispatchEvent(volumechange);
audio.dispatchEvent(ratechange);
audio.play();
assert.equal(component.t, 10);
assert.equal(component.d, 0); // not 20, because read-only. Not sure how to test this!
assert.equal(component.v, 0.75);
assert.equal(component.r, 2);
assert.equal(component.paused, true); // ditto...
}
};

@ -3,7 +3,8 @@
export let d;
export let paused;
export let v;
export let r;
</script>
<audio bind:currentTime={t} bind:duration={d} bind:paused bind:volume={v}
<audio bind:currentTime={t} bind:duration={d} bind:paused bind:volume={v} bind:playbackRate={r}
src='music.mp3'></audio>
Loading…
Cancel
Save