-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Closes #22
- Loading branch information
Showing
7 changed files
with
96 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
var webpackConfig = require('../webpack.config.dev') | ||
webpackConfig.devtool = 'inline-source-map' | ||
|
||
module.exports = function (config) { | ||
config.set({ | ||
browsers: process.env.CONTINUOUS_INTEGRATION ? [ 'Firefox' ] : [ 'Chrome', 'Firefox' ], | ||
singleRun: true, | ||
frameworks: [ 'mocha', 'chai' ], | ||
files: [ | ||
'karma.webpack.js' | ||
], | ||
preprocessors: { | ||
'karma.webpack.js': [ 'webpack', 'sourcemap' ] | ||
}, | ||
reporters: [ 'mocha' ], | ||
webpack: webpackConfig, | ||
webpackServer: { | ||
noInfo: true | ||
}, | ||
client: { | ||
mocha: { | ||
timeout: 10000 | ||
} | ||
} | ||
}) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
var context = require.context('./karma', true, /\.js$/) | ||
context.keys().forEach(context) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
import React from 'react' | ||
import { render, unmountComponentAtNode } from 'react-dom' | ||
|
||
import ReactPlayer from '../../src/ReactPlayer' | ||
|
||
const { describe, it, beforeEach, afterEach } = window | ||
const TEST_YOUTUBE_URL = 'https://www.youtube.com/watch?v=GlCmAC4MHek' | ||
const TEST_SOUNDCLOUD_URL = 'https://soundcloud.com/miami-nights-1984/accelerated' | ||
const TEST_VIMEO_URL = 'https://vimeo.com/90509568' | ||
const TEST_MP4_URL = 'http://clips.vorwaerts-gmbh.de/big_buck_bunny.mp4' | ||
|
||
describe('ReactPlayer', () => { | ||
let div | ||
|
||
beforeEach(() => { | ||
div = document.createElement('div') | ||
document.body.appendChild(div) | ||
}) | ||
|
||
it('plays a YouTube video', function (done) { | ||
const player = <ReactPlayer url={TEST_YOUTUBE_URL} playing onPlay={() => done()} /> | ||
render(player, div) | ||
}) | ||
|
||
it('plays a SoundCloud track', function (done) { | ||
const player = <ReactPlayer url={TEST_SOUNDCLOUD_URL} playing onPlay={() => done()} /> | ||
render(player, div) | ||
}) | ||
|
||
it('plays a Vimeo video', function (done) { | ||
const player = <ReactPlayer url={TEST_VIMEO_URL} playing onPlay={() => done()} /> | ||
render(player, div) | ||
}) | ||
|
||
it('plays an mp4', function (done) { | ||
const player = <ReactPlayer url={TEST_MP4_URL} playing onPlay={() => done()} /> | ||
render(player, div) | ||
}) | ||
|
||
afterEach(() => { | ||
unmountComponentAtNode(div) | ||
document.body.removeChild(div) | ||
}) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters