mirror of
https://github.com/zhw2590582/ArtPlayer.git
synced 2026-10-20 12:11:20 -08:00
添加测试用例
This commit is contained in:
1 parent
02009e854d
commit
dc8405403c
3 files changed
+18
-13
No files matched your search
+12
-8
@@ -5,18 +5,14 @@ var artBaseOption = {
|
||||
|
||||
describe('Detect registration status', function() {
|
||||
it('Constructor is a global variable', function() {
|
||||
expect(window.Artplayer).to.be.an('function');
|
||||
expect(window.Artplayer.version).to.be.an('string');
|
||||
expect(window.Artplayer.env).to.be.an('string');
|
||||
expect(window.Artplayer.config).to.be.an('object');
|
||||
expect(window.Artplayer.utils).to.be.an('object');
|
||||
expect(window.Artplayer.DEFAULTS).to.be.an('object');
|
||||
expect(window.Artplayer.instances).to.be.an('array');
|
||||
expect(Artplayer).to.be.an('function');
|
||||
expect(Artplayer.instances).to.be.an('array');
|
||||
});
|
||||
|
||||
it('Instantiation state', function() {
|
||||
it('Instance state', function() {
|
||||
var art = new Artplayer(artBaseOption);
|
||||
expect(art).to.be.an('object');
|
||||
expect(art.id).to.equal(1);
|
||||
});
|
||||
|
||||
it('Throw error when multiple instances on the same dom element', function() {
|
||||
@@ -24,4 +20,12 @@ describe('Detect registration status', function() {
|
||||
new Artplayer(artBaseOption);
|
||||
}).to.throw(/Cannot mount multiple instances on the same dom element/);
|
||||
});
|
||||
|
||||
it('Destroy all instances', function() {
|
||||
expect(Artplayer.instances.length).to.equal(1);
|
||||
Artplayer.instances.forEach(art => {
|
||||
art.destroy(true);
|
||||
});
|
||||
expect(Artplayer.instances.length).to.equal(0);
|
||||
});
|
||||
});
|
||||
Reference in new issue
Block a user