2018-09-30 22:06:01 -04:00
|
|
|
import loadScript from "discourse/lib/load-script";
|
|
|
|
|
|
|
|
QUnit.module("lib:load-script");
|
|
|
|
|
2019-06-27 04:57:40 -04:00
|
|
|
QUnit.skip(
|
2018-09-30 22:06:01 -04:00
|
|
|
"load with a script tag, and callbacks are only executed after script is loaded",
|
|
|
|
async assert => {
|
2019-06-27 04:19:55 -04:00
|
|
|
assert.ok(
|
|
|
|
typeof window.ace === "undefined",
|
|
|
|
"ensures ace is not previously loaded"
|
|
|
|
);
|
|
|
|
|
2018-09-30 22:06:01 -04:00
|
|
|
const src = "/javascripts/ace/ace.js";
|
|
|
|
|
|
|
|
await loadScript(src).then(() => {
|
|
|
|
assert.ok(
|
2019-06-27 04:19:55 -04:00
|
|
|
typeof window.ace !== "undefined",
|
2018-09-30 22:06:01 -04:00
|
|
|
"callbacks should only be executed after the script has fully loaded"
|
|
|
|
);
|
|
|
|
});
|
|
|
|
}
|
|
|
|
);
|