From 21175a8267aae9d88652fac832a90266d5484cd5 Mon Sep 17 00:00:00 2001 From: hackademix Date: Tue, 30 Apr 2019 13:31:49 +0200 Subject: Display NOSCRIPT elements when scripts are blocked or the data-librejs-display attribute is present. --- test/spec/LibreJSSpec.js | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) (limited to 'test') diff --git a/test/spec/LibreJSSpec.js b/test/spec/LibreJSSpec.js index 43f37a7..8d4aebe 100644 --- a/test/spec/LibreJSSpec.js +++ b/test/spec/LibreJSSpec.js @@ -222,6 +222,30 @@ describe("LibreJS' components", () => { expect(processed).toContain(trivialAsUrl); expect(processed).not.toContain(nontrivialAsUrl); }); + + it("should force displaying NOSCRIPT elements (except those with @data-librejs-nodisplay) where scripts have been blocked", async () => { + let noscriptContent = "I'm NOSCRIPT content"; + let asNoscript = ``; + let asNodisplay = ``; + let asSpan = `${noscriptContent}`; + let page = addToBody(addToBody(nontrivialInHtml, asNoscript), asNodisplay); + let processed = await processHtml(page); + expect(processed).not.toContain(asNoscript); + expect(processed).toContain(asSpan); + expect(processed).not.toContain(asNodisplay); + }); + + it("should always force displaying @data-librejs-display elements", async () => { + let content = "I'm FORCED content"; + let asDisplay = `${content}`; + let asSpan = `${content}`; + for (let page of [nontrivialInHtml, ""]) { + page = addToBody(page, asDisplay); + let processed = await processHtml(page); + expect(processed).not.toContain(asDisplay); + expect(processed).not.toContain(asSpan); + } + }); }); describe("The external (Web Labels) license checker", () => { -- cgit v1.2.3