mirror of
https://github.com/zhw2590582/ArtPlayer.git
synced 2026-10-21 04:31:20 -08:00
分离工具函数
This commit is contained in:
1 parent
7a84c262da
commit
8ef582f714
22 files changed
+724
-687
No files matched your search
@@ -0,0 +1,32 @@
|
||||
var url = 'https://zhw2590582.github.io/assets-cdn/video/one-more-time-one-more-chance-480p.mp4';
|
||||
|
||||
describe('Option', function() {
|
||||
afterEach(function() {
|
||||
[...Artplayer.instances].forEach(art => {
|
||||
art.destroy(true);
|
||||
});
|
||||
});
|
||||
|
||||
it('Throw error when multiple instances on the same dom element', function() {
|
||||
expect(function() {
|
||||
new Artplayer({ container: '.sample1', url: url });
|
||||
new Artplayer({ container: '.sample1', url: url });
|
||||
}).to.throw(/Cannot mount multiple instances on the same dom element/);
|
||||
});
|
||||
|
||||
it('Throw error when container is not a dom element or selector', function() {
|
||||
expect(function() {
|
||||
new Artplayer({
|
||||
container: null,
|
||||
url: url,
|
||||
});
|
||||
}).to.throw(/option.container require \'string\' or \'Element\' type/);
|
||||
});
|
||||
|
||||
it('The url can return a promise', function() {
|
||||
new Artplayer({
|
||||
container: '.sample1',
|
||||
url: () => Promise.resolve(url),
|
||||
});
|
||||
});
|
||||
});
|
||||
Reference in new issue
Block a user