diff --git a/scripts/createTests.js b/scripts/createTests.js index 2c80b6f34..75348ae6b 100644 --- a/scripts/createTests.js +++ b/scripts/createTests.js @@ -1,13 +1,13 @@ -const fs = require('fs'); -const path = require('path'); -const glob = require('glob'); -const { parse } = require('node-html-parser'); -const prettier = require('prettier'); +import glob from 'glob'; +import { join } from 'path'; +import { parse } from 'node-html-parser'; +import { format as _format } from 'prettier'; +import { readFileSync, writeFileSync } from 'fs'; const htmls = glob - .sync(path.join(process.cwd(), 'docs/document/zh-cn/**/*.html')) + .sync(join(process.cwd(), 'docs/document/zh-cn/**/*.html')) .filter((item) => !item.includes('libraries')) - .map((item) => fs.readFileSync(item, 'utf-8')) + .map((item) => readFileSync(item, 'utf-8')) .map((item) => parse(item, { lowerCaseTagName: false, @@ -78,5 +78,5 @@ describe('Document', function() { }); `; -const format = prettier.format(tests, { semi: true, parser: 'babel' }); -fs.writeFileSync(path.join(process.cwd(), 'test/document.test.js'), format); +const format = _format(tests, { semi: true, parser: 'babel' }); +writeFileSync(join(process.cwd(), 'test/document.test.js'), format); diff --git a/test/document.test.js b/test/document.test.js index c0b5379ac..e0e40b562 100644 --- a/test/document.test.js +++ b/test/document.test.js @@ -1239,6 +1239,16 @@ describe("Document", function () { }); it("Test76", function (done) { + var art = new Artplayer({ + container: ".artplayer-app", + url: "./assets/sample/video.mp4", + fastForward: true, + }); + + testAll(art, done); + }); + + it("Test77", function (done) { var art = new Artplayer({ container: ".artplayer-app", url: "./assets/sample/video.mp4", @@ -1250,7 +1260,17 @@ describe("Document", function () { testAll(art, done); }); - it("Test77", function (done) { + it("Test78", function (done) { + var art = new Artplayer({ + container: ".artplayer-app", + url: "./assets/sample/video.mp4", + autoOrientation: true, + }); + + testAll(art, done); + }); + + it("Test79", function (done) { var art = new Artplayer({ container: ".artplayer-app", url: "./assets/sample/video.mp4", @@ -1320,7 +1340,7 @@ describe("Document", function () { testAll(art, done); }); - it("Test78", function (done) { + it("Test80", function (done) { var art = new Artplayer({ container: ".artplayer-app", url: "./assets/sample/video.mp4", @@ -1336,7 +1356,7 @@ describe("Document", function () { testAll(art, done); }); - it("Test79", function (done) { + it("Test81", function (done) { var art = new Artplayer({ container: ".artplayer-app", url: "./assets/sample/video.mp4", @@ -1374,7 +1394,7 @@ describe("Document", function () { testAll(art, done); }); - it("Test80", function (done) { + it("Test82", function (done) { var art = new Artplayer({ container: ".artplayer-app", url: "./assets/sample/video.mp4", @@ -1409,7 +1429,7 @@ describe("Document", function () { testAll(art, done); }); - it("Test81", function (done) { + it("Test83", function (done) { var art = new Artplayer({ container: ".artplayer-app", url: "./assets/sample/video.mp4", @@ -1442,7 +1462,7 @@ describe("Document", function () { testAll(art, done); }); - it("Test82", function (done) { + it("Test84", function (done) { var art = new Artplayer({ container: ".artplayer-app", url: "./assets/sample/video.mp4", @@ -1479,7 +1499,7 @@ describe("Document", function () { testAll(art, done); }); - it("Test83", function (done) { + it("Test85", function (done) { var art = new Artplayer({ container: ".artplayer-app", url: "./assets/sample/video.mp4", @@ -1516,7 +1536,7 @@ describe("Document", function () { testAll(art, done); }); - it("Test84", function (done) { + it("Test86", function (done) { var art = new Artplayer({ container: ".artplayer-app", url: "./assets/sample/video.mp4", @@ -1529,7 +1549,7 @@ describe("Document", function () { testAll(art, done); }); - it("Test85", function (done) { + it("Test87", function (done) { var art = new Artplayer({ container: ".artplayer-app", url: "./assets/sample/video.mp4", @@ -1545,7 +1565,7 @@ describe("Document", function () { testAll(art, done); }); - it("Test86", function (done) { + it("Test88", function (done) { var art = new Artplayer({ container: ".artplayer-app", url: "./assets/sample/video.mp4", @@ -1561,7 +1581,7 @@ describe("Document", function () { testAll(art, done); }); - it("Test87", function (done) { + it("Test89", function (done) { var art = new Artplayer({ container: ".artplayer-app", url: "./assets/sample/video.mp4", @@ -1573,7 +1593,7 @@ describe("Document", function () { testAll(art, done); }); - it("Test88", function (done) { + it("Test90", function (done) { var art = new Artplayer({ container: ".artplayer-app", url: "./assets/sample/video.mp4", @@ -1585,7 +1605,7 @@ describe("Document", function () { testAll(art, done); }); - it("Test89", function (done) { + it("Test91", function (done) { var art = new Artplayer({ container: ".artplayer-app", url: "./assets/sample/video.mp4", @@ -1600,7 +1620,7 @@ describe("Document", function () { testAll(art, done); }); - it("Test90", function (done) { + it("Test92", function (done) { var art = new Artplayer({ container: ".artplayer-app", url: "./assets/sample/video.mp4", @@ -1614,7 +1634,7 @@ describe("Document", function () { testAll(art, done); }); - it("Test91", function (done) { + it("Test93", function (done) { var art = new Artplayer({ container: ".artplayer-app", url: "./assets/sample/video.mp4", @@ -1628,7 +1648,7 @@ describe("Document", function () { testAll(art, done); }); - it("Test92", function (done) { + it("Test94", function (done) { var art = new Artplayer({ container: ".artplayer-app", url: "./assets/sample/video.mp4", @@ -1643,7 +1663,7 @@ describe("Document", function () { testAll(art, done); }); - it("Test93", function (done) { + it("Test95", function (done) { var art = new Artplayer({ container: ".artplayer-app", url: "./assets/sample/video.mp4", @@ -1658,7 +1678,7 @@ describe("Document", function () { testAll(art, done); }); - it("Test94", function (done) { + it("Test96", function (done) { var art = new Artplayer({ container: ".artplayer-app", url: "./assets/sample/video.mp4", @@ -1672,7 +1692,7 @@ describe("Document", function () { testAll(art, done); }); - it("Test95", function (done) { + it("Test97", function (done) { var art = new Artplayer({ container: ".artplayer-app", url: "./assets/sample/video.mp4", @@ -1686,7 +1706,7 @@ describe("Document", function () { testAll(art, done); }); - it("Test96", function (done) { + it("Test98", function (done) { var art = new Artplayer({ container: ".artplayer-app", url: "./assets/sample/video.mp4", @@ -1698,7 +1718,7 @@ describe("Document", function () { testAll(art, done); }); - it("Test97", function (done) { + it("Test99", function (done) { var art = new Artplayer({ container: ".artplayer-app", url: "./assets/sample/video.mp4", @@ -1713,7 +1733,7 @@ describe("Document", function () { testAll(art, done); }); - it("Test98", function (done) { + it("Test100", function (done) { var art = new Artplayer({ container: ".artplayer-app", url: "./assets/sample/video.mp4", @@ -1726,7 +1746,7 @@ describe("Document", function () { testAll(art, done); }); - it("Test99", function (done) { + it("Test101", function (done) { var art = new Artplayer({ container: ".artplayer-app", url: "./assets/sample/video.mp4", @@ -1739,7 +1759,7 @@ describe("Document", function () { testAll(art, done); }); - it("Test100", function (done) { + it("Test102", function (done) { var art = new Artplayer({ container: ".artplayer-app", url: "./assets/sample/video.mp4", @@ -1755,7 +1775,7 @@ describe("Document", function () { testAll(art, done); }); - it("Test101", function (done) { + it("Test103", function (done) { var art = new Artplayer({ container: ".artplayer-app", url: "./assets/sample/video.mp4", @@ -1771,7 +1791,7 @@ describe("Document", function () { testAll(art, done); }); - it("Test102", function (done) { + it("Test104", function (done) { var art = new Artplayer({ container: ".artplayer-app", url: "./assets/sample/video.mp4", @@ -1787,7 +1807,7 @@ describe("Document", function () { testAll(art, done); }); - it("Test103", function (done) { + it("Test105", function (done) { var art = new Artplayer({ container: ".artplayer-app", url: "./assets/sample/video.mp4", @@ -1802,7 +1822,7 @@ describe("Document", function () { testAll(art, done); }); - it("Test104", function (done) { + it("Test106", function (done) { var art = new Artplayer({ container: ".artplayer-app", url: "./assets/sample/video.mp4", @@ -1814,7 +1834,7 @@ describe("Document", function () { testAll(art, done); }); - it("Test105", function (done) { + it("Test107", function (done) { var art = new Artplayer({ container: ".artplayer-app", url: "./assets/sample/video.mp4", @@ -1829,7 +1849,7 @@ describe("Document", function () { testAll(art, done); }); - it("Test106", function (done) { + it("Test108", function (done) { var art = new Artplayer({ container: ".artplayer-app", url: "./assets/sample/video.mp4", @@ -1843,7 +1863,7 @@ describe("Document", function () { testAll(art, done); }); - it("Test107", function (done) { + it("Test109", function (done) { var art = new Artplayer({ container: ".artplayer-app", url: "./assets/sample/video.mp4", @@ -1855,7 +1875,7 @@ describe("Document", function () { testAll(art, done); }); - it("Test108", function (done) { + it("Test110", function (done) { var art = new Artplayer({ container: ".artplayer-app", url: "./assets/sample/video.mp4", @@ -1869,7 +1889,7 @@ describe("Document", function () { testAll(art, done); }); - it("Test109", function (done) { + it("Test111", function (done) { var art = new Artplayer({ container: ".artplayer-app", url: "./assets/sample/video.mp4", @@ -1884,7 +1904,7 @@ describe("Document", function () { testAll(art, done); }); - it("Test110", function (done) { + it("Test112", function (done) { var art = new Artplayer({ container: ".artplayer-app", url: "./assets/sample/video.mp4", @@ -1898,7 +1918,7 @@ describe("Document", function () { testAll(art, done); }); - it("Test111", function (done) { + it("Test113", function (done) { var art = new Artplayer({ container: ".artplayer-app", url: "./assets/sample/video.mp4", @@ -1912,7 +1932,7 @@ describe("Document", function () { testAll(art, done); }); - it("Test112", function (done) { + it("Test114", function (done) { var art = new Artplayer({ container: ".artplayer-app", url: "./assets/sample/video.mp4", @@ -1926,7 +1946,7 @@ describe("Document", function () { testAll(art, done); }); - it("Test113", function (done) { + it("Test115", function (done) { var art = new Artplayer({ container: ".artplayer-app", url: "./assets/sample/video.mp4", @@ -1940,7 +1960,7 @@ describe("Document", function () { testAll(art, done); }); - it("Test114", function (done) { + it("Test116", function (done) { var art = new Artplayer({ container: ".artplayer-app", url: "./assets/sample/video.mp4", @@ -1954,7 +1974,7 @@ describe("Document", function () { testAll(art, done); }); - it("Test115", function (done) { + it("Test117", function (done) { var art = new Artplayer({ container: ".artplayer-app", url: "./assets/sample/video.mp4", @@ -1968,7 +1988,7 @@ describe("Document", function () { testAll(art, done); }); - it("Test116", function (done) { + it("Test118", function (done) { var art = new Artplayer({ container: ".artplayer-app", url: "./assets/sample/video.mp4", @@ -1982,7 +2002,7 @@ describe("Document", function () { testAll(art, done); }); - it("Test117", function (done) { + it("Test119", function (done) { var art = new Artplayer({ container: ".artplayer-app", url: "./assets/sample/video.mp4", @@ -1994,7 +2014,7 @@ describe("Document", function () { testAll(art, done); }); - it("Test118", function (done) { + it("Test120", function (done) { var art = new Artplayer({ container: ".artplayer-app", url: "./assets/sample/video.mp4", @@ -2034,7 +2054,7 @@ describe("Document", function () { testAll(art, done); }); - it("Test119", function (done) { + it("Test121", function (done) { var art = new Artplayer({ container: ".artplayer-app", url: "./assets/sample/video.mp4", @@ -2083,7 +2103,7 @@ describe("Document", function () { testAll(art, done); }); - it("Test120", function (done) { + it("Test122", function (done) { var art = new Artplayer({ container: ".artplayer-app", url: "./assets/sample/video.mp4", @@ -2205,7 +2225,7 @@ describe("Document", function () { testAll(art, done); }); - it("Test121", function (done) { + it("Test123", function (done) { var art = new Artplayer({ container: ".artplayer-app", url: "https://artplayer.org./assets/sample/video.mp4",