mirror of
https://github.com/videojs/video.js.git
synced 2025-03-29 22:07:10 +02:00
fix: exit full window mode with Esc key (#7224)
This commit is contained in:
parent
0e46624f1a
commit
e9953e59fa
@ -2979,9 +2979,11 @@ class Player extends Component {
|
||||
fullWindowOnEscKey(event) {
|
||||
if (keycode.isEventKey(event, 'Esc')) {
|
||||
if (this.isFullscreen() === true) {
|
||||
this.exitFullscreen();
|
||||
} else {
|
||||
this.exitFullWindow();
|
||||
if (!this.isFullWindow) {
|
||||
this.exitFullscreen();
|
||||
} else {
|
||||
this.exitFullWindow();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -207,3 +207,20 @@ QUnit.test('fullscreenOptions from function args should override player options'
|
||||
|
||||
player.dispose();
|
||||
});
|
||||
|
||||
QUnit.test('fullwindow mode should exit when ESC event triggered', function(assert) {
|
||||
const player = FullscreenTestHelpers.makePlayer(true);
|
||||
|
||||
player.enterFullWindow();
|
||||
assert.ok(player.isFullWindow, 'enterFullWindow should be called');
|
||||
|
||||
const evt = TestHelpers.createEvent('keydown');
|
||||
|
||||
evt.keyCode = 27;
|
||||
evt.which = 27;
|
||||
player.boundFullWindowOnEscKey_(evt);
|
||||
// player.fullWindowOnEscKey(evt);
|
||||
assert.equal(player.isFullWindow, false, 'exitFullWindow should be called');
|
||||
|
||||
player.dispose();
|
||||
});
|
||||
|
Loading…
x
Reference in New Issue
Block a user