track-webvtt-voice.html (1940B)
1 <!DOCTYPE html> 2 <title>Cues with voice markup <v></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 check_cues_from_track("resources/voice.vtt", function(track) { 8 assert_equals(track.cues.length, 3); 9 10 var children = [ 11 { type: "span", style: { className: "blue", title: "Speaker" }, 12 value: [ { type: "text", value: "Bear is Coming!!!!!" } ] }, 13 { type: "text", value: "\nText span with a class and an annotation." } 14 ]; 15 assert_cue_fragment(track.cues[0], children); 16 17 children = [ 18 { type: "span", style: { title: "Doe Hunter" }, 19 value: [ { type: "text", value: "I said Bear is coming!!!!" } ] } 20 ]; 21 assert_cue_fragment(track.cues[1], children); 22 23 children = [ 24 { type: "text", value: "I said " }, 25 { type: "span", style: { className: "blue", title: "Speaker" }, 26 value: [ { type: "text", value: "Bear is coming now" } ] }, 27 { type: "text", value: "!!!!" } 28 ]; 29 assert_cue_fragment(track.cues[2], children); 30 }); 31 32 check_cues_from_track("resources/voice-bad.vtt", function(track) { 33 assert_equals(track.cues.length, 3); 34 35 var children = [ 36 { type: "text", value: "Bear is Coming!!!!!" }, 37 { type: "text", value: "\nThis is two annotations for an empty tag." } 38 ]; 39 assert_cue_fragment(track.cues[0], children); 40 41 children = [ 42 { type: "text", value: "I said Bear is coming!!!!" }, 43 { type: "text", value: "\nThis does not parse as a voice tag." } 44 ]; 45 assert_cue_fragment(track.cues[1], children); 46 47 children = [ 48 { type: "text", value: "I said " }, 49 { type: "text", value: "Bear is coming now" }, 50 { type: "text", value: "!!!!\nThis does not parse as a voice tag." } 51 ]; 52 assert_cue_fragment(track.cues[2], children); 53 }); 54 </script>