summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/html/semantics/embedded-content/media-elements/track/track-element/track-text-track-cue-list.html
blob: 73241ce0d4a1b82f9763f8410420ac59fa14d379 (plain)
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
<!DOCTYPE html>
<title>TextTrackCueList functionality: length, operator[], and getCueById()</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<video>
    <track src="resources/settings.vtt" kind="captions" default>
    <script>
    async_test(function(t) {
        var testTrack = document.querySelector("track");

        testTrack.onload = t.step_func_done(function() {
            var cues = testTrack.track.cues;

            // Testing TextTrackCueList length.
            assert_equals(cues.length, 4);

            // Testing TextTrackCueList [] operator.
            assert_equals(cues[0].id, "1");
            assert_equals(cues[3].id, "4");
            assert_equals(cues[4], undefined);

            // Testing TextTrackCueList getCueById().
            assert_equals(cues.getCueById("1").startTime, 0);
            assert_equals(cues.getCueById("4").startTime, 121);
            assert_equals(cues.getCueById("junk"), null);
        });
    });
    </script>
</video>