1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
|
<!doctype html>
<title>TextTrackCueList getter</title>
<script src=/resources/testharness.js></script>
<script src=/resources/testharnessreport.js></script>
<div id=log></div>
<script>
setup(function(){
window.video = document.createElement('video');
window.t1 = video.addTextTrack('subtitles');
document.body.appendChild(video);
});
test(function(){
var cues = t1.cues;
assert_equals(cues[0], undefined, 'cues[0] before');
var c1 = new VTTCue(0, 1, 'text1');
t1.addCue(c1);
assert_equals(cues[0], c1, 'cues[0]');
assert_equals(cues[1], undefined, 'cues[1]');
assert_equals(cues[-1], undefined, 'cues[-1]');
t1.removeCue(c1);
assert_equals(cues[0], undefined, 'cues[0] after');
});
test(function(){
var cues = t1.cues;
assert_equals(cues[0], undefined);
cues[0] = 'foo';
assert_equals(cues[0], undefined);
var c1 = new VTTCue(0, 1, 'text1');
t1.addCue(c1);
assert_equals(cues[0], c1);
cues[0] = 'foo';
assert_equals(cues[0], c1);
t1.removeCue(c1);
}, document.title+', no indexed set/create');
test(function(){
'use strict';
var cues = t1.cues;
assert_equals(cues[0], undefined);
assert_throws(new TypeError(), function() { cues[0] = 'foo'; });
assert_equals(cues[0], undefined);
var c1 = new VTTCue(0, 1, 'text1');
t1.addCue(c1);
assert_equals(cues[0], c1);
assert_throws(new TypeError(), function() { cues[0] = 'foo'; });
assert_equals(cues[0], c1);
t1.removeCue(c1);
}, document.title+', no indexed set/create (strict)');
</script>
|