Skip to content

Commit

Permalink
fix: async audio only tests (#7673)
Browse files Browse the repository at this point in the history
  • Loading branch information
alex-barstow authored Mar 11, 2022
1 parent 762e7bc commit ebb2d09
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions test/unit/player.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -2809,11 +2809,13 @@ QUnit.test('playbackRates only accepts arrays of numbers', function(assert) {
QUnit.test('audioOnlyMode can be set by option', function(assert) {
assert.expect(4);

const done = assert.async();
const player = TestHelpers.makePlayer({audioOnlyMode: true});

player.one('audioonlymodechange', () => {
assert.equal(player.audioOnlyMode(), true, 'asynchronously set via option');
assert.equal(player.hasClass('vjs-audio-only-mode'), true, 'class added asynchronously');
done();
});

assert.equal(player.audioOnlyMode(), false, 'defaults to false');
Expand All @@ -2827,21 +2829,19 @@ QUnit.test('audioOnlyMode(true) returns Promise when promises are supported', fu
if (window.Promise) {
assert.ok(returnValTrue instanceof window.Promise, 'audioOnlyMode(true) returns Promise when supported');
}

return returnValTrue;
});

QUnit.test('audioOnlyMode(false) returns Promise when promises are supported', function(assert) {
const done = assert.async();
const player = TestHelpers.makePlayer({audioOnlyMode: true});

player.one('audioonlymodechange', () => {
const returnValFalse = player.audioOnlyMode(false);

if (window.Promise) {
assert.ok(returnValFalse instanceof window.Promise, 'audioOnlyMode(false) returns Promise when supported');
done();
}

return returnValFalse;
});
});

Expand Down

0 comments on commit ebb2d09

Please sign in to comment.