Skip to content

Commit

Permalink
test: finish dispatcher/plugin/video-attr unit test recovery
Browse files Browse the repository at this point in the history
  • Loading branch information
toxic-johann committed Jan 24, 2019
1 parent 895f4b9 commit 6f03bd9
Showing 1 changed file with 8 additions and 9 deletions.
17 changes: 8 additions & 9 deletions __tests__/dispatcher/plugin/video-attr.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import Plugin from 'dispatcher/plugin';
import Chimee from 'index';
import { getAttr } from 'chimee-helper';

describe("plugin's video attribute", () => {
let dispatcher;
Expand All @@ -16,12 +15,12 @@ describe("plugin's video attribute", () => {
// 编解码容器
box: 'native',
// dom容器
wrapper: 'body',
wrapper: document.createElement('div'),
plugin: [],
events: {},
});

dispatcher = player.__dispatcher;
dispatcher = player.dispatcher;

plugin = new Plugin({ id: 'normal' }, dispatcher);
});
Expand Down Expand Up @@ -142,27 +141,27 @@ describe("plugin's video attribute", () => {
test('playsinline', () => {
plugin.playsInline = true;
expect(plugin.playsInline).toBe(true);
expect(getAttr(dispatcher.dom.videoElement, 'playsinline')).toBe('');
expect(getAttr(dispatcher.dom.videoElement, 'webkit-playsinline')).toBe('');
expect(getAttr(dispatcher.dom.videoElement, 'x5-playsinline')).toBe('');
expect(dispatcher.dom.videoElement.getAttribute('playsinline')).toBe('');
expect(dispatcher.dom.videoElement.getAttribute('webkit-playsinline')).toBe('');
expect(dispatcher.dom.videoElement.getAttribute('x5-playsinline')).toBe('');
});

test('x5VideoPlayerFullscreen', () => {
plugin.x5VideoPlayerFullscreen = true;
expect(plugin.x5VideoPlayerFullscreen).toBe(true);
expect(getAttr(dispatcher.dom.videoElement, 'x5-video-player-fullscreen')).toBe('true');
expect(dispatcher.dom.videoElement.getAttribute('x5-video-player-fullscreen')).toBe('true');
});

test('xWebkitAirplay', () => {
plugin.xWebkitAirplay = true;
expect(plugin.xWebkitAirplay).toBe(true);
expect(getAttr(dispatcher.dom.videoElement, 'x-webkit-airplay')).toBe('true');
expect(dispatcher.dom.videoElement.getAttribute('x-webkit-airplay')).toBe('true');
});

test('x5VideoOrientation', () => {
plugin.x5VideoOrientation = 'landscape';
expect(plugin.x5VideoOrientation).toBe('landscape');
expect(getAttr(dispatcher.dom.videoElement, 'x5-video-orientation')).toBe('landscape');
expect(dispatcher.dom.videoElement.getAttribute('x5-video-orientation')).toBe('landscape');
});

// test('dispatcher is not ready', () => {
Expand Down

0 comments on commit 6f03bd9

Please sign in to comment.