From ee895dd3e5e9fd743f6980f57008ce28b71c3bb0 Mon Sep 17 00:00:00 2001 From: hackademix Date: Mon, 25 Feb 2019 13:05:26 +0100 Subject: Test for inline scripts in attributes, including (de)duplication. --- test/spec/LibreJSSpec.js | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'test/spec') diff --git a/test/spec/LibreJSSpec.js b/test/spec/LibreJSSpec.js index 3d61973..57c7f65 100644 --- a/test/spec/LibreJSSpec.js +++ b/test/spec/LibreJSSpec.js @@ -94,6 +94,10 @@ describe("LibreJS' components", () => { let addScript = (html, script, before = "") => html.replace(before, `${before}`); + let addToBody = (html, fragment) => html.replace("", `${fragment}`); + + let jsUrl = js => `javascript:${encodeURIComponent(js)}`; + function extractScripts(html, def = "") { let matches = html && html.match(/