Skip to content

Commit

Permalink
test to improve coverage
Browse files Browse the repository at this point in the history
  • Loading branch information
mister-ben committed May 23, 2023
1 parent c828a01 commit 7542171
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 0 deletions.
23 changes: 23 additions & 0 deletions test/unit/player.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -2209,6 +2209,29 @@ QUnit.test('should not allow to register custom player when any player has been
videojs.registerComponent('Player', Player);
});

QUnit.test('setters getters passed to tech', function(assert) {
const tag = TestHelpers.makeTag();
const fixture = document.getElementById('qunit-fixture');

fixture.appendChild(tag);

const player = videojs(tag, {
techOrder: ['techFaker']
});

const setSpy = sinon.spy(player.tech_, 'setDefaultMuted');
const getSpy = sinon.spy(player.tech_, 'defaultMuted');

player.defaultMuted(true);
player.defaultMuted();

assert.ok(setSpy.calledWith(true), 'setSpy called');
assert.ok(getSpy.called);

setSpy.restore();
getSpy.restore();
});

QUnit.test('techGet runs through middleware if allowedGetter', function(assert) {
let cts = 0;
let muts = 0;
Expand Down
5 changes: 5 additions & 0 deletions test/unit/tech/tech-faker.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,8 @@ class TechFaker extends Tech {

setMuted() {}

setDefaultMuted() {}

setAutoplay(v) {
if (!v) {
this.options_.autoplay = false;
Expand Down Expand Up @@ -120,6 +122,9 @@ class TechFaker extends Tech {
muted() {
return false;
}
defaultMuted() {
return false;
}
autoplay() {
return this.options_.autoplay || false;
}
Expand Down

0 comments on commit 7542171

Please sign in to comment.