tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

track-webvtt-markup.html (3225B)


      1 <!DOCTYPE html>
      2 <title>Cues with &lt;b&gt;, &lt;i&gt;, &lt;u&gt;, &lt;rt&gt; and &lt;ruby&gt; tags</title>
      3 <meta name="timeout" content="long">
      4 <script src="track-helpers.js"></script>
      5 <script src="/resources/testharness.js"></script>
      6 <script src="/resources/testharnessreport.js"></script>
      7 <script>
      8 check_cues_from_track("resources/markup.vtt", function(track) {
      9    assert_equals(track.cues.length, 4);
     10 
     11    var children = [
     12        { type: "text", value: "The following bear is bold:\n" },
     13        { type: "b", value: [ { type: "text", value: "Bear" } ] },
     14        { type: "text", value: " is Coming!!!!!" }
     15    ];
     16    assert_cue_fragment(track.cues[0], children);
     17 
     18    children = [
     19        { type: "text", value: "The following bear is in italics and has a class of \"larger\":\n" },
     20        { type: "i", value: [ { type: "text", value: "Bear" } ] },
     21        { type: "text", value: " is Coming!!!!!" }
     22    ];
     23 
     24    var fragment = createFragment(children);
     25    fragment.querySelector("i").className = "larger";
     26    assert_true(fragment.isEqualNode(track.cues[1].getCueAsHTML()));
     27 
     28    children = [
     29        { type: "text", value: "The following bear is underlined even though the element has a blank:\nI said " },
     30        { type: "u", value: [ { type: "text", value: "Bear" } ] },
     31        { type: "text", value: " is coming!!!!" }
     32    ];
     33    assert_cue_fragment(track.cues[2], children);
     34 
     35    children = [
     36        { type: "text", value: "The following bear is ruby annotated:\nI said " },
     37        {
     38            type: "ruby",
     39            value: [
     40                { type: "text", value: "Bear" },
     41                {
     42                    type: "rt",
     43                    value: [ { type: "text", value: "bear with me" } ]
     44                }
     45            ]
     46        },
     47        { type: "text", value: " is coming!!!!" }
     48    ];
     49    assert_cue_fragment(track.cues[3], children);
     50 });
     51 
     52 check_cues_from_track("resources/markup-bad.vtt", function(track) {
     53    assert_equals(track.cues.length, 4);
     54 
     55    var children = [
     56        { type: "text", value: "The following bear starts bold but end is broken:\n" },
     57        {
     58            type: "b",
     59            value:
     60            [
     61                { type: "text", value: "Bear" },
     62                { type: "text", value: " is Coming!!!!!" }
     63            ]
     64        }
     65    ];
     66    assert_cue_fragment(track.cues[0], children);
     67 
     68    children = [
     69        { type: "text", value: "The following bear is not in italics but the markup is removed:\n" },
     70        { type: "text", value: "Bear" },
     71        { type: "text", value: " is Coming!!!!!" }
     72    ];
     73    assert_cue_fragment(track.cues[1], children);
     74 
     75    children = [
     76        { type: "text", value: "The following bear is not underlined and markup is removed:\nI said " },
     77        { type: "text", value : "Bear" },
     78        { type: "text", value : " is coming!!!!" }
     79    ];
     80    assert_cue_fragment(track.cues[2], children);
     81 
     82    children = [
     83        { type: "text", value: "The following bear is not ruby annotated and markup is removed:\nI said " },
     84        { type: "text", value: "Bear" },
     85        { type: "text", value: "bear with me" },
     86        { type: "text", value: " is coming!!!!" }
     87    ];
     88    assert_cue_fragment(track.cues[3], children);
     89 });
     90 </script>