mirror of
https://github.com/videojs/video.js.git
synced 2025-01-02 06:32:07 +02:00
fix(error-display): component remains displayed after player reset (#8482)
When `player.reset` is called, the `errorDisplay` component is not reset, and neither is `player.error`. - Sets `player.error` to `null`, so that the `player.errorDisplay` and `player.error` are correctly reset. - Adds an `error` function to the `testPlayer` stub to prevent tests from failing.
This commit is contained in:
parent
92b5e79ba9
commit
7972c23a55
@ -3604,6 +3604,9 @@ class Player extends Component {
|
||||
this.loadTech_(this.options_.techOrder[0], null);
|
||||
this.techCall_('reset');
|
||||
this.resetControlBarUI_();
|
||||
|
||||
this.error(null);
|
||||
|
||||
if (isEvented(this)) {
|
||||
this.trigger('playerreset');
|
||||
}
|
||||
|
@ -1910,6 +1910,7 @@ QUnit.test('player#reset loads the Html5 tech and then techCalls reset', functio
|
||||
options_: {
|
||||
techOrder: ['html5', 'youtube']
|
||||
},
|
||||
error() {},
|
||||
resetCache_() {},
|
||||
loadTech_(tech, source) {
|
||||
loadedTech = tech;
|
||||
@ -1942,6 +1943,7 @@ QUnit.test('player#reset loads the first item in the techOrder and then techCall
|
||||
options_: {
|
||||
techOrder: ['youtube', 'html5']
|
||||
},
|
||||
error() {},
|
||||
resetCache_() {},
|
||||
loadTech_(tech, source) {
|
||||
loadedTech = tech;
|
||||
|
@ -144,3 +144,19 @@ QUnit.test('Calling resetVolumeBar player method should reset volume bar', funct
|
||||
|
||||
player.dispose();
|
||||
});
|
||||
|
||||
QUnit.test('Calling reset player method should reset both error display and player error', function(assert) {
|
||||
const player = TestHelpers.makePlayer({techOrder: ['html5']});
|
||||
|
||||
player.error('ERROR');
|
||||
|
||||
assert.notOk(player.errorDisplay.hasClass('vjs-hidden'), 'ErrorDisplay is displayed if there is an error');
|
||||
assert.strictEqual(player.error().message, 'ERROR', 'player error has content');
|
||||
|
||||
player.reset();
|
||||
|
||||
assert.ok(player.errorDisplay.hasClass('vjs-hidden'), 'ErrorDisplay is not displayed if there is no error');
|
||||
assert.strictEqual(player.error(), null, 'player error has content');
|
||||
|
||||
player.dispose();
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user