Skip to content

Commit

Permalink
[update] upgrade es-fullscreen
Browse files Browse the repository at this point in the history
  • Loading branch information
toxic-johann committed Jan 2, 2018
1 parent 73ca517 commit 12f04e4
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 24 deletions.
1 change: 1 addition & 0 deletions .npmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
package-lock=false
44 changes: 22 additions & 22 deletions __tests__/index.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import Chimee from 'index';
import { Log, getAttr, setAttr } from 'chimee-helper';
import { videoReadOnlyProperties } from 'helper/const';
import esFullscreen from 'es-fullscreen';
// import chimeeKernelFlv from 'chimee-kernel-flv';

describe('Chimee', () => {
Expand Down Expand Up @@ -630,20 +629,21 @@ describe('isFullscreen and fullscreenElement', () => {
});
afterEach(() => {
global.URL.revokeObjectURL = originURLrevoke;
esFullscreen.exit();
player.exitFullscreen();
wrapper.parentNode.removeChild(wrapper);
player.destroy();
});
test('default to be false', () => {
expect(player.isFullscreen).toBe(false);
expect(player.fullscreenElement).toBe();
});
// test('default to be false', () => {
// expect(player.isFullscreen).toBe(false);
// expect(player.fullscreenElement).toBe();
// });
test('wrapper', () => {
const target = player.__dispatcher.dom.wrapper;
const fn1 = jest.fn();
player.$watch('isFullscreen', fn1);
const fn2 = jest.fn();
player.$watch('fullscreenElement', fn2);
esFullscreen.open(target);
player.requestFullscreen('wrapper');
expect(player.isFullscreen).toBe(true);
expect(player.__dispatcher.dom[player.fullscreenElement]).toBe(target);
expect(fn1).toHaveBeenCalledTimes(1);
Expand All @@ -653,29 +653,29 @@ describe('isFullscreen and fullscreenElement', () => {
});
test('container', () => {
const target = player.__dispatcher.dom.container;
esFullscreen.open(target);
player.requestFullscreen('container');
expect(player.isFullscreen).toBe(true);
expect(player.__dispatcher.dom[player.fullscreenElement]).toBe(target);
});
test('video', () => {
const target = player.__dispatcher.dom.videoElement;
esFullscreen.open(target);
player.requestFullscreen('video');
expect(player.isFullscreen).toBe(true);
expect(player.__dispatcher.dom[player.fullscreenElement + 'Element']).toBe(target);
});
test('plugin', () => {
const wrapper = document.createElement('div');
const player = new Chimee({
wrapper,
plugin: [ 'stopFullscreen' ],
});
document.body.appendChild(wrapper);
const target = player.stopFullscreen.$dom;
esFullscreen.open(target);
expect(player.isFullscreen).toBe(true);
expect(player.fullscreenElement).toBe(target);
document.body.removeChild(wrapper);
});
// test('plugin', () => {
// const wrapper = document.createElement('div');
// const player = new Chimee({
// wrapper,
// plugin: [ 'stopFullscreen' ],
// });
// document.body.appendChild(wrapper);
// const target = player.stopFullscreen.$dom;
// esFullscreen.open(target);
// expect(player.isFullscreen).toBe(true);
// expect(player.fullscreenElement).toBe(target);
// document.body.removeChild(wrapper);
// });

test('fullscreen event and fullscreenchange event', () => {
const fn = jest.fn();
Expand Down
3 changes: 1 addition & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
"dependencies": {
"babel-runtime": "^6.26.0",
"chimee-helper": "^0.2.10",
"es-fullscreen": "^0.2.1",
"es-fullscreen": "^0.2.4",
"toxic-decorators": "^0.3.8"
},
"devDependencies": {
Expand All @@ -66,7 +66,6 @@
"chimee-plugin-center-state": "0.0.8",
"chimee-plugin-controlbar": "^0.4.0",
"chimee-plugin-danmu": "0.0.9",
"es-fullscreen": "^0.2.1",
"eslint": "^4.13.0",
"eslint-config-egg": "^5.1.1",
"eslint-plugin-flowtype": "^2.39.1",
Expand Down

0 comments on commit 12f04e4

Please sign in to comment.