mirror of
https://github.com/zhw2590582/ArtPlayer.git
synced 2026-10-20 04:01:20 -08:00
完成build脚本
This commit is contained in:
1 parent
cc2027832e
commit
00b51c32ba
18 files changed
+84
-123
No files matched your search
@@ -1,33 +0,0 @@
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<title>Mocha Tests</title>
|
||||
<link href="https://unpkg.com/mocha@5.2.0/mocha.css" rel="stylesheet" />
|
||||
<link href="../uncompiled/artplayer.css" rel="stylesheet" />
|
||||
<style>
|
||||
.artplayer-app {
|
||||
width: 400px;
|
||||
height: 300px;
|
||||
margin: 20px auto;
|
||||
opacity: 0.1;
|
||||
background: #000;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div class="artplayer-app"></div>
|
||||
<div id="mocha"></div>
|
||||
<script src="https://unpkg.com/chai/chai.js"></script>
|
||||
<script src="https://unpkg.com/mocha@5.2.0/mocha.js"></script>
|
||||
<script>
|
||||
window.mocha.setup('bdd');
|
||||
window.expect = window.chai.expect;
|
||||
</script>
|
||||
<script src="../compiled/artplayer.js"></script>
|
||||
<script src="./index.test.js"></script>
|
||||
<script>
|
||||
mocha.checkLeaks();
|
||||
mocha.run();
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
@@ -1,31 +0,0 @@
|
||||
var artBaseOption = {
|
||||
container: document.querySelector('.artplayer-app'),
|
||||
url: 'https://blog.zhw-island.com/assets-cdn/video/one-more-time-one-more-chance-480p.mp4',
|
||||
};
|
||||
|
||||
describe('Detect registration status', function() {
|
||||
it('Constructor is a global variable', function() {
|
||||
expect(Artplayer).to.be.an('function');
|
||||
expect(Artplayer.instances).to.be.an('array');
|
||||
});
|
||||
|
||||
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() {
|
||||
expect(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