blob: e8f4c13333a7feeaec705518ed55c9c13811963d [file] [log] [blame]
Tests that the 'addtrack' event is fired when a TextTrack is created.
** Test a TextTrack created for a <track> element.
RUN(trackElement = document.createElement('track'))
RUN(video.appendChild(trackElement))
RUN(trackElement.src = 'captions-webvtt/tc004-webvtt-file.vtt')
RUN(trackElement.track.mode = 'hidden')
EXPECTED (video.textTracks.length == '1') OK
EXPECTED (trackElement.readyState == '0') OK
EVENT(addtrack)
EXPECTED (event.target == '[object TextTrackList]') OK
EXPECTED (event instanceof window.TrackEvent == 'true') OK
EXPECTED (event.track == '[object TextTrack]') OK
** Test a TextTrack created with video.addTextTrack().
RUN(tracks.push(video.addTextTrack('captions', 'Caption Track', 'en')))
EXPECTED (video.textTracks.length == '2') OK
EVENT(addtrack)
EXPECTED (event.target == '[object TextTrackList]') OK
EXPECTED (event instanceof window.TrackEvent == 'true') OK
EXPECTED (event.track == '[object TextTrack]') OK
END OF TEST