add lisp packages
This commit is contained in:
5
lisp/emacs-application-framework/app/js-video-player/node_modules/loadjs/test/assets/asyncfalse1.js
generated
vendored
Normal file
5
lisp/emacs-application-framework/app/js-video-player/node_modules/loadjs/test/assets/asyncfalse1.js
generated
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
if (pathsLoaded['asyncfalse2.js'] === undefined) {
|
||||
pathsLoaded['asyncfalse1.js'] = true;
|
||||
} else {
|
||||
pathsLoaded['asyncfalse1.js'] = false;
|
||||
}
|
||||
5
lisp/emacs-application-framework/app/js-video-player/node_modules/loadjs/test/assets/asyncfalse2.js
generated
vendored
Normal file
5
lisp/emacs-application-framework/app/js-video-player/node_modules/loadjs/test/assets/asyncfalse2.js
generated
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
if (pathsLoaded['asyncfalse1.js'] === undefined) {
|
||||
pathsLoaded['asyncfalse2.js'] = true;
|
||||
} else {
|
||||
pathsLoaded['asyncfalse2.js'] = false;
|
||||
}
|
||||
3
lisp/emacs-application-framework/app/js-video-player/node_modules/loadjs/test/assets/cssfile.custom
generated
vendored
Normal file
3
lisp/emacs-application-framework/app/js-video-player/node_modules/loadjs/test/assets/cssfile.custom
generated
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
.test-div {
|
||||
width: 300px;
|
||||
}
|
||||
3
lisp/emacs-application-framework/app/js-video-player/node_modules/loadjs/test/assets/file1.css
generated
vendored
Normal file
3
lisp/emacs-application-framework/app/js-video-player/node_modules/loadjs/test/assets/file1.css
generated
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
.test-div {
|
||||
width: 100px;
|
||||
}
|
||||
1
lisp/emacs-application-framework/app/js-video-player/node_modules/loadjs/test/assets/file1.js
generated
vendored
Normal file
1
lisp/emacs-application-framework/app/js-video-player/node_modules/loadjs/test/assets/file1.js
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
pathsLoaded['file1.js'] = true;
|
||||
3
lisp/emacs-application-framework/app/js-video-player/node_modules/loadjs/test/assets/file2.css
generated
vendored
Normal file
3
lisp/emacs-application-framework/app/js-video-player/node_modules/loadjs/test/assets/file2.css
generated
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
.test-div {
|
||||
width: 200px;
|
||||
}
|
||||
1
lisp/emacs-application-framework/app/js-video-player/node_modules/loadjs/test/assets/file2.js
generated
vendored
Normal file
1
lisp/emacs-application-framework/app/js-video-player/node_modules/loadjs/test/assets/file2.js
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
pathsLoaded['file2.js'] = true;
|
||||
BIN
lisp/emacs-application-framework/app/js-video-player/node_modules/loadjs/test/assets/flash.gif
generated
vendored
Normal file
BIN
lisp/emacs-application-framework/app/js-video-player/node_modules/loadjs/test/assets/flash.gif
generated
vendored
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 2.1 KiB |
BIN
lisp/emacs-application-framework/app/js-video-player/node_modules/loadjs/test/assets/flash.jpg
generated
vendored
Normal file
BIN
lisp/emacs-application-framework/app/js-video-player/node_modules/loadjs/test/assets/flash.jpg
generated
vendored
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 2.6 KiB |
BIN
lisp/emacs-application-framework/app/js-video-player/node_modules/loadjs/test/assets/flash.png
generated
vendored
Normal file
BIN
lisp/emacs-application-framework/app/js-video-player/node_modules/loadjs/test/assets/flash.png
generated
vendored
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 2.2 KiB |
14
lisp/emacs-application-framework/app/js-video-player/node_modules/loadjs/test/assets/flash.svg
generated
vendored
Normal file
14
lisp/emacs-application-framework/app/js-video-player/node_modules/loadjs/test/assets/flash.svg
generated
vendored
Normal file
@@ -0,0 +1,14 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<svg width="1024px" height="1024px" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:sketch="http://www.bohemiancoding.com/sketch/ns">
|
||||
<!-- Generator: Sketch 3.3.2 (12043) - http://www.bohemiancoding.com/sketch -->
|
||||
<title>iTunesArtwork@2x</title>
|
||||
<desc>Created with Sketch.</desc>
|
||||
<defs></defs>
|
||||
<g id="Page-1" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd" sketch:type="MSPage">
|
||||
<g id="Size-Guides" sketch:type="MSLayerGroup" transform="translate(0.000000, -124.000000)"></g>
|
||||
<g id="iTunesArtwork@2x" sketch:type="MSArtboardGroup">
|
||||
<path d="M357.009067,0 L666.990933,0 C769.792,0 821.179733,0 876.5184,17.4933333 C936.9344,39.4837333 984.516267,87.0656 1006.50667,147.4816 C1024,202.811733 1024,254.216533 1024,357.009067 L1024,666.990933 C1024,769.792 1024,821.179733 1006.50667,876.5184 C984.516267,936.9344 936.9344,984.516267 876.5184,1006.49813 C821.179733,1024 769.792,1024 666.990933,1024 L357.009067,1024 C254.208,1024 202.811733,1024 147.4816,1006.49813 C87.0656,984.516267 39.4837333,936.9344 17.4933333,876.5184 C0,821.179733 0,769.792 0,666.990933 L0,357.009067 C0,254.216533 0,202.811733 17.4933333,147.4816 C39.4837333,87.0656 87.0656,39.4837333 147.4816,17.4933333 C202.811733,0 254.208,0 357.009067,0 L357.009067,0" id="Icon-Shape" fill="#D7D7D7" sketch:type="MSShapeGroup"></path>
|
||||
<path d="M692.497264,349.385524 C697.470239,354.906145 698.437452,360.978828 695.398902,367.603573 L471.813752,846.652148 C468.227556,853.550716 462.428696,857 454.417171,857 C453.313047,857 451.378621,856.721761 448.613894,856.165282 C443.923575,854.787335 440.403627,852.163936 438.05405,848.295085 C435.704474,844.426234 435.081748,840.28356 436.185872,835.867063 L517.749735,501.31743 L349.640201,543.132822 C348.536077,543.406645 346.87989,543.543556 344.671642,543.543556 C339.698667,543.543556 335.419081,542.024281 331.832886,538.985731 C326.85991,534.843057 325.066813,529.459348 326.453593,522.834603 L409.673642,181.24949 C410.777766,177.380639 412.986014,174.205178 416.298387,171.723107 C419.61076,169.241036 423.475194,168 427.891691,168 L563.698968,168 C568.945766,168 573.362263,169.72685 576.948458,173.180551 C580.534654,176.634251 582.327751,180.706261 582.327751,185.396581 C582.327751,187.604829 581.638778,190.091317 580.260831,192.856044 L509.455554,384.562921 L673.417998,343.979732 C675.626246,343.423253 677.282433,343.145014 678.386557,343.145014 C683.633355,343.145014 688.328091,345.216351 692.470765,349.359025 L692.497264,349.385524 Z" id="Shape" fill="#C62828" sketch:type="MSShapeGroup"></path>
|
||||
</g>
|
||||
</g>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 2.7 KiB |
BIN
lisp/emacs-application-framework/app/js-video-player/node_modules/loadjs/test/assets/flash.webp
generated
vendored
Normal file
BIN
lisp/emacs-application-framework/app/js-video-player/node_modules/loadjs/test/assets/flash.webp
generated
vendored
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 908 B |
308
lisp/emacs-application-framework/app/js-video-player/node_modules/loadjs/test/assets/loadjs/loadjs.js
generated
vendored
Normal file
308
lisp/emacs-application-framework/app/js-video-player/node_modules/loadjs/test/assets/loadjs/loadjs.js
generated
vendored
Normal file
@@ -0,0 +1,308 @@
|
||||
loadjs = (function () {
|
||||
/**
|
||||
* Global dependencies.
|
||||
* @global {Object} document - DOM
|
||||
*/
|
||||
|
||||
var devnull = function() {},
|
||||
bundleIdCache = {},
|
||||
bundleResultCache = {},
|
||||
bundleCallbackQueue = {};
|
||||
|
||||
|
||||
/**
|
||||
* Subscribe to bundle load event.
|
||||
* @param {string[]} bundleIds - Bundle ids
|
||||
* @param {Function} callbackFn - The callback function
|
||||
*/
|
||||
function subscribe(bundleIds, callbackFn) {
|
||||
// listify
|
||||
bundleIds = bundleIds.push ? bundleIds : [bundleIds];
|
||||
|
||||
var depsNotFound = [],
|
||||
i = bundleIds.length,
|
||||
numWaiting = i,
|
||||
fn,
|
||||
bundleId,
|
||||
r,
|
||||
q;
|
||||
|
||||
// define callback function
|
||||
fn = function (bundleId, pathsNotFound) {
|
||||
if (pathsNotFound.length) depsNotFound.push(bundleId);
|
||||
|
||||
numWaiting--;
|
||||
if (!numWaiting) callbackFn(depsNotFound);
|
||||
};
|
||||
|
||||
// register callback
|
||||
while (i--) {
|
||||
bundleId = bundleIds[i];
|
||||
|
||||
// execute callback if in result cache
|
||||
r = bundleResultCache[bundleId];
|
||||
if (r) {
|
||||
fn(bundleId, r);
|
||||
continue;
|
||||
}
|
||||
|
||||
// add to callback queue
|
||||
q = bundleCallbackQueue[bundleId] = bundleCallbackQueue[bundleId] || [];
|
||||
q.push(fn);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Publish bundle load event.
|
||||
* @param {string} bundleId - Bundle id
|
||||
* @param {string[]} pathsNotFound - List of files not found
|
||||
*/
|
||||
function publish(bundleId, pathsNotFound) {
|
||||
// exit if id isn't defined
|
||||
if (!bundleId) return;
|
||||
|
||||
var q = bundleCallbackQueue[bundleId];
|
||||
|
||||
// cache result
|
||||
bundleResultCache[bundleId] = pathsNotFound;
|
||||
|
||||
// exit if queue is empty
|
||||
if (!q) return;
|
||||
|
||||
// empty callback queue
|
||||
while (q.length) {
|
||||
q[0](bundleId, pathsNotFound);
|
||||
q.splice(0, 1);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Execute callbacks.
|
||||
* @param {Object or Function} args - The callback args
|
||||
* @param {string[]} depsNotFound - List of dependencies not found
|
||||
*/
|
||||
function executeCallbacks(args, depsNotFound) {
|
||||
// accept function as argument
|
||||
if (args.call) args = {success: args};
|
||||
|
||||
// success and error callbacks
|
||||
if (depsNotFound.length) (args.error || devnull)(depsNotFound);
|
||||
else (args.success || devnull)(args);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Load individual file.
|
||||
* @param {string} path - The file path
|
||||
* @param {Function} callbackFn - The callback function
|
||||
*/
|
||||
function loadFile(path, callbackFn, args, numTries) {
|
||||
var doc = document,
|
||||
async = args.async,
|
||||
maxTries = (args.numRetries || 0) + 1,
|
||||
beforeCallbackFn = args.before || devnull,
|
||||
pathname = path.replace(/[\?|#].*$/, ''),
|
||||
pathStripped = path.replace(/^(css|img)!/, ''),
|
||||
isLegacyIECss,
|
||||
e;
|
||||
|
||||
numTries = numTries || 0;
|
||||
|
||||
if (/(^css!|\.css$)/.test(pathname)) {
|
||||
// css
|
||||
e = doc.createElement('link');
|
||||
e.rel = 'stylesheet';
|
||||
e.href = pathStripped;
|
||||
|
||||
// tag IE9+
|
||||
isLegacyIECss = 'hideFocus' in e;
|
||||
|
||||
// use preload in IE Edge (to detect load errors)
|
||||
if (isLegacyIECss && e.relList) {
|
||||
isLegacyIECss = 0;
|
||||
e.rel = 'preload';
|
||||
e.as = 'style';
|
||||
}
|
||||
} else if (/(^img!|\.(png|gif|jpg|svg|webp)$)/.test(pathname)) {
|
||||
// image
|
||||
e = doc.createElement('img');
|
||||
e.src = pathStripped;
|
||||
} else {
|
||||
// javascript
|
||||
e = doc.createElement('script');
|
||||
e.src = path;
|
||||
e.async = async === undefined ? true : async;
|
||||
}
|
||||
|
||||
e.onload = e.onerror = e.onbeforeload = function (ev) {
|
||||
var result = ev.type[0];
|
||||
|
||||
// treat empty stylesheets as failures to get around lack of onerror
|
||||
// support in IE9-11
|
||||
if (isLegacyIECss) {
|
||||
try {
|
||||
if (!e.sheet.cssText.length) result = 'e';
|
||||
} catch (x) {
|
||||
// sheets objects created from load errors don't allow access to
|
||||
// `cssText` (unless error is Code:18 SecurityError)
|
||||
if (x.code != 18) result = 'e';
|
||||
}
|
||||
}
|
||||
|
||||
// handle retries in case of load failure
|
||||
if (result == 'e') {
|
||||
// increment counter
|
||||
numTries += 1;
|
||||
|
||||
// exit function and try again
|
||||
if (numTries < maxTries) {
|
||||
return loadFile(path, callbackFn, args, numTries);
|
||||
}
|
||||
} else if (e.rel == 'preload' && e.as == 'style') {
|
||||
// activate preloaded stylesheets
|
||||
return e.rel = 'stylesheet'; // jshint ignore:line
|
||||
}
|
||||
|
||||
// execute callback
|
||||
callbackFn(path, result, ev.defaultPrevented);
|
||||
};
|
||||
|
||||
// add to document (unless callback returns `false`)
|
||||
if (beforeCallbackFn(path, e) !== false) doc.head.appendChild(e);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Load multiple files.
|
||||
* @param {string[]} paths - The file paths
|
||||
* @param {Function} callbackFn - The callback function
|
||||
*/
|
||||
function loadFiles(paths, callbackFn, args) {
|
||||
// listify paths
|
||||
paths = paths.push ? paths : [paths];
|
||||
|
||||
var numWaiting = paths.length,
|
||||
x = numWaiting,
|
||||
pathsNotFound = [],
|
||||
fn,
|
||||
i;
|
||||
|
||||
// define callback function
|
||||
fn = function(path, result, defaultPrevented) {
|
||||
// handle error
|
||||
if (result == 'e') pathsNotFound.push(path);
|
||||
|
||||
// handle beforeload event. If defaultPrevented then that means the load
|
||||
// will be blocked (ex. Ghostery/ABP on Safari)
|
||||
if (result == 'b') {
|
||||
if (defaultPrevented) pathsNotFound.push(path);
|
||||
else return;
|
||||
}
|
||||
|
||||
numWaiting--;
|
||||
if (!numWaiting) callbackFn(pathsNotFound);
|
||||
};
|
||||
|
||||
// load scripts
|
||||
for (i=0; i < x; i++) loadFile(paths[i], fn, args);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Initiate script load and register bundle.
|
||||
* @param {(string|string[])} paths - The file paths
|
||||
* @param {(string|Function|Object)} [arg1] - The (1) bundleId or (2) success
|
||||
* callback or (3) object literal with success/error arguments, numRetries,
|
||||
* etc.
|
||||
* @param {(Function|Object)} [arg2] - The (1) success callback or (2) object
|
||||
* literal with success/error arguments, numRetries, etc.
|
||||
*/
|
||||
function loadjs(paths, arg1, arg2) {
|
||||
var bundleId,
|
||||
args;
|
||||
|
||||
// bundleId (if string)
|
||||
if (arg1 && arg1.trim) bundleId = arg1;
|
||||
|
||||
// args (default is {})
|
||||
args = (bundleId ? arg2 : arg1) || {};
|
||||
|
||||
// throw error if bundle is already defined
|
||||
if (bundleId) {
|
||||
if (bundleId in bundleIdCache) {
|
||||
throw "LoadJS";
|
||||
} else {
|
||||
bundleIdCache[bundleId] = true;
|
||||
}
|
||||
}
|
||||
|
||||
function loadFn(resolve, reject) {
|
||||
loadFiles(paths, function (pathsNotFound) {
|
||||
// execute callbacks
|
||||
executeCallbacks(args, pathsNotFound);
|
||||
|
||||
// resolve Promise
|
||||
if (resolve) {
|
||||
executeCallbacks({success: resolve, error: reject}, pathsNotFound);
|
||||
}
|
||||
|
||||
// publish bundle load event
|
||||
publish(bundleId, pathsNotFound);
|
||||
}, args);
|
||||
}
|
||||
|
||||
if (args.returnPromise) return new Promise(loadFn);
|
||||
else loadFn();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Execute callbacks when dependencies have been satisfied.
|
||||
* @param {(string|string[])} deps - List of bundle ids
|
||||
* @param {Object} args - success/error arguments
|
||||
*/
|
||||
loadjs.ready = function ready(deps, args) {
|
||||
// subscribe to bundle load event
|
||||
subscribe(deps, function (depsNotFound) {
|
||||
// execute callbacks
|
||||
executeCallbacks(args, depsNotFound);
|
||||
});
|
||||
|
||||
return loadjs;
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Manually satisfy bundle dependencies.
|
||||
* @param {string} bundleId - The bundle id
|
||||
*/
|
||||
loadjs.done = function done(bundleId) {
|
||||
publish(bundleId, []);
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Reset loadjs dependencies statuses
|
||||
*/
|
||||
loadjs.reset = function reset() {
|
||||
bundleIdCache = {};
|
||||
bundleResultCache = {};
|
||||
bundleCallbackQueue = {};
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Determine if bundle has already been defined
|
||||
* @param String} bundleId - The bundle id
|
||||
*/
|
||||
loadjs.isDefined = function isDefined(bundleId) {
|
||||
return bundleId in bundleIdCache;
|
||||
};
|
||||
|
||||
|
||||
// export
|
||||
return loadjs;
|
||||
|
||||
})();
|
||||
1
lisp/emacs-application-framework/app/js-video-player/node_modules/loadjs/test/assets/loadjs/loadjs.min.js
generated
vendored
Normal file
1
lisp/emacs-application-framework/app/js-video-player/node_modules/loadjs/test/assets/loadjs/loadjs.min.js
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
loadjs=function(){var h=function(){},c={},u={},f={};function o(e,n){if(e){var r=f[e];if(u[e]=n,r)for(;r.length;)r[0](e,n),r.splice(0,1)}}function l(e,n){e.call&&(e={success:e}),n.length?(e.error||h)(n):(e.success||h)(e)}function d(r,t,s,i){var c,o,e=document,n=s.async,u=(s.numRetries||0)+1,f=s.before||h,l=r.replace(/[\?|#].*$/,""),a=r.replace(/^(css|img)!/,"");i=i||0,/(^css!|\.css$)/.test(l)?((o=e.createElement("link")).rel="stylesheet",o.href=a,(c="hideFocus"in o)&&o.relList&&(c=0,o.rel="preload",o.as="style")):/(^img!|\.(png|gif|jpg|svg|webp)$)/.test(l)?(o=e.createElement("img")).src=a:((o=e.createElement("script")).src=r,o.async=void 0===n||n),!(o.onload=o.onerror=o.onbeforeload=function(e){var n=e.type[0];if(c)try{o.sheet.cssText.length||(n="e")}catch(e){18!=e.code&&(n="e")}if("e"==n){if((i+=1)<u)return d(r,t,s,i)}else if("preload"==o.rel&&"style"==o.as)return o.rel="stylesheet";t(r,n,e.defaultPrevented)})!==f(r,o)&&e.head.appendChild(o)}function r(e,n,r){var t,s;if(n&&n.trim&&(t=n),s=(t?r:n)||{},t){if(t in c)throw"LoadJS";c[t]=!0}function i(n,r){!function(e,t,n){var r,s,i=(e=e.push?e:[e]).length,c=i,o=[];for(r=function(e,n,r){if("e"==n&&o.push(e),"b"==n){if(!r)return;o.push(e)}--i||t(o)},s=0;s<c;s++)d(e[s],r,n)}(e,function(e){l(s,e),n&&l({success:n,error:r},e),o(t,e)},s)}if(s.returnPromise)return new Promise(i);i()}return r.ready=function(e,n){return function(e,r){e=e.push?e:[e];var n,t,s,i=[],c=e.length,o=c;for(n=function(e,n){n.length&&i.push(e),--o||r(i)};c--;)t=e[c],(s=u[t])?n(t,s):(f[t]=f[t]||[]).push(n)}(e,function(e){l(n,e)}),r},r.done=function(e){o(e,[])},r.reset=function(){c={},u={},f={}},r.isDefined=function(e){return e in c},r}();
|
||||
22
lisp/emacs-application-framework/app/js-video-player/node_modules/loadjs/test/index.html
generated
vendored
Normal file
22
lisp/emacs-application-framework/app/js-video-player/node_modules/loadjs/test/index.html
generated
vendored
Normal file
@@ -0,0 +1,22 @@
|
||||
<!doctype html>
|
||||
<html>
|
||||
<head>
|
||||
<title>Mocha</title>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<link rel="stylesheet" href="vendor/mocha-4.1.0/mocha.css">
|
||||
</head>
|
||||
<body>
|
||||
<div id="mocha"></div>
|
||||
<script src="vendor/mocha-4.1.0/mocha.js"></script>
|
||||
<script src="vendor/chai-4.1.2.js"></script>
|
||||
<script src="assets/loadjs/loadjs.js"></script>
|
||||
<script>mocha.setup('bdd')</script>
|
||||
<script src="tests.js"></script>
|
||||
<script>
|
||||
//mocha.checkLeaks();
|
||||
mocha.globals(['loadjs', 'pathsLoaded', 'script*']);
|
||||
mocha.run();
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
817
lisp/emacs-application-framework/app/js-video-player/node_modules/loadjs/test/tests.js
generated
vendored
Normal file
817
lisp/emacs-application-framework/app/js-video-player/node_modules/loadjs/test/tests.js
generated
vendored
Normal file
@@ -0,0 +1,817 @@
|
||||
/**
|
||||
* loadjs tests
|
||||
* @module test/tests.js
|
||||
*/
|
||||
|
||||
var pathsLoaded = null, // file register
|
||||
testEl = null,
|
||||
assert = chai.assert,
|
||||
expect = chai.expect;
|
||||
|
||||
|
||||
describe('LoadJS tests', function() {
|
||||
|
||||
beforeEach(function() {
|
||||
// reset register
|
||||
pathsLoaded = {};
|
||||
|
||||
// reset loadjs dependencies
|
||||
loadjs.reset();
|
||||
});
|
||||
|
||||
// ==========================================================================
|
||||
// JavaScript file loading tests
|
||||
// ==========================================================================
|
||||
|
||||
describe('JavaScript file loading tests', function() {
|
||||
|
||||
it('should call success callback on valid path', function(done) {
|
||||
loadjs(['assets/file1.js'], {
|
||||
success: function() {
|
||||
assert.equal(pathsLoaded['file1.js'], true);
|
||||
done();
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
it('should call error callback on invalid path', function(done) {
|
||||
loadjs(['assets/file-doesntexist.js'], {
|
||||
success: function() {
|
||||
throw "Executed success callback";
|
||||
},
|
||||
error: function(pathsNotFound) {
|
||||
assert.equal(pathsNotFound.length, 1);
|
||||
assert.equal(pathsNotFound[0], 'assets/file-doesntexist.js');
|
||||
done();
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
it('should call before callback before embedding into document', function(done) {
|
||||
var scriptTags = [];
|
||||
|
||||
loadjs(['assets/file1.js', 'assets/file2.js'], {
|
||||
before: function(path, el) {
|
||||
scriptTags.push({
|
||||
path: path,
|
||||
el: el
|
||||
});
|
||||
|
||||
// add cross origin script for file2
|
||||
if (path === 'assets/file2.js') {
|
||||
el.crossOrigin = 'anonymous';
|
||||
}
|
||||
},
|
||||
success: function() {
|
||||
assert.equal(scriptTags[0].path, 'assets/file1.js');
|
||||
assert.equal(scriptTags[1].path, 'assets/file2.js');
|
||||
|
||||
assert.equal(scriptTags[0].el.crossOrigin, undefined);
|
||||
assert.equal(scriptTags[1].el.crossOrigin, 'anonymous');
|
||||
|
||||
done();
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
it('should bypass insertion if before returns `false`', function(done) {
|
||||
loadjs(['assets/file1.js'], {
|
||||
before: function(path, el) {
|
||||
// append to body (instead of head)
|
||||
document.body.appendChild(el);
|
||||
|
||||
// return `false` to bypass default DOM insertion
|
||||
return false;
|
||||
},
|
||||
success: function() {
|
||||
assert.equal(pathsLoaded['file1.js'], true);
|
||||
|
||||
// verify that file was added to body
|
||||
var els = document.body.querySelectorAll('script'),
|
||||
el;
|
||||
|
||||
for (var i=0; i < els.length; i++) {
|
||||
el = els[i];
|
||||
if (el.src.indexOf('assets/file1.js') !== -1) done();
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
it('should call success callback on two valid paths', function(done) {
|
||||
loadjs(['assets/file1.js', 'assets/file2.js'], {
|
||||
success: function() {
|
||||
assert.equal(pathsLoaded['file1.js'], true);
|
||||
assert.equal(pathsLoaded['file2.js'], true);
|
||||
done();
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
it('should call error callback on one invalid path', function(done) {
|
||||
loadjs(['assets/file1.js', 'assets/file-doesntexist.js'], {
|
||||
success: function() {
|
||||
throw "Executed success callback";
|
||||
},
|
||||
error: function(pathsNotFound) {
|
||||
assert.equal(pathsLoaded['file1.js'], true);
|
||||
assert.equal(pathsNotFound.length, 1);
|
||||
assert.equal(pathsNotFound[0], 'assets/file-doesntexist.js');
|
||||
done();
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
it('should support async false', function(done) {
|
||||
this.timeout(5000);
|
||||
|
||||
var numCompleted = 0,
|
||||
numTests = 20,
|
||||
paths = ['assets/asyncfalse1.js', 'assets/asyncfalse2.js'];
|
||||
|
||||
// run tests sequentially
|
||||
var testFn = function(paths) {
|
||||
// add cache busters
|
||||
var pathsUncached = paths.slice(0);
|
||||
pathsUncached[0] += '?_=' + Math.random();
|
||||
pathsUncached[1] += '?_=' + Math.random();
|
||||
|
||||
loadjs(pathsUncached, {
|
||||
success: function() {
|
||||
var f1 = paths[0].replace('assets/', '');
|
||||
var f2 = paths[1].replace('assets/', '');
|
||||
|
||||
// check load order
|
||||
assert.isTrue(pathsLoaded[f1]);
|
||||
assert.isFalse(pathsLoaded[f2]);
|
||||
|
||||
// increment tests
|
||||
numCompleted += 1;
|
||||
|
||||
if (numCompleted === numTests) {
|
||||
// exit
|
||||
done();
|
||||
} else {
|
||||
// reset register
|
||||
pathsLoaded = {};
|
||||
|
||||
// run test again
|
||||
paths.reverse();
|
||||
testFn(paths);
|
||||
}
|
||||
},
|
||||
async: false
|
||||
});
|
||||
};
|
||||
|
||||
// run tests
|
||||
testFn(paths);
|
||||
});
|
||||
|
||||
|
||||
it('should support multiple tries', function(done) {
|
||||
loadjs('assets/file-numretries.js', {
|
||||
error: function() {
|
||||
// check number of scripts in document
|
||||
var selector = 'script[src="assets/file-numretries.js"]',
|
||||
scripts = document.querySelectorAll(selector);
|
||||
if (scripts.length === 2) done();
|
||||
},
|
||||
numRetries: 1
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
// Un-'x' this for testing ad blocked scripts.
|
||||
// Ghostery: Disallow "Google Adservices"
|
||||
// AdBlock Plus: Add "www.googletagservices.com/tag/js/gpt.js" as a
|
||||
// custom filter under Options
|
||||
//
|
||||
xit('it should report ad blocked scripts as missing', function(done) {
|
||||
var s1 = 'https://www.googletagservices.com/tag/js/gpt.js',
|
||||
s2 = 'https://munchkin.marketo.net/munchkin-beta.js';
|
||||
|
||||
loadjs([s1, s2, 'assets/file1.js'], {
|
||||
success: function() {
|
||||
throw new Error('Executed success callback');
|
||||
},
|
||||
error: function(pathsNotFound) {
|
||||
assert.equal(pathsLoaded['file1.js'], true);
|
||||
assert.equal(pathsNotFound.length, 2);
|
||||
assert.equal(pathsNotFound[0], s1);
|
||||
assert.equal(pathsNotFound[1], s2);
|
||||
done();
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
// ==========================================================================
|
||||
// CSS file loading tests
|
||||
// ==========================================================================
|
||||
|
||||
describe('CSS file loading tests', function() {
|
||||
|
||||
before(function() {
|
||||
// add test div to body for css tests
|
||||
testEl = document.createElement('div');
|
||||
testEl.className = 'test-div mui-container';
|
||||
testEl.style.display = 'inline-block';
|
||||
document.body.appendChild(testEl);
|
||||
});
|
||||
|
||||
|
||||
afterEach(function() {
|
||||
var els = document.getElementsByTagName('link'),
|
||||
i = els.length,
|
||||
el;
|
||||
|
||||
// iteratete through stylesheets
|
||||
while (i--) {
|
||||
el = els[i];
|
||||
|
||||
// remove test stylesheets
|
||||
if (el.href.indexOf('mocha.css') === -1) {
|
||||
el.parentNode.removeChild(el);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
it('should load one file', function(done) {
|
||||
loadjs(['assets/file1.css'], {
|
||||
success: function() {
|
||||
assert.equal(testEl.offsetWidth, 100);
|
||||
done();
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
it('should load multiple files', function(done) {
|
||||
loadjs(['assets/file1.css', 'assets/file2.css'], {
|
||||
success: function() {
|
||||
assert.equal(testEl.offsetWidth, 200);
|
||||
done();
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
it('should call error callback on one invalid path', function(done) {
|
||||
loadjs(['assets/file1.css', 'assets/file-doesntexist.css'], {
|
||||
success: function() {
|
||||
throw new Error('Executed success callback');
|
||||
},
|
||||
error: function(pathsNotFound) {
|
||||
assert.equal(testEl.offsetWidth, 100);
|
||||
assert.equal(pathsNotFound.length, 1);
|
||||
assert.equal(pathsNotFound[0], 'assets/file-doesntexist.css');
|
||||
done();
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
it('should support mix of css and js', function(done) {
|
||||
loadjs(['assets/file1.css', 'assets/file1.js'], {
|
||||
success: function() {
|
||||
assert.equal(pathsLoaded['file1.js'], true);
|
||||
assert.equal(testEl.offsetWidth, 100);
|
||||
done();
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
it('should support forced "css!" files', function(done) {
|
||||
loadjs(['css!assets/file1.css'], {
|
||||
success: function() {
|
||||
// loop through files
|
||||
var els = document.getElementsByTagName('link'),
|
||||
i = els.length,
|
||||
el;
|
||||
|
||||
while (i--) {
|
||||
if (els[i].href.indexOf('file1.css') !== -1) done();
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
it('supports urls with query arguments', function(done) {
|
||||
loadjs(['assets/file1.css?x=x'], {
|
||||
success: function() {
|
||||
assert.equal(testEl.offsetWidth, 100);
|
||||
done();
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
it('supports urls with anchor tags', function(done) {
|
||||
loadjs(['assets/file1.css#anchortag'], {
|
||||
success: function() {
|
||||
assert.equal(testEl.offsetWidth, 100);
|
||||
done();
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
it('supports urls with query arguments and anchor tags', function(done) {
|
||||
loadjs(['assets/file1.css?x=x#anchortag'], {
|
||||
success: function() {
|
||||
assert.equal(testEl.offsetWidth, 100);
|
||||
done();
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
it('should load external css files', function(done) {
|
||||
this.timeout(0);
|
||||
|
||||
loadjs(['//cdn.muicss.com/mui-0.6.8/css/mui.min.css'], {
|
||||
success: function() {
|
||||
var styleObj = getComputedStyle(testEl);
|
||||
|
||||
assert.equal(styleObj.getPropertyValue('padding-left'), '15px');
|
||||
done();
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
it('should call error on missing external file', function(done) {
|
||||
this.timeout(0);
|
||||
|
||||
loadjs(['//cdn.muicss.com/mui-0.6.8/css/mui-doesnotexist.min.css'], {
|
||||
success: function() {
|
||||
throw new Error('Executed success callback');
|
||||
},
|
||||
error: function(pathsNotFound) {
|
||||
var styleObj = getComputedStyle(testEl);
|
||||
|
||||
assert.equal(styleObj.getPropertyValue('padding-left'), '0px');
|
||||
assert.equal(pathsNotFound.length, 1);
|
||||
done();
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
// teardown
|
||||
return after(function() {
|
||||
// remove test div
|
||||
testEl.parentNode.removeChild(testEl);
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
// ==========================================================================
|
||||
// Image file loading tests
|
||||
// ==========================================================================
|
||||
|
||||
describe('Image file loading tests', function() {
|
||||
|
||||
function assertLoaded(src) {
|
||||
// loop through images
|
||||
var imgs = document.getElementsByTagName('img');
|
||||
|
||||
Array.prototype.slice.call(imgs).forEach(function(img) {
|
||||
// verify image was loaded
|
||||
if (img.src === src) assert.equal(img.naturalWidth > 0, true);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
function assertNotLoaded(src) {
|
||||
// loop through images
|
||||
var imgs = document.getElementsByTagName('img');
|
||||
|
||||
Array.prototype.slice.call(imgs).forEach(function(img) {
|
||||
// fail if image was loaded
|
||||
if (img.src === src) assert.equal(img.naturalWidth, 0);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
it('should load one file', function(done) {
|
||||
loadjs(['assets/flash.png'], {
|
||||
success: function() {
|
||||
assertLoaded('assets/flash.png');
|
||||
done();
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
it('should load multiple files', function(done) {
|
||||
loadjs(['assets/flash.png', 'assets/flash.jpg'], {
|
||||
success: function() {
|
||||
assertLoaded('assets/flash.png');
|
||||
assertLoaded('assets/flash.jpg');
|
||||
done();
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
it('detects png|gif|jpg|svg|webp extensions', function(done) {
|
||||
let files = [
|
||||
'assets/flash.png',
|
||||
'assets/flash.gif',
|
||||
'assets/flash.jpg',
|
||||
'assets/flash.svg',
|
||||
'assets/flash.webp'
|
||||
];
|
||||
|
||||
loadjs(files, function() {
|
||||
files.forEach(file => {assertLoaded(file);});
|
||||
done();
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
it('supports urls with query arguments', function(done) {
|
||||
var src = 'assets/flash.png?' + Math.random();
|
||||
|
||||
loadjs([src], {
|
||||
success: function() {
|
||||
assertLoaded(src);
|
||||
done();
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
it('supports urls with anchor tags', function(done) {
|
||||
var src = 'assets/flash.png#' + Math.random();
|
||||
|
||||
loadjs([src], {
|
||||
success: function() {
|
||||
assertLoaded(src);
|
||||
done();
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
it('supports urls with query arguments and anchor tags', function(done) {
|
||||
var src = 'assets/flash.png';
|
||||
src += '?' + Math.random();
|
||||
src += '#' + Math.random();
|
||||
|
||||
loadjs([src], {
|
||||
success: function() {
|
||||
assertLoaded(src);
|
||||
done();
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
it('should support forced "img!" files', function(done) {
|
||||
var src = 'assets/flash.png?' + Math.random();
|
||||
|
||||
loadjs(['img!' + src], {
|
||||
success: function() {
|
||||
assertLoaded(src);
|
||||
done();
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
it('should call error callback on one invalid path', function(done) {
|
||||
var src1 = 'assets/flash.png?' + Math.random(),
|
||||
src2 = 'assets/flash-doesntexist.png?' + Math.random();
|
||||
|
||||
loadjs(['img!' + src1, 'img!' + src2], {
|
||||
success: function() {
|
||||
throw new Error('Executed success callback');
|
||||
},
|
||||
error: function(pathsNotFound) {
|
||||
assert.equal(pathsNotFound.length, 1);
|
||||
assertLoaded(src1);
|
||||
assertNotLoaded(src2);
|
||||
done();
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
it('should support mix of img and js', function(done) {
|
||||
var src = 'assets/flash.png?' + Math.random();
|
||||
|
||||
loadjs(['img!' + src, 'assets/file1.js'], {
|
||||
success: function() {
|
||||
assert.equal(pathsLoaded['file1.js'], true);
|
||||
assertLoaded(src);
|
||||
done();
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
it('should load external img files', function(done) {
|
||||
this.timeout(0);
|
||||
|
||||
var src = 'https://www.muicss.com/static/images/mui-logo.png?';
|
||||
src += Math.random();
|
||||
|
||||
loadjs(['img!' + src], {
|
||||
success: function() {
|
||||
assertLoaded(src);
|
||||
done();
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
it('should call error on missing external file', function(done) {
|
||||
this.timeout(0);
|
||||
|
||||
var src = 'https://www.muicss.com/static/images/';
|
||||
src += 'mui-logo-doesntexist.png?' + Math.random();
|
||||
|
||||
loadjs(['img!' + src], {
|
||||
success: function() {
|
||||
throw new Error('Executed success callback');
|
||||
},
|
||||
error: function(pathsNotFound) {
|
||||
assertNotLoaded(src);
|
||||
done();
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
// ==========================================================================
|
||||
// API tests
|
||||
// ==========================================================================
|
||||
|
||||
describe('API tests', function() {
|
||||
|
||||
it('should throw an error if bundle is already defined', function() {
|
||||
// define bundle
|
||||
loadjs(['assets/file1.js'], 'bundle');
|
||||
|
||||
// define bundle again
|
||||
var fn = function() {
|
||||
loadjs(['assets/file1.js'], 'bundle');
|
||||
};
|
||||
|
||||
expect(fn).to.throw("LoadJS");
|
||||
});
|
||||
|
||||
|
||||
it('should create a bundle id and a callback inline', function(done) {
|
||||
loadjs(['assets/file1.js', 'assets/file2.js'], 'bundle', {
|
||||
success: function() {
|
||||
assert.equal(pathsLoaded['file1.js'], true);
|
||||
assert.equal(pathsLoaded['file2.js'], true);
|
||||
done();
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
it('should chain loadjs object', function(done) {
|
||||
function bothDone() {
|
||||
if (pathsLoaded['file1.js'] && pathsLoaded['file2.js']) done();
|
||||
}
|
||||
|
||||
// define bundles
|
||||
loadjs('assets/file1.js', 'bundle1');
|
||||
loadjs('assets/file2.js', 'bundle2');
|
||||
|
||||
loadjs
|
||||
.ready('bundle1', {
|
||||
success: function() {
|
||||
assert.equal(pathsLoaded['file1.js'], true);
|
||||
bothDone();
|
||||
}})
|
||||
.ready('bundle2', {
|
||||
success: function() {
|
||||
assert.equal(pathsLoaded['file2.js'], true);
|
||||
bothDone();
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
it('should handle multiple dependencies', function(done) {
|
||||
loadjs('assets/file1.js', 'bundle1');
|
||||
loadjs('assets/file2.js', 'bundle2');
|
||||
|
||||
loadjs.ready(['bundle1', 'bundle2'], {
|
||||
success: function() {
|
||||
assert.equal(pathsLoaded['file1.js'], true);
|
||||
assert.equal(pathsLoaded['file2.js'], true);
|
||||
done();
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
it('should error on missing depdendencies', function(done) {
|
||||
loadjs('assets/file1.js', 'bundle1');
|
||||
loadjs('assets/file-doesntexist.js', 'bundle2');
|
||||
|
||||
loadjs.ready(['bundle1', 'bundle2'], {
|
||||
success: function() {
|
||||
throw "Executed success callback";
|
||||
},
|
||||
error: function(depsNotFound) {
|
||||
assert.equal(pathsLoaded['file1.js'], true);
|
||||
assert.equal(depsNotFound.length, 1);
|
||||
assert.equal(depsNotFound[0], 'bundle2');
|
||||
done();
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
it('should execute callbacks on .done()', function(done) {
|
||||
// add handler
|
||||
loadjs.ready('plugin', {
|
||||
success: function() {
|
||||
done();
|
||||
}
|
||||
});
|
||||
|
||||
// execute done
|
||||
loadjs.done('plugin');
|
||||
});
|
||||
|
||||
|
||||
it('should execute callbacks created after .done()', function(done) {
|
||||
// execute done
|
||||
loadjs.done('plugin');
|
||||
|
||||
// add handler
|
||||
loadjs.ready('plugin', {
|
||||
success: function() {
|
||||
done();
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
it('should define bundles', function(done) {
|
||||
// define bundle
|
||||
loadjs(['assets/file1.js', 'assets/file2.js'], 'bundle');
|
||||
|
||||
// use 1 second delay to let files load
|
||||
setTimeout(function() {
|
||||
loadjs.ready('bundle', {
|
||||
success: function() {
|
||||
assert.equal(pathsLoaded['file1.js'], true);
|
||||
assert.equal(pathsLoaded['file2.js'], true);
|
||||
done();
|
||||
}
|
||||
});
|
||||
}, 1000);
|
||||
});
|
||||
|
||||
|
||||
it('should allow bundle callbacks before definitions', function(done) {
|
||||
// define callback
|
||||
loadjs.ready('bundle', {
|
||||
success: function() {
|
||||
assert.equal(pathsLoaded['file1.js'], true);
|
||||
assert.equal(pathsLoaded['file2.js'], true);
|
||||
done();
|
||||
}
|
||||
});
|
||||
|
||||
// use 1 second delay
|
||||
setTimeout(function() {
|
||||
loadjs(['assets/file1.js', 'assets/file2.js'], 'bundle');
|
||||
}, 1000);
|
||||
});
|
||||
|
||||
|
||||
it('should reset dependencies statuses', function() {
|
||||
loadjs(['assets/file1.js'], 'cleared');
|
||||
loadjs.reset();
|
||||
|
||||
// define bundle again
|
||||
var fn = function() {
|
||||
loadjs(['assets/file1.js'], 'cleared');
|
||||
};
|
||||
|
||||
expect(fn).not.to.throw("LoadJS");
|
||||
});
|
||||
|
||||
|
||||
it('should indicate if bundle has already been defined', function() {
|
||||
loadjs(['assets/file1/js'], 'bundle1');
|
||||
|
||||
assert.equal(loadjs.isDefined('bundle1'), true);
|
||||
assert.equal(loadjs.isDefined('bundleXX'), false);
|
||||
});
|
||||
|
||||
|
||||
it('should accept success callback functions to loadjs()', function(done) {
|
||||
loadjs('assets/file1.js', function() {
|
||||
done();
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
it('should accept success callback functions to .ready()', function(done) {
|
||||
loadjs.done('plugin');
|
||||
loadjs.ready('plugin', function() {
|
||||
done();
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
it('should return Promise object if returnPromise is true', function() {
|
||||
var prom = loadjs(['assets/file1.js'], {returnPromise: true});
|
||||
|
||||
// verify that response object is a Promise
|
||||
assert.equal(prom instanceof Promise, true);
|
||||
});
|
||||
|
||||
|
||||
it('Promise object should support resolutions', function(done) {
|
||||
var prom = loadjs(['assets/file1.js'], {returnPromise: true});
|
||||
|
||||
prom.then(function() {
|
||||
assert.equal(pathsLoaded['file1.js'], true);
|
||||
done();
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
it('Promise object should support rejections', function(done) {
|
||||
var prom = loadjs(['assets/file-doesntexist.js'], {returnPromise: true});
|
||||
|
||||
prom.then(
|
||||
function(){},
|
||||
function(pathsNotFound) {
|
||||
assert.equal(pathsNotFound.length, 1);
|
||||
assert.equal(pathsNotFound[0], 'assets/file-doesntexist.js');
|
||||
done();
|
||||
}
|
||||
);
|
||||
});
|
||||
|
||||
|
||||
it('Promise object should support catches', function(done) {
|
||||
var prom = loadjs(['assets/file-doesntexist.js'], {returnPromise: true});
|
||||
|
||||
prom
|
||||
.catch(function(pathsNotFound) {
|
||||
assert.equal(pathsNotFound.length, 1);
|
||||
assert.equal(pathsNotFound[0], 'assets/file-doesntexist.js');
|
||||
done();
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
it('supports Promises and success callbacks', function(done) {
|
||||
var numCompleted = 0;
|
||||
|
||||
function completedFn() {
|
||||
numCompleted += 1;
|
||||
if (numCompleted === 2) done();
|
||||
};
|
||||
|
||||
var prom = loadjs('assets/file1.js', {
|
||||
success: completedFn,
|
||||
returnPromise: true
|
||||
});
|
||||
|
||||
prom.then(completedFn);
|
||||
});
|
||||
|
||||
|
||||
it('supports Promises and bundle ready events', function(done) {
|
||||
var numCompleted = 0;
|
||||
|
||||
function completedFn() {
|
||||
numCompleted += 1;
|
||||
if (numCompleted === 2) done();
|
||||
};
|
||||
|
||||
loadjs('assets/file1.js', 'bundle1', {returnPromise: true})
|
||||
.then(completedFn);
|
||||
|
||||
loadjs.ready('bundle1', completedFn);
|
||||
});
|
||||
});
|
||||
});
|
||||
10707
lisp/emacs-application-framework/app/js-video-player/node_modules/loadjs/test/vendor/chai-4.1.2.js
generated
vendored
Normal file
10707
lisp/emacs-application-framework/app/js-video-player/node_modules/loadjs/test/vendor/chai-4.1.2.js
generated
vendored
Normal file
File diff suppressed because it is too large
Load Diff
326
lisp/emacs-application-framework/app/js-video-player/node_modules/loadjs/test/vendor/mocha-4.1.0/mocha.css
generated
vendored
Normal file
326
lisp/emacs-application-framework/app/js-video-player/node_modules/loadjs/test/vendor/mocha-4.1.0/mocha.css
generated
vendored
Normal file
@@ -0,0 +1,326 @@
|
||||
@charset "utf-8";
|
||||
|
||||
body {
|
||||
margin:0;
|
||||
}
|
||||
|
||||
#mocha {
|
||||
font: 20px/1.5 "Helvetica Neue", Helvetica, Arial, sans-serif;
|
||||
margin: 60px 50px;
|
||||
}
|
||||
|
||||
#mocha ul,
|
||||
#mocha li {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
#mocha ul {
|
||||
list-style: none;
|
||||
}
|
||||
|
||||
#mocha h1,
|
||||
#mocha h2 {
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
#mocha h1 {
|
||||
margin-top: 15px;
|
||||
font-size: 1em;
|
||||
font-weight: 200;
|
||||
}
|
||||
|
||||
#mocha h1 a {
|
||||
text-decoration: none;
|
||||
color: inherit;
|
||||
}
|
||||
|
||||
#mocha h1 a:hover {
|
||||
text-decoration: underline;
|
||||
}
|
||||
|
||||
#mocha .suite .suite h1 {
|
||||
margin-top: 0;
|
||||
font-size: .8em;
|
||||
}
|
||||
|
||||
#mocha .hidden {
|
||||
display: none;
|
||||
}
|
||||
|
||||
#mocha h2 {
|
||||
font-size: 12px;
|
||||
font-weight: normal;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
#mocha .suite {
|
||||
margin-left: 15px;
|
||||
}
|
||||
|
||||
#mocha .test {
|
||||
margin-left: 15px;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
#mocha .test.pending:hover h2::after {
|
||||
content: '(pending)';
|
||||
font-family: arial, sans-serif;
|
||||
}
|
||||
|
||||
#mocha .test.pass.medium .duration {
|
||||
background: #c09853;
|
||||
}
|
||||
|
||||
#mocha .test.pass.slow .duration {
|
||||
background: #b94a48;
|
||||
}
|
||||
|
||||
#mocha .test.pass::before {
|
||||
content: '✓';
|
||||
font-size: 12px;
|
||||
display: block;
|
||||
float: left;
|
||||
margin-right: 5px;
|
||||
color: #00d6b2;
|
||||
}
|
||||
|
||||
#mocha .test.pass .duration {
|
||||
font-size: 9px;
|
||||
margin-left: 5px;
|
||||
padding: 2px 5px;
|
||||
color: #fff;
|
||||
-webkit-box-shadow: inset 0 1px 1px rgba(0,0,0,.2);
|
||||
-moz-box-shadow: inset 0 1px 1px rgba(0,0,0,.2);
|
||||
box-shadow: inset 0 1px 1px rgba(0,0,0,.2);
|
||||
-webkit-border-radius: 5px;
|
||||
-moz-border-radius: 5px;
|
||||
-ms-border-radius: 5px;
|
||||
-o-border-radius: 5px;
|
||||
border-radius: 5px;
|
||||
}
|
||||
|
||||
#mocha .test.pass.fast .duration {
|
||||
display: none;
|
||||
}
|
||||
|
||||
#mocha .test.pending {
|
||||
color: #0b97c4;
|
||||
}
|
||||
|
||||
#mocha .test.pending::before {
|
||||
content: '◦';
|
||||
color: #0b97c4;
|
||||
}
|
||||
|
||||
#mocha .test.fail {
|
||||
color: #c00;
|
||||
}
|
||||
|
||||
#mocha .test.fail pre {
|
||||
color: black;
|
||||
}
|
||||
|
||||
#mocha .test.fail::before {
|
||||
content: '✖';
|
||||
font-size: 12px;
|
||||
display: block;
|
||||
float: left;
|
||||
margin-right: 5px;
|
||||
color: #c00;
|
||||
}
|
||||
|
||||
#mocha .test pre.error {
|
||||
color: #c00;
|
||||
max-height: 300px;
|
||||
overflow: auto;
|
||||
}
|
||||
|
||||
#mocha .test .html-error {
|
||||
overflow: auto;
|
||||
color: black;
|
||||
line-height: 1.5;
|
||||
display: block;
|
||||
float: left;
|
||||
clear: left;
|
||||
font: 12px/1.5 monaco, monospace;
|
||||
margin: 5px;
|
||||
padding: 15px;
|
||||
border: 1px solid #eee;
|
||||
max-width: 85%; /*(1)*/
|
||||
max-width: -webkit-calc(100% - 42px);
|
||||
max-width: -moz-calc(100% - 42px);
|
||||
max-width: calc(100% - 42px); /*(2)*/
|
||||
max-height: 300px;
|
||||
word-wrap: break-word;
|
||||
border-bottom-color: #ddd;
|
||||
-webkit-box-shadow: 0 1px 3px #eee;
|
||||
-moz-box-shadow: 0 1px 3px #eee;
|
||||
box-shadow: 0 1px 3px #eee;
|
||||
-webkit-border-radius: 3px;
|
||||
-moz-border-radius: 3px;
|
||||
border-radius: 3px;
|
||||
}
|
||||
|
||||
#mocha .test .html-error pre.error {
|
||||
border: none;
|
||||
-webkit-border-radius: 0;
|
||||
-moz-border-radius: 0;
|
||||
border-radius: 0;
|
||||
-webkit-box-shadow: 0;
|
||||
-moz-box-shadow: 0;
|
||||
box-shadow: 0;
|
||||
padding: 0;
|
||||
margin: 0;
|
||||
margin-top: 18px;
|
||||
max-height: none;
|
||||
}
|
||||
|
||||
/**
|
||||
* (1): approximate for browsers not supporting calc
|
||||
* (2): 42 = 2*15 + 2*10 + 2*1 (padding + margin + border)
|
||||
* ^^ seriously
|
||||
*/
|
||||
#mocha .test pre {
|
||||
display: block;
|
||||
float: left;
|
||||
clear: left;
|
||||
font: 12px/1.5 monaco, monospace;
|
||||
margin: 5px;
|
||||
padding: 15px;
|
||||
border: 1px solid #eee;
|
||||
max-width: 85%; /*(1)*/
|
||||
max-width: -webkit-calc(100% - 42px);
|
||||
max-width: -moz-calc(100% - 42px);
|
||||
max-width: calc(100% - 42px); /*(2)*/
|
||||
word-wrap: break-word;
|
||||
border-bottom-color: #ddd;
|
||||
-webkit-box-shadow: 0 1px 3px #eee;
|
||||
-moz-box-shadow: 0 1px 3px #eee;
|
||||
box-shadow: 0 1px 3px #eee;
|
||||
-webkit-border-radius: 3px;
|
||||
-moz-border-radius: 3px;
|
||||
border-radius: 3px;
|
||||
}
|
||||
|
||||
#mocha .test h2 {
|
||||
position: relative;
|
||||
}
|
||||
|
||||
#mocha .test a.replay {
|
||||
position: absolute;
|
||||
top: 3px;
|
||||
right: 0;
|
||||
text-decoration: none;
|
||||
vertical-align: middle;
|
||||
display: block;
|
||||
width: 15px;
|
||||
height: 15px;
|
||||
line-height: 15px;
|
||||
text-align: center;
|
||||
background: #eee;
|
||||
font-size: 15px;
|
||||
-webkit-border-radius: 15px;
|
||||
-moz-border-radius: 15px;
|
||||
border-radius: 15px;
|
||||
-webkit-transition:opacity 200ms;
|
||||
-moz-transition:opacity 200ms;
|
||||
-o-transition:opacity 200ms;
|
||||
transition: opacity 200ms;
|
||||
opacity: 0.3;
|
||||
color: #888;
|
||||
}
|
||||
|
||||
#mocha .test:hover a.replay {
|
||||
opacity: 1;
|
||||
}
|
||||
|
||||
#mocha-report.pass .test.fail {
|
||||
display: none;
|
||||
}
|
||||
|
||||
#mocha-report.fail .test.pass {
|
||||
display: none;
|
||||
}
|
||||
|
||||
#mocha-report.pending .test.pass,
|
||||
#mocha-report.pending .test.fail {
|
||||
display: none;
|
||||
}
|
||||
#mocha-report.pending .test.pass.pending {
|
||||
display: block;
|
||||
}
|
||||
|
||||
#mocha-error {
|
||||
color: #c00;
|
||||
font-size: 1.5em;
|
||||
font-weight: 100;
|
||||
letter-spacing: 1px;
|
||||
}
|
||||
|
||||
#mocha-stats {
|
||||
position: fixed;
|
||||
top: 15px;
|
||||
right: 10px;
|
||||
font-size: 12px;
|
||||
margin: 0;
|
||||
color: #888;
|
||||
z-index: 1;
|
||||
}
|
||||
|
||||
#mocha-stats .progress {
|
||||
float: right;
|
||||
padding-top: 0;
|
||||
|
||||
/**
|
||||
* Set safe initial values, so mochas .progress does not inherit these
|
||||
* properties from Bootstrap .progress (which causes .progress height to
|
||||
* equal line height set in Bootstrap).
|
||||
*/
|
||||
height: auto;
|
||||
-webkit-box-shadow: none;
|
||||
-moz-box-shadow: none;
|
||||
box-shadow: none;
|
||||
background-color: initial;
|
||||
}
|
||||
|
||||
#mocha-stats em {
|
||||
color: black;
|
||||
}
|
||||
|
||||
#mocha-stats a {
|
||||
text-decoration: none;
|
||||
color: inherit;
|
||||
}
|
||||
|
||||
#mocha-stats a:hover {
|
||||
border-bottom: 1px solid #eee;
|
||||
}
|
||||
|
||||
#mocha-stats li {
|
||||
display: inline-block;
|
||||
margin: 0 5px;
|
||||
list-style: none;
|
||||
padding-top: 11px;
|
||||
}
|
||||
|
||||
#mocha-stats canvas {
|
||||
width: 40px;
|
||||
height: 40px;
|
||||
}
|
||||
|
||||
#mocha code .comment { color: #ddd; }
|
||||
#mocha code .init { color: #2f6fad; }
|
||||
#mocha code .string { color: #5890ad; }
|
||||
#mocha code .keyword { color: #8a6343; }
|
||||
#mocha code .number { color: #2f6fad; }
|
||||
|
||||
@media screen and (max-device-width: 480px) {
|
||||
#mocha {
|
||||
margin: 60px 0px;
|
||||
}
|
||||
|
||||
#mocha #stats {
|
||||
position: absolute;
|
||||
}
|
||||
}
|
||||
15336
lisp/emacs-application-framework/app/js-video-player/node_modules/loadjs/test/vendor/mocha-4.1.0/mocha.js
generated
vendored
Normal file
15336
lisp/emacs-application-framework/app/js-video-player/node_modules/loadjs/test/vendor/mocha-4.1.0/mocha.js
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user