-
Notifications
You must be signed in to change notification settings - Fork 7.5k
Commit
closes #1667 Fix text track tests. Now that ready is async, we need to tick the clock so the ready handler fires. Remove unneeded ready test
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,18 +2,27 @@ import TextTrackMenuItem from '../../../src/js/control-bar/text-track-controls/t | |
import TestHelpers from '../test-helpers.js'; | ||
import * as browser from '../../../src/js/utils/browser.js'; | ||
|
||
q.module('Text Track Controls'); | ||
q.module('Text Track Controls', { | ||
'setup': function() { | ||
this.clock = sinon.useFakeTimers(); | ||
}, | ||
'teardown': function() { | ||
this.clock.restore(); | ||
} | ||
}); | ||
|
||
var track = { | ||
kind: 'captions', | ||
label: 'test' | ||
}; | ||
|
||
test('should be displayed when text tracks list is not empty', function() { | ||
var player = TestHelpers.makePlayer({ | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
heff
Author
Member
|
||
let player = TestHelpers.makePlayer({ | ||
tracks: [track] | ||
}); | ||
|
||
this.clock.tick(1000); | ||
|
||
ok(!player.controlBar.captionsButton.hasClass('vjs-hidden'), 'control is displayed'); | ||
equal(player.textTracks().length, 1, 'textTracks contains one item'); | ||
}); | ||
|
@@ -49,7 +58,11 @@ test('menu should contain "Settings", "Off" and one track', function() { | |
var player = TestHelpers.makePlayer({ | ||
tracks: [track] | ||
}), | ||
menuItems = player.controlBar.captionsButton.items; | ||
menuItems; | ||
|
||
this.clock.tick(1000); | ||
|
||
menuItems = player.controlBar.captionsButton.items; | ||
|
||
equal(menuItems.length, 3, 'menu contains three items'); | ||
equal(menuItems[0].track.label, 'captions settings', 'menu contains "captions settings"'); | ||
|
@@ -62,6 +75,8 @@ test('menu should update with addRemoteTextTrack', function() { | |
tracks: [track] | ||
}); | ||
|
||
this.clock.tick(1000); | ||
|
||
player.addRemoteTextTrack(track); | ||
|
||
equal(player.controlBar.captionsButton.items.length, 4, 'menu does contain added track'); | ||
|
@@ -73,6 +88,8 @@ test('menu should update with removeRemoteTextTrack', function() { | |
tracks: [track, track] | ||
}); | ||
|
||
this.clock.tick(1000); | ||
|
||
player.removeRemoteTextTrack(player.textTracks()[0]); | ||
|
||
equal(player.controlBar.captionsButton.items.length, 3, 'menu does not contain removed track'); | ||
|
2 comments
on commit a575801
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The addition of this.clock.tick(1000);
to fix text track tests seems incomplete; why is it done in test 'menu should update with addRemoteTextTrack', but not in test 'should not be displayed when last text track is removed'? Although this latter test passes, shouldn't it have the clock.tick addition?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@gkatsev will have to answer this one.
How come you changed this 'var' to a 'let', but not others in this module?