Bug 1703488 [wpt PR 28394] - Tests for unbounded cue end time, a=testonly

Automatic update from web-platform-tests
Tests for unbounded cue end time (#28394)

Added tests for unbounded TextTrackCue endTime changes proposed in whatwg/html#5953 & w3c/webvtt#493
--

wpt-commits: 786c430165d916bdab740ab491ac541afb3f8bf5
wpt-pr: 28394
This commit is contained in:
Rob Smith 2021-04-24 09:10:39 +00:00 коммит произвёл moz-wptsync-bot
Родитель 8c912f5cb5
Коммит 0bdb67f723
3 изменённых файлов: 12 добавлений и 4 удалений

Просмотреть файл

@ -15,7 +15,8 @@ test(function(){
c1.endTime = c1.endTime;
assert_equals(c1.endTime, -1);
assert_throws_js(TypeError, function(){ c1.endTime = NaN; });
assert_throws_js(TypeError, function(){ c1.endTime = +Infinity; });
c1.endTime = +Infinity;
assert_equals(c1.endTime, +Infinity);
assert_throws_js(TypeError, function(){ c1.endTime = -Infinity; });
}, document.title+', script-created cue');

Просмотреть файл

@ -8,12 +8,12 @@ test(function() {
assert_throws_js(TypeError, function() { new VTTCue(NaN, 0, 'foo'); });
assert_throws_js(TypeError, function() { new VTTCue(Infinity, 0, 'foo'); });
assert_throws_js(TypeError, function() { new VTTCue('tomorrow', 0, 'foo'); });
}, document.title+', non-finite start time');
}, document.title+', invalid start time');
test(function() {
assert_throws_js(TypeError, function() { new VTTCue(0, NaN, 'foo'); });
assert_throws_js(TypeError, function() { new VTTCue(0, Infinity, 'foo'); });
assert_throws_js(TypeError, function() { new VTTCue(0, -Infinity, 'foo'); });
assert_throws_js(TypeError, function() { new VTTCue(0, 'tomorrow', 'foo'); });
}, document.title+', non-finite end time');
}, document.title+', invalid end time');
test(function() {
var start = { valueOf: function() { return 42; } };
var end = { valueOf: function() { return 84; } };

Просмотреть файл

@ -38,6 +38,13 @@ test(function() {
assert_equals(cue.endTime, -1);
}, document.title + ', bad end time');
test(function() {
var cue = new VTTCue(2, +Infinity, 'foo bar');
assert_equals(cue.startTime, 2);
assert_equals(cue.endTime, +Infinity);
}, document.title + ', unbounded end time');
test(function() {
var cue = new VTTCue(3, 12, '<i>foo bar</i>');