Skip to content

Commit

Permalink
test: Add unit tests for pendingSeekTime when SmartTV focus moves awa…
Browse files Browse the repository at this point in the history
…y without confirmation
  • Loading branch information
Borut Zizmond committed Feb 21, 2025
1 parent 8f6e3e5 commit 26fcc0c
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions test/unit/controls.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -688,6 +688,7 @@ QUnit.module('SmartTV UI Updates (Progress Bar & Time Display)', function(hooks)

hooks.beforeEach(function() {
player = TestHelpers.makePlayer({
spatialNavigation: { enabled: true },
disableSeekWhileScrubbingOnSTV: true,
controlBar: {
progressControl: {
Expand Down Expand Up @@ -778,4 +779,15 @@ QUnit.module('SmartTV UI Updates (Progress Bar & Time Display)', function(hooks)
'Current-time-display should remain at 45s after seeking'
);
});

QUnit.test('Resets pendingSeekTime when SmartTV focus moves away without confirmation', function(assert) {
const userSeekSpy = sinon.spy(seekBar, 'userSeek_');

seekBar.trigger({ type: 'keydown', key: 'ArrowUp' });
assert.ok(seekBar.pendingSeekTime() !== null, 'pendingSeekTime should be set after ArrowUp keydown');
seekBar.trigger({ type: 'keydown', key: 'ArrowLeft' });
assert.equal(seekBar.pendingSeekTime(), null, 'pendingSeekTime should be reset when SeekBar loses focus');
assert.ok(userSeekSpy.calledWith(player.currentTime()), 'userSeek_ should be called with current player time');
userSeekSpy.restore();
});
});

0 comments on commit 26fcc0c

Please sign in to comment.