summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/html/semantics/embedded-content/media-elements/track/track-element/track-cue-empty.html
blob: 59f8fc6c7b8d560d5a1059d66fc9bb0694930e65 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
<!DOCTYPE html>
<title>Invoke getCueAsHTML() on an empty cue</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script>
test(function() {
    var emptyCue = new VTTCue(0, 0, "");
    var fragment = emptyCue.getCueAsHTML();

    // The getCueAsHTML() method should return a document fragment.
    assert_true(fragment instanceof DocumentFragment);

    // The document fragment should have one child, an empty Text node.
    assert_equals(fragment.childNodes.length, 1);
    assert_equals(fragment.childNodes[0].constructor.name, Text.name);
    assert_equals(fragment.childNodes[0].length, 0);
    assert_equals(fragment.childNodes[0].data, "");
});
</script>