blob: 12f2de0c7a9cd7690f3a81e5c64234c14cfe5186 [file] [log] [blame]
Tests that TextTracks in a TextTrackList are kept in the correct order.
** Add a track with video.addTrack().
RUN(video.addTrack('descriptions', 'Descriptions Track', 'en'))
** Add a <track> element with DOM API.
RUN(trackElement = document.createElement('track'))
RUN(trackElement.setAttribute('kind', 'chapters'))
RUN(video.appendChild(trackElement))
** Verify track order.
EXPECTED (video.textTracks.length == '3') OK
EXPECTED (video.textTracks[0].kind == 'captions') OK
EXPECTED (video.textTracks[1].kind == 'chapters') OK
EXPECTED (video.textTracks[2].kind == 'descriptions') OK
** Add another <track> element, is should insert before the addTrack() track.
RUN(trackElement = document.createElement('track'))
RUN(trackElement.setAttribute('kind', 'metadata'))
RUN(video.appendChild(trackElement))
EXPECTED (video.textTracks.length == '4') OK
EXPECTED (video.textTracks[0].kind == 'captions') OK
EXPECTED (video.textTracks[1].kind == 'chapters') OK
EXPECTED (video.textTracks[2].kind == 'metadata') OK
EXPECTED (video.textTracks[3].kind == 'descriptions') OK
END OF TEST