track-webvtt-entities.html (1640B)
1 <!DOCTYPE html> 2 <title>Entities in the cue text</title> 3 <script src="track-helpers.js"></script> 4 <script src="/resources/testharness.js"></script> 5 <script src="/resources/testharnessreport.js"></script> 6 <script> 7 var getCueAsHTMLContent = function(cue) { 8 return cue.getCueAsHTML().textContent; 9 }; 10 11 check_cues_from_track("resources/entities.vtt", function(track) { 12 var expected = [ 13 { innerHTML: getCueAsHTMLContent, 14 expected: "This cue has an ampersand & character." }, 15 { innerHTML: getCueAsHTMLContent, 16 expected: "This cue has a less than < character." }, 17 { innerHTML: getCueAsHTMLContent, 18 expected: "This cue has a greater than > character." }, 19 { innerHTML: getCueAsHTMLContent, 20 expected: "This cue has a Left-to-Right Mark \u200e." }, 21 { innerHTML: getCueAsHTMLContent, 22 expected: "This cue has a Right-to-Left Mark \u200f." }, 23 { innerHTML: getCueAsHTMLContent, 24 expected: "This cue has a non-breaking space \u00a0." }, 25 { innerHTML: getCueAsHTMLContent, 26 expected: "This & is parsed to the same as &." } 27 ]; 28 29 assert_cues_html_content(track.cues, expected); 30 }); 31 32 check_cues_from_track("resources/entities-wrong.vtt", function(track) { 33 var expected = [ 34 { innerHTML: getCueAsHTMLContent, 35 expected: "This cue has a less than ", }, 36 { innerHTML: getCueAsHTMLContent, 37 expected: "This cue has a greater than > character.\nSince it's not related to a < character,\nit's just interpreted as text.", } 38 ]; 39 40 assert_cues_html_content(track.cues, expected); 41 }); 42 </script>