blob: 60629f06a226ec15f9c225f66c47bac238038e17 [file] [log] [blame]
<!DOCTYPE html>
<title>Test that cues are being matched properly by the lang attribute and :lang() pseudo class.</title>
<script src="../media-file.js"></script>
<script src="../media-controls.js"></script>
<script src="../../resources/testharness.js"></script>
<script src="../../resources/testharnessreport.js"></script>
<style>
::cue(:lang(ru)) { color: lime; }
::cue(lang[lang="en"]) { color: purple; }
::cue(c[lang="ru"]) { color: red; } /* Shouldn't work, no attribute 'lang' for 'c'. */
</style>
<video></video>
<script>
async_test(function(t) {
var video = document.querySelector('video');
video.src = findMediaFile('video', '../content/test');
var track = document.createElement('track');
track.src = 'captions-webvtt/styling-lang.vtt';
track.kind = 'captions';
track.default = true;
video.appendChild(track);
video.onseeked = t.step_func_done(function() {
var cueNode = textTrackCueElementByIndex(video, 0).firstChild.firstElementChild.firstElementChild;
assert_equals(getComputedStyle(cueNode).color, 'rgb(128, 0, 128)');
cueNode = cueNode.firstElementChild.firstElementChild;
assert_equals(getComputedStyle(cueNode).color, 'rgb(0, 255, 0)');
cueNode = cueNode.firstElementChild.firstElementChild;
assert_equals(getComputedStyle(cueNode).color, 'rgb(128, 0, 128)');
});
video.currentTime = 0.1;
});
</script>