mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06:00
DEV - versions of JS files written to a JS file to be included by loa… (#10649)
* DEV - versions of JS files written to a JS file to be included by load-script and appended as params to URLs * Formatting * Incorporate feedback from PR * Update filename of public-js-versions
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
import loadScript from "discourse/lib/load-script";
|
||||
import { loadScript, cacheBuster } from "discourse/lib/load-script";
|
||||
import { PUBLIC_JS_VERSIONS as jsVersions } from "discourse/lib/public-js-versions";
|
||||
|
||||
QUnit.module("lib:load-script");
|
||||
|
||||
@@ -19,3 +20,28 @@ QUnit.skip(
|
||||
);
|
||||
}
|
||||
);
|
||||
|
||||
QUnit.test("works when a value is not present", (assert) => {
|
||||
assert.equal(
|
||||
cacheBuster("/javascripts/my-script.js"),
|
||||
"/javascripts/my-script.js"
|
||||
);
|
||||
assert.equal(
|
||||
cacheBuster("/javascripts/my-project/script.js"),
|
||||
"/javascripts/my-project/script.js"
|
||||
);
|
||||
});
|
||||
|
||||
QUnit.test(
|
||||
"generates URLs with version number in the query params",
|
||||
(assert) => {
|
||||
assert.equal(
|
||||
cacheBuster("/javascripts/pikaday.js"),
|
||||
`/javascripts/pikaday.js?v=${jsVersions["pikaday.js"]}`
|
||||
);
|
||||
assert.equal(
|
||||
cacheBuster("/javascripts/ace/ace.js"),
|
||||
`/javascripts/ace/ace.js?v=${jsVersions["ace"]}`
|
||||
);
|
||||
}
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user