From 55189292b903083702ce532407621cf4a986c6e1 Mon Sep 17 00:00:00 2001 From: Fanon Jupkwo Date: Sun, 17 Mar 2024 19:12:26 +0000 Subject: [PATCH] update: Issue #240 updating the counter initial value from 0 to 1 - PR #264 workflow bug (#266) * update: Issue #240 updating the counter initial value from 0 to 1 - PR #264 workflow bug * trying to make test fail * Undo "trying to make test fail" * undo changes * update: resolves #267 trigger the Javadoc Workflow only if .github/workflows/javadoc.yml, jsgenerator-core/ or pom.xml has changed * docs: delete the title's full stop * update: Issue #240 updating the counter initial value from 0 to 1 - PR #264 workflow bug * trying to make test fail * Undo "trying to make test fail" * undo changes * fix: fix tests on jsgenerator-core * fix: fix tests on jsgenerator-api --- .../TypeBasedVariableNameStrategy.java | 2 +- .../test/api/JsGeneratorApiTest.java | 78 +- .../commentConversionModeActivated/sample.js | 188 +- .../sample.js | 180 +- .../querySelectorAdded/sample.js | 172 +- .../commentConversionModeActivated/sample.js | 184 +- .../sample.js | 176 +- .../querySelectorNotAdded/sample.js | 168 +- .../jsgenerator/test/core/ConverterTest.java | 1987 ++++++++--------- 9 files changed, 1567 insertions(+), 1568 deletions(-) diff --git a/jsgenerator-core/src/main/java/com/osscameroon/jsgenerator/core/internal/TypeBasedVariableNameStrategy.java b/jsgenerator-core/src/main/java/com/osscameroon/jsgenerator/core/internal/TypeBasedVariableNameStrategy.java index 8e6249ea..143b6cbd 100644 --- a/jsgenerator-core/src/main/java/com/osscameroon/jsgenerator/core/internal/TypeBasedVariableNameStrategy.java +++ b/jsgenerator-core/src/main/java/com/osscameroon/jsgenerator/core/internal/TypeBasedVariableNameStrategy.java @@ -31,6 +31,6 @@ public String nextName(@NonNull String type) { } } - return format("%s_%03d", identifier, counters.computeIfAbsent(type, __ -> new AtomicLong()).getAndIncrement()); + return format("%s_%03d", identifier, counters.computeIfAbsent(type, __ -> new AtomicLong(1)).getAndIncrement()); } } diff --git a/jsgenerator-test/jsgenerator-test-api/src/test/java/com/osscameroon/jsgenerator/test/api/JsGeneratorApiTest.java b/jsgenerator-test/jsgenerator-test-api/src/test/java/com/osscameroon/jsgenerator/test/api/JsGeneratorApiTest.java index f3c235b6..f1cd45e8 100644 --- a/jsgenerator-test/jsgenerator-test-api/src/test/java/com/osscameroon/jsgenerator/test/api/JsGeneratorApiTest.java +++ b/jsgenerator-test/jsgenerator-test-api/src/test/java/com/osscameroon/jsgenerator/test/api/JsGeneratorApiTest.java @@ -180,12 +180,12 @@ void convertInlineContent(final VariableDeclaration variableDeclaration, final b jsonPath("$.content.length()").value(1), jsonPath("$.content.[0].filename").value("%s.0.%s".formatted(prefix, extension)), jsonPath("$.content.[0].content").value(new Match(new String[]{ - "%s targetElement_000 = document.querySelector(`:root > body`);".formatted(keyword), - "%s div_000 = document.createElement('div');".formatted(keyword), - "div_000.setAttribute(`contenteditable`, `true`);", - "%s text_000 = document.createTextNode(`%s`);".formatted(keyword, content), - "div_000.appendChild(text_000);", - "targetElement_000.appendChild(div_000);" + "%s targetElement_001 = document.querySelector(`:root > body`);".formatted(keyword), + "%s div_001 = document.createElement('div');".formatted(keyword), + "div_001.setAttribute(`contenteditable`, `true`);", + "%s text_001 = document.createTextNode(`%s`);".formatted(keyword, content), + "div_001.appendChild(text_001);", + "targetElement_001.appendChild(div_001);" }))); @@ -210,10 +210,10 @@ void convertInlineContent(final VariableDeclaration variableDeclaration, final b jsonPath("$.content.[0].filename").value("%s.0.%s".formatted(prefix, extension)), jsonPath("$.content.[0].content").value(new Match(new String[]{ - "%s div_000 = document.createElement('div');".formatted(keyword), - "div_000.setAttribute(`contenteditable`, `true`);", - "%s text_000 = document.createTextNode(`%s`);".formatted(keyword, content), - "div_000.appendChild(text_000);" + "%s div_001 = document.createElement('div');".formatted(keyword), + "div_001.setAttribute(`contenteditable`, `true`);", + "%s text_001 = document.createTextNode(`%s`);".formatted(keyword, content), + "div_001.appendChild(text_001);" }))); @@ -253,16 +253,16 @@ void convertInlineContentWithComment(final VariableDeclaration variableDeclarati jsonPath("$.content.length()").value(1), jsonPath("$.content.[0].filename").value("%s.0.%s".formatted(prefix, extension)), jsonPath("$.content.[0].content").value(new Match(new String[]{ - "%s targetElement_000 = document.querySelector(`:root > body`);".formatted(keyword), - "%s comment_000 = document.createComment(` ContentEditable `);".formatted(keyword), - "targetElement_000.appendChild(comment_000);", - "%s text_000 = document.createTextNode(` `);".formatted(keyword), - "targetElement_000.appendChild(text_000);", - "%s div_000 = document.createElement('div');".formatted(keyword), - "div_000.setAttribute(`contenteditable`, `true`);", - "%s text_001 = document.createTextNode(`%s`);".formatted(keyword, content), - "div_000.appendChild(text_001);", - "targetElement_000.appendChild(div_000);" + "%s targetElement_001 = document.querySelector(`:root > body`);".formatted(keyword), + "%s comment_001 = document.createComment(` ContentEditable `);".formatted(keyword), + "targetElement_001.appendChild(comment_001);", + "%s text_001 = document.createTextNode(` `);".formatted(keyword), + "targetElement_001.appendChild(text_001);", + "%s div_001 = document.createElement('div');".formatted(keyword), + "div_001.setAttribute(`contenteditable`, `true`);", + "%s text_002 = document.createTextNode(`%s`);".formatted(keyword, content), + "div_001.appendChild(text_002);", + "targetElement_001.appendChild(div_001);" }))); @@ -287,14 +287,14 @@ void convertInlineContentWithComment(final VariableDeclaration variableDeclarati jsonPath("$.content.length()").value(1), jsonPath("$.content.[0].filename").value("%s.0.%s".formatted(prefix, extension)), jsonPath("$.content.[0].content").value(new Match(new String[]{ - "%s targetElement_000 = document.querySelector(`:root > body`);".formatted(keyword), - "%s text_000 = document.createTextNode(` `);".formatted(keyword), - "targetElement_000.appendChild(text_000);", - "%s div_000 = document.createElement('div');".formatted(keyword), - "div_000.setAttribute(`contenteditable`, `true`);", - "%s text_001 = document.createTextNode(`%s`);".formatted(keyword, content), - "div_000.appendChild(text_001);", - "targetElement_000.appendChild(div_000);" + "%s targetElement_001 = document.querySelector(`:root > body`);".formatted(keyword), + "%s text_001 = document.createTextNode(` `);".formatted(keyword), + "targetElement_001.appendChild(text_001);", + "%s div_001 = document.createElement('div');".formatted(keyword), + "div_001.setAttribute(`contenteditable`, `true`);", + "%s text_002 = document.createTextNode(`%s`);".formatted(keyword, content), + "div_001.appendChild(text_002);", + "targetElement_001.appendChild(div_001);" }))); } @@ -321,12 +321,12 @@ void convertInlineContentWithComment(final VariableDeclaration variableDeclarati jsonPath("$.content.length()").value(1), jsonPath("$.content.[0].filename").value("%s.0.%s".formatted(prefix, extension)), jsonPath("$.content.[0].content").value(new Match(new String[]{ - "%s comment_000 = document.createComment(` ContentEditable `);".formatted(keyword), - "%s text_000 = document.createTextNode(` `);".formatted(keyword), - "%s div_000 = document.createElement('div');".formatted(keyword), - "div_000.setAttribute(`contenteditable`, `true`);", - "%s text_001 = document.createTextNode(`%s`);".formatted(keyword, content), - "div_000.appendChild(text_001);" + "%s comment_001 = document.createComment(` ContentEditable `);".formatted(keyword), + "%s text_001 = document.createTextNode(` `);".formatted(keyword), + "%s div_001 = document.createElement('div');".formatted(keyword), + "div_001.setAttribute(`contenteditable`, `true`);", + "%s text_002 = document.createTextNode(`%s`);".formatted(keyword, content), + "div_001.appendChild(text_002);" }))); @@ -350,11 +350,11 @@ void convertInlineContentWithComment(final VariableDeclaration variableDeclarati jsonPath("$.content.length()").value(1), jsonPath("$.content.[0].filename").value("%s.0.%s".formatted(prefix, extension)), jsonPath("$.content.[0].content").value(new Match(new String[]{ - "%s text_000 = document.createTextNode(` `);".formatted(keyword), - "%s div_000 = document.createElement('div');".formatted(keyword), - "div_000.setAttribute(`contenteditable`, `true`);", - "%s text_001 = document.createTextNode(`%s`);".formatted(keyword, content), - "div_000.appendChild(text_001);" + "%s text_001 = document.createTextNode(` `);".formatted(keyword), + "%s div_001 = document.createElement('div');".formatted(keyword), + "div_001.setAttribute(`contenteditable`, `true`);", + "%s text_002 = document.createTextNode(`%s`);".formatted(keyword, content), + "div_001.appendChild(text_002);" }))); } diff --git a/jsgenerator-test/jsgenerator-test-api/src/test/resources/jsFilesOutput/querySelectorAdded/commentConversionModeActivated/sample.js b/jsgenerator-test/jsgenerator-test-api/src/test/resources/jsFilesOutput/querySelectorAdded/commentConversionModeActivated/sample.js index 24f9175b..33330fe3 100644 --- a/jsgenerator-test/jsgenerator-test-api/src/test/resources/jsFilesOutput/querySelectorAdded/commentConversionModeActivated/sample.js +++ b/jsgenerator-test/jsgenerator-test-api/src/test/resources/jsFilesOutput/querySelectorAdded/commentConversionModeActivated/sample.js @@ -1,104 +1,104 @@ -{{keyword}} targetElement_000 = document.querySelector(`:root > body`); -{{keyword}} html_000 = document.createElement('html'); -{{keyword}} text_000 = document.createTextNode(` `); -html_000.appendChild(text_000); -{{keyword}} head_000 = document.createElement('head'); -{{keyword}} text_001 = document.createTextNode(` `); -head_000.appendChild(text_001); -{{keyword}} meta_000 = document.createElement('meta'); -meta_000.setAttribute(`charset`, `utf-8`); -head_000.appendChild(meta_000); +{{keyword}} targetElement_001 = document.querySelector(`:root > body`); +{{keyword}} html_001 = document.createElement('html'); +{{keyword}} text_001 = document.createTextNode(` `); +html_001.appendChild(text_001); +{{keyword}} head_001 = document.createElement('head'); {{keyword}} text_002 = document.createTextNode(` `); -head_000.appendChild(text_002); -{{keyword}} title_000 = document.createElement('title'); -{{keyword}} text_003 = document.createTextNode(`Sample`); -title_000.appendChild(text_003); -head_000.appendChild(title_000); -{{keyword}} text_004 = document.createTextNode(` `); -head_000.appendChild(text_004); -{{keyword}} link_000 = document.createElement('link'); -link_000.setAttribute(`rel`, `stylesheet`); -link_000.setAttribute(`href`, ``); -head_000.appendChild(link_000); -{{keyword}} text_005 = document.createTextNode(` `); -head_000.appendChild(text_005); -html_000.appendChild(head_000); +head_001.appendChild(text_002); +{{keyword}} meta_001 = document.createElement('meta'); +meta_001.setAttribute(`charset`, `utf-8`); +head_001.appendChild(meta_001); +{{keyword}} text_003 = document.createTextNode(` `); +head_001.appendChild(text_003); +{{keyword}} title_001 = document.createElement('title'); +{{keyword}} text_004 = document.createTextNode(`Sample`); +title_001.appendChild(text_004); +head_001.appendChild(title_001); +{{keyword}} text_005 = document.createTextNode(` `); +head_001.appendChild(text_005); +{{keyword}} link_001 = document.createElement('link'); +link_001.setAttribute(`rel`, `stylesheet`); +link_001.setAttribute(`href`, ``); +head_001.appendChild(link_001); {{keyword}} text_006 = document.createTextNode(` `); -html_000.appendChild(text_006); -{{keyword}} body_000 = document.createElement('body'); -{{keyword}} text_007 = document.createTextNode(` `); -body_000.appendChild(text_007); -{{keyword}} div_000 = document.createElement('div'); -div_000.setAttribute(`id`, `container`); -{{keyword}} text_008 = document.createTextNode(` `); -div_000.appendChild(text_008); +head_001.appendChild(text_006); +html_001.appendChild(head_001); +{{keyword}} text_007 = document.createTextNode(` `); +html_001.appendChild(text_007); +{{keyword}} body_001 = document.createElement('body'); +{{keyword}} text_008 = document.createTextNode(` `); +body_001.appendChild(text_008); {{keyword}} div_001 = document.createElement('div'); -div_001.setAttribute(`id`, `header`); -{{keyword}} text_009 = document.createTextNode(` `); +div_001.setAttribute(`id`, `container`); +{{keyword}} text_009 = document.createTextNode(` `); div_001.appendChild(text_009); -{{keyword}} comment_000 = document.createComment(` Sample H1 `); -div_001.appendChild(comment_000); -{{keyword}} text_010 = document.createTextNode(` `); -div_001.appendChild(text_010); -{{keyword}} h1_000 = document.createElement('h1'); -{{keyword}} text_011 = document.createTextNode(`Sample`); -h1_000.appendChild(text_011); -div_001.appendChild(h1_000); -{{keyword}} text_012 = document.createTextNode(` `); -div_001.appendChild(text_012); -{{keyword}} img_000 = document.createElement('img'); -img_000.setAttribute(`src`, `kanye.jpg`); -img_000.setAttribute(`alt`, `kanye`); -div_001.appendChild(img_000); -{{keyword}} text_013 = document.createTextNode(` `); -div_001.appendChild(text_013); -div_000.appendChild(div_001); -{{keyword}} text_014 = document.createTextNode(` `); -div_000.appendChild(text_014); {{keyword}} div_002 = document.createElement('div'); -div_002.setAttribute(`id`, `main`); -{{keyword}} text_015 = document.createTextNode(` `); -div_002.appendChild(text_015); -{{keyword}} h2_000 = document.createElement('h2'); -{{keyword}} text_016 = document.createTextNode(`Main`); -h2_000.appendChild(text_016); -div_002.appendChild(h2_000); -{{keyword}} text_017 = document.createTextNode(` `); -div_002.appendChild(text_017); -{{keyword}} p_000 = document.createElement('p'); -{{keyword}} text_018 = document.createTextNode(`This is the main content.`); -p_000.appendChild(text_018); -div_002.appendChild(p_000); -{{keyword}} text_019 = document.createTextNode(` `); -div_002.appendChild(text_019); +div_002.setAttribute(`id`, `header`); +{{keyword}} text_010 = document.createTextNode(` `); +div_002.appendChild(text_010); +{{keyword}} comment_001 = document.createComment(` Sample H1 `); +div_002.appendChild(comment_001); +{{keyword}} text_011 = document.createTextNode(` `); +div_002.appendChild(text_011); +{{keyword}} h1_001 = document.createElement('h1'); +{{keyword}} text_012 = document.createTextNode(`Sample`); +h1_001.appendChild(text_012); +div_002.appendChild(h1_001); +{{keyword}} text_013 = document.createTextNode(` `); +div_002.appendChild(text_013); {{keyword}} img_001 = document.createElement('img'); -img_001.setAttribute(`src`, ``); -img_001.setAttribute(`alt`, ``); +img_001.setAttribute(`src`, `kanye.jpg`); +img_001.setAttribute(`alt`, `kanye`); div_002.appendChild(img_001); -{{keyword}} text_020 = document.createTextNode(` `); -div_002.appendChild(text_020); -div_000.appendChild(div_002); -{{keyword}} text_021 = document.createTextNode(` `); -div_000.appendChild(text_021); +{{keyword}} text_014 = document.createTextNode(` `); +div_002.appendChild(text_014); +div_001.appendChild(div_002); +{{keyword}} text_015 = document.createTextNode(` `); +div_001.appendChild(text_015); {{keyword}} div_003 = document.createElement('div'); -div_003.setAttribute(`id`, `footer`); -{{keyword}} text_022 = document.createTextNode(` `); -div_003.appendChild(text_022); -{{keyword}} comment_001 = document.createComment(` Copyright `); -div_003.appendChild(comment_001); -{{keyword}} text_023 = document.createTextNode(` `); -div_003.appendChild(text_023); +div_003.setAttribute(`id`, `main`); +{{keyword}} text_016 = document.createTextNode(` `); +div_003.appendChild(text_016); +{{keyword}} h2_001 = document.createElement('h2'); +{{keyword}} text_017 = document.createTextNode(`Main`); +h2_001.appendChild(text_017); +div_003.appendChild(h2_001); +{{keyword}} text_018 = document.createTextNode(` `); +div_003.appendChild(text_018); {{keyword}} p_001 = document.createElement('p'); -{{keyword}} text_024 = document.createTextNode(`Copyright © 2019`); -p_001.appendChild(text_024); +{{keyword}} text_019 = document.createTextNode(`This is the main content.`); +p_001.appendChild(text_019); div_003.appendChild(p_001); -{{keyword}} text_025 = document.createTextNode(` `); -div_003.appendChild(text_025); -div_000.appendChild(div_003); -{{keyword}} text_026 = document.createTextNode(` `); -div_000.appendChild(text_026); -body_000.appendChild(div_000); -{{keyword}} text_027 = document.createTextNode(` `); -body_000.appendChild(text_027); -html_000.appendChild(body_000); -targetElement_000.appendChild(html_000); \ No newline at end of file +{{keyword}} text_020 = document.createTextNode(` `); +div_003.appendChild(text_020); +{{keyword}} img_002 = document.createElement('img'); +img_002.setAttribute(`src`, ``); +img_002.setAttribute(`alt`, ``); +div_003.appendChild(img_002); +{{keyword}} text_021 = document.createTextNode(` `); +div_003.appendChild(text_021); +div_001.appendChild(div_003); +{{keyword}} text_022 = document.createTextNode(` `); +div_001.appendChild(text_022); +{{keyword}} div_004 = document.createElement('div'); +div_004.setAttribute(`id`, `footer`); +{{keyword}} text_023 = document.createTextNode(` `); +div_004.appendChild(text_023); +{{keyword}} comment_002 = document.createComment(` Copyright `); +div_004.appendChild(comment_002); +{{keyword}} text_024 = document.createTextNode(` `); +div_004.appendChild(text_024); +{{keyword}} p_002 = document.createElement('p'); +{{keyword}} text_025 = document.createTextNode(`Copyright © 2019`); +p_002.appendChild(text_025); +div_004.appendChild(p_002); +{{keyword}} text_026 = document.createTextNode(` `); +div_004.appendChild(text_026); +div_001.appendChild(div_004); +{{keyword}} text_027 = document.createTextNode(` `); +div_001.appendChild(text_027); +body_001.appendChild(div_001); +{{keyword}} text_028 = document.createTextNode(` `); +body_001.appendChild(text_028); +html_001.appendChild(body_001); +targetElement_001.appendChild(html_001); \ No newline at end of file diff --git a/jsgenerator-test/jsgenerator-test-api/src/test/resources/jsFilesOutput/querySelectorAdded/commentConversionModeNotActivated/sample.js b/jsgenerator-test/jsgenerator-test-api/src/test/resources/jsFilesOutput/querySelectorAdded/commentConversionModeNotActivated/sample.js index b7eb3b53..d8f8fd50 100644 --- a/jsgenerator-test/jsgenerator-test-api/src/test/resources/jsFilesOutput/querySelectorAdded/commentConversionModeNotActivated/sample.js +++ b/jsgenerator-test/jsgenerator-test-api/src/test/resources/jsFilesOutput/querySelectorAdded/commentConversionModeNotActivated/sample.js @@ -1,100 +1,100 @@ -{{keyword}} targetElement_000 = document.querySelector(`:root > body`); -{{keyword}} html_000 = document.createElement('html'); -{{keyword}} text_000 = document.createTextNode(` `); -html_000.appendChild(text_000); -{{keyword}} head_000 = document.createElement('head'); -{{keyword}} text_001 = document.createTextNode(` `); -head_000.appendChild(text_001); -{{keyword}} meta_000 = document.createElement('meta'); -meta_000.setAttribute(`charset`, `utf-8`); -head_000.appendChild(meta_000); +{{keyword}} targetElement_001 = document.querySelector(`:root > body`); +{{keyword}} html_001 = document.createElement('html'); +{{keyword}} text_001 = document.createTextNode(` `); +html_001.appendChild(text_001); +{{keyword}} head_001 = document.createElement('head'); {{keyword}} text_002 = document.createTextNode(` `); -head_000.appendChild(text_002); -{{keyword}} title_000 = document.createElement('title'); -{{keyword}} text_003 = document.createTextNode(`Sample`); -title_000.appendChild(text_003); -head_000.appendChild(title_000); -{{keyword}} text_004 = document.createTextNode(` `); -head_000.appendChild(text_004); -{{keyword}} link_000 = document.createElement('link'); -link_000.setAttribute(`rel`, `stylesheet`); -link_000.setAttribute(`href`, ``); -head_000.appendChild(link_000); -{{keyword}} text_005 = document.createTextNode(` `); -head_000.appendChild(text_005); -html_000.appendChild(head_000); +head_001.appendChild(text_002); +{{keyword}} meta_001 = document.createElement('meta'); +meta_001.setAttribute(`charset`, `utf-8`); +head_001.appendChild(meta_001); +{{keyword}} text_003 = document.createTextNode(` `); +head_001.appendChild(text_003); +{{keyword}} title_001 = document.createElement('title'); +{{keyword}} text_004 = document.createTextNode(`Sample`); +title_001.appendChild(text_004); +head_001.appendChild(title_001); +{{keyword}} text_005 = document.createTextNode(` `); +head_001.appendChild(text_005); +{{keyword}} link_001 = document.createElement('link'); +link_001.setAttribute(`rel`, `stylesheet`); +link_001.setAttribute(`href`, ``); +head_001.appendChild(link_001); {{keyword}} text_006 = document.createTextNode(` `); -html_000.appendChild(text_006); -{{keyword}} body_000 = document.createElement('body'); -{{keyword}} text_007 = document.createTextNode(` `); -body_000.appendChild(text_007); -{{keyword}} div_000 = document.createElement('div'); -div_000.setAttribute(`id`, `container`); -{{keyword}} text_008 = document.createTextNode(` `); -div_000.appendChild(text_008); +head_001.appendChild(text_006); +html_001.appendChild(head_001); +{{keyword}} text_007 = document.createTextNode(` `); +html_001.appendChild(text_007); +{{keyword}} body_001 = document.createElement('body'); +{{keyword}} text_008 = document.createTextNode(` `); +body_001.appendChild(text_008); {{keyword}} div_001 = document.createElement('div'); -div_001.setAttribute(`id`, `header`); -{{keyword}} text_009 = document.createTextNode(` `); +div_001.setAttribute(`id`, `container`); +{{keyword}} text_009 = document.createTextNode(` `); div_001.appendChild(text_009); -{{keyword}} text_010 = document.createTextNode(` `); -div_001.appendChild(text_010); -{{keyword}} h1_000 = document.createElement('h1'); -{{keyword}} text_011 = document.createTextNode(`Sample`); -h1_000.appendChild(text_011); -div_001.appendChild(h1_000); -{{keyword}} text_012 = document.createTextNode(` `); -div_001.appendChild(text_012); -{{keyword}} img_000 = document.createElement('img'); -img_000.setAttribute(`src`, `kanye.jpg`); -img_000.setAttribute(`alt`, `kanye`); -div_001.appendChild(img_000); -{{keyword}} text_013 = document.createTextNode(` `); -div_001.appendChild(text_013); -div_000.appendChild(div_001); -{{keyword}} text_014 = document.createTextNode(` `); -div_000.appendChild(text_014); {{keyword}} div_002 = document.createElement('div'); -div_002.setAttribute(`id`, `main`); -{{keyword}} text_015 = document.createTextNode(` `); -div_002.appendChild(text_015); -{{keyword}} h2_000 = document.createElement('h2'); -{{keyword}} text_016 = document.createTextNode(`Main`); -h2_000.appendChild(text_016); -div_002.appendChild(h2_000); -{{keyword}} text_017 = document.createTextNode(` `); -div_002.appendChild(text_017); -{{keyword}} p_000 = document.createElement('p'); -{{keyword}} text_018 = document.createTextNode(`This is the main content.`); -p_000.appendChild(text_018); -div_002.appendChild(p_000); -{{keyword}} text_019 = document.createTextNode(` `); -div_002.appendChild(text_019); +div_002.setAttribute(`id`, `header`); +{{keyword}} text_010 = document.createTextNode(` `); +div_002.appendChild(text_010); +{{keyword}} text_011 = document.createTextNode(` `); +div_002.appendChild(text_011); +{{keyword}} h1_001 = document.createElement('h1'); +{{keyword}} text_012 = document.createTextNode(`Sample`); +h1_001.appendChild(text_012); +div_002.appendChild(h1_001); +{{keyword}} text_013 = document.createTextNode(` `); +div_002.appendChild(text_013); {{keyword}} img_001 = document.createElement('img'); -img_001.setAttribute(`src`, ``); -img_001.setAttribute(`alt`, ``); +img_001.setAttribute(`src`, `kanye.jpg`); +img_001.setAttribute(`alt`, `kanye`); div_002.appendChild(img_001); -{{keyword}} text_020 = document.createTextNode(` `); -div_002.appendChild(text_020); -div_000.appendChild(div_002); -{{keyword}} text_021 = document.createTextNode(` `); -div_000.appendChild(text_021); +{{keyword}} text_014 = document.createTextNode(` `); +div_002.appendChild(text_014); +div_001.appendChild(div_002); +{{keyword}} text_015 = document.createTextNode(` `); +div_001.appendChild(text_015); {{keyword}} div_003 = document.createElement('div'); -div_003.setAttribute(`id`, `footer`); -{{keyword}} text_022 = document.createTextNode(` `); -div_003.appendChild(text_022); -{{keyword}} text_023 = document.createTextNode(` `); -div_003.appendChild(text_023); +div_003.setAttribute(`id`, `main`); +{{keyword}} text_016 = document.createTextNode(` `); +div_003.appendChild(text_016); +{{keyword}} h2_001 = document.createElement('h2'); +{{keyword}} text_017 = document.createTextNode(`Main`); +h2_001.appendChild(text_017); +div_003.appendChild(h2_001); +{{keyword}} text_018 = document.createTextNode(` `); +div_003.appendChild(text_018); {{keyword}} p_001 = document.createElement('p'); -{{keyword}} text_024 = document.createTextNode(`Copyright © 2019`); -p_001.appendChild(text_024); +{{keyword}} text_019 = document.createTextNode(`This is the main content.`); +p_001.appendChild(text_019); div_003.appendChild(p_001); -{{keyword}} text_025 = document.createTextNode(` `); -div_003.appendChild(text_025); -div_000.appendChild(div_003); -{{keyword}} text_026 = document.createTextNode(` `); -div_000.appendChild(text_026); -body_000.appendChild(div_000); -{{keyword}} text_027 = document.createTextNode(` `); -body_000.appendChild(text_027); -html_000.appendChild(body_000); -targetElement_000.appendChild(html_000); \ No newline at end of file +{{keyword}} text_020 = document.createTextNode(` `); +div_003.appendChild(text_020); +{{keyword}} img_002 = document.createElement('img'); +img_002.setAttribute(`src`, ``); +img_002.setAttribute(`alt`, ``); +div_003.appendChild(img_002); +{{keyword}} text_021 = document.createTextNode(` `); +div_003.appendChild(text_021); +div_001.appendChild(div_003); +{{keyword}} text_022 = document.createTextNode(` `); +div_001.appendChild(text_022); +{{keyword}} div_004 = document.createElement('div'); +div_004.setAttribute(`id`, `footer`); +{{keyword}} text_023 = document.createTextNode(` `); +div_004.appendChild(text_023); +{{keyword}} text_024 = document.createTextNode(` `); +div_004.appendChild(text_024); +{{keyword}} p_002 = document.createElement('p'); +{{keyword}} text_025 = document.createTextNode(`Copyright © 2019`); +p_002.appendChild(text_025); +div_004.appendChild(p_002); +{{keyword}} text_026 = document.createTextNode(` `); +div_004.appendChild(text_026); +div_001.appendChild(div_004); +{{keyword}} text_027 = document.createTextNode(` `); +div_001.appendChild(text_027); +body_001.appendChild(div_001); +{{keyword}} text_028 = document.createTextNode(` `); +body_001.appendChild(text_028); +html_001.appendChild(body_001); +targetElement_001.appendChild(html_001); \ No newline at end of file diff --git a/jsgenerator-test/jsgenerator-test-api/src/test/resources/jsFilesOutput/querySelectorAdded/sample.js b/jsgenerator-test/jsgenerator-test-api/src/test/resources/jsFilesOutput/querySelectorAdded/sample.js index b0151af0..10dc53f2 100644 --- a/jsgenerator-test/jsgenerator-test-api/src/test/resources/jsFilesOutput/querySelectorAdded/sample.js +++ b/jsgenerator-test/jsgenerator-test-api/src/test/resources/jsFilesOutput/querySelectorAdded/sample.js @@ -1,96 +1,96 @@ -{{keyword}} targetElement_000 = document.querySelector(`:root > body`); -{{keyword}} html_000 = document.createElement('html'); -{{keyword}} text_000 = document.createTextNode(` `); -html_000.appendChild(text_000); -{{keyword}} head_000 = document.createElement('head'); -{{keyword}} text_001 = document.createTextNode(` `); -head_000.appendChild(text_001); -{{keyword}} meta_000 = document.createElement('meta'); -meta_000.setAttribute(`charset`, `utf-8`); -head_000.appendChild(meta_000); +{{keyword}} targetElement_001 = document.querySelector(`:root > body`); +{{keyword}} html_001 = document.createElement('html'); +{{keyword}} text_001 = document.createTextNode(` `); +html_001.appendChild(text_001); +{{keyword}} head_001 = document.createElement('head'); {{keyword}} text_002 = document.createTextNode(` `); -head_000.appendChild(text_002); -{{keyword}} title_000 = document.createElement('title'); -{{keyword}} text_003 = document.createTextNode(`Sample`); -title_000.appendChild(text_003); -head_000.appendChild(title_000); -{{keyword}} text_004 = document.createTextNode(` `); -head_000.appendChild(text_004); -{{keyword}} link_000 = document.createElement('link'); -link_000.setAttribute(`rel`, `stylesheet`); -link_000.setAttribute(`href`, ``); -head_000.appendChild(link_000); -{{keyword}} text_005 = document.createTextNode(` `); -head_000.appendChild(text_005); -html_000.appendChild(head_000); +head_001.appendChild(text_002); +{{keyword}} meta_001 = document.createElement('meta'); +meta_001.setAttribute(`charset`, `utf-8`); +head_001.appendChild(meta_001); +{{keyword}} text_003 = document.createTextNode(` `); +head_001.appendChild(text_003); +{{keyword}} title_001 = document.createElement('title'); +{{keyword}} text_004 = document.createTextNode(`Sample`); +title_001.appendChild(text_004); +head_001.appendChild(title_001); +{{keyword}} text_005 = document.createTextNode(` `); +head_001.appendChild(text_005); +{{keyword}} link_001 = document.createElement('link'); +link_001.setAttribute(`rel`, `stylesheet`); +link_001.setAttribute(`href`, ``); +head_001.appendChild(link_001); {{keyword}} text_006 = document.createTextNode(` `); -html_000.appendChild(text_006); -{{keyword}} body_000 = document.createElement('body'); -{{keyword}} text_007 = document.createTextNode(` `); -body_000.appendChild(text_007); -{{keyword}} div_000 = document.createElement('div'); -div_000.setAttribute(`id`, `container`); -{{keyword}} text_008 = document.createTextNode(` `); -div_000.appendChild(text_008); +head_001.appendChild(text_006); +html_001.appendChild(head_001); +{{keyword}} text_007 = document.createTextNode(` `); +html_001.appendChild(text_007); +{{keyword}} body_001 = document.createElement('body'); +{{keyword}} text_008 = document.createTextNode(` `); +body_001.appendChild(text_008); {{keyword}} div_001 = document.createElement('div'); -div_001.setAttribute(`id`, `header`); -{{keyword}} text_009 = document.createTextNode(` `); +div_001.setAttribute(`id`, `container`); +{{keyword}} text_009 = document.createTextNode(` `); div_001.appendChild(text_009); -{{keyword}} h1_000 = document.createElement('h1'); -{{keyword}} text_010 = document.createTextNode(`Sample`); -h1_000.appendChild(text_010); -div_001.appendChild(h1_000); -{{keyword}} text_011 = document.createTextNode(` `); -div_001.appendChild(text_011); -{{keyword}} img_000 = document.createElement('img'); -img_000.setAttribute(`src`, `kanye.jpg`); -img_000.setAttribute(`alt`, `kanye`); -div_001.appendChild(img_000); -{{keyword}} text_012 = document.createTextNode(` `); -div_001.appendChild(text_012); -div_000.appendChild(div_001); -{{keyword}} text_013 = document.createTextNode(` `); -div_000.appendChild(text_013); {{keyword}} div_002 = document.createElement('div'); -div_002.setAttribute(`id`, `main`); -{{keyword}} text_014 = document.createTextNode(` `); -div_002.appendChild(text_014); -{{keyword}} h2_000 = document.createElement('h2'); -{{keyword}} text_015 = document.createTextNode(`Main`); -h2_000.appendChild(text_015); -div_002.appendChild(h2_000); -{{keyword}} text_016 = document.createTextNode(` `); -div_002.appendChild(text_016); -{{keyword}} p_000 = document.createElement('p'); -{{keyword}} text_017 = document.createTextNode(`This is the main content.`); -p_000.appendChild(text_017); -div_002.appendChild(p_000); -{{keyword}} text_018 = document.createTextNode(` `); -div_002.appendChild(text_018); +div_002.setAttribute(`id`, `header`); +{{keyword}} text_010 = document.createTextNode(` `); +div_002.appendChild(text_010); +{{keyword}} h1_001 = document.createElement('h1'); +{{keyword}} text_011 = document.createTextNode(`Sample`); +h1_001.appendChild(text_011); +div_002.appendChild(h1_001); +{{keyword}} text_012 = document.createTextNode(` `); +div_002.appendChild(text_012); {{keyword}} img_001 = document.createElement('img'); -img_001.setAttribute(`src`, ``); -img_001.setAttribute(`alt`, ``); +img_001.setAttribute(`src`, `kanye.jpg`); +img_001.setAttribute(`alt`, `kanye`); div_002.appendChild(img_001); -{{keyword}} text_019 = document.createTextNode(` `); -div_002.appendChild(text_019); -div_000.appendChild(div_002); -{{keyword}} text_020 = document.createTextNode(` `); -div_000.appendChild(text_020); +{{keyword}} text_013 = document.createTextNode(` `); +div_002.appendChild(text_013); +div_001.appendChild(div_002); +{{keyword}} text_014 = document.createTextNode(` `); +div_001.appendChild(text_014); {{keyword}} div_003 = document.createElement('div'); -div_003.setAttribute(`id`, `footer`); -{{keyword}} text_021 = document.createTextNode(` `); -div_003.appendChild(text_021); +div_003.setAttribute(`id`, `main`); +{{keyword}} text_015 = document.createTextNode(` `); +div_003.appendChild(text_015); +{{keyword}} h2_001 = document.createElement('h2'); +{{keyword}} text_016 = document.createTextNode(`Main`); +h2_001.appendChild(text_016); +div_003.appendChild(h2_001); +{{keyword}} text_017 = document.createTextNode(` `); +div_003.appendChild(text_017); {{keyword}} p_001 = document.createElement('p'); -{{keyword}} text_022 = document.createTextNode(`Copyright - 2019`); -p_001.appendChild(text_022); +{{keyword}} text_018 = document.createTextNode(`This is the main content.`); +p_001.appendChild(text_018); div_003.appendChild(p_001); -{{keyword}} text_023 = document.createTextNode(` `); -div_003.appendChild(text_023); -div_000.appendChild(div_003); -{{keyword}} text_024 = document.createTextNode(` `); -div_000.appendChild(text_024); -body_000.appendChild(div_000); -{{keyword}} text_025 = document.createTextNode(` `); -body_000.appendChild(text_025); -html_000.appendChild(body_000); -targetElement_000.appendChild(html_000); \ No newline at end of file +{{keyword}} text_019 = document.createTextNode(` `); +div_003.appendChild(text_019); +{{keyword}} img_002 = document.createElement('img'); +img_002.setAttribute(`src`, ``); +img_002.setAttribute(`alt`, ``); +div_003.appendChild(img_002); +{{keyword}} text_020 = document.createTextNode(` `); +div_003.appendChild(text_020); +div_001.appendChild(div_003); +{{keyword}} text_021 = document.createTextNode(` `); +div_001.appendChild(text_021); +{{keyword}} div_004 = document.createElement('div'); +div_004.setAttribute(`id`, `footer`); +{{keyword}} text_022 = document.createTextNode(` `); +div_004.appendChild(text_022); +{{keyword}} p_002 = document.createElement('p'); +{{keyword}} text_023 = document.createTextNode(`Copyright - 2019`); +p_002.appendChild(text_023); +div_004.appendChild(p_002); +{{keyword}} text_024 = document.createTextNode(` `); +div_004.appendChild(text_024); +div_001.appendChild(div_004); +{{keyword}} text_025 = document.createTextNode(` `); +div_001.appendChild(text_025); +body_001.appendChild(div_001); +{{keyword}} text_026 = document.createTextNode(` `); +body_001.appendChild(text_026); +html_001.appendChild(body_001); +targetElement_001.appendChild(html_001); \ No newline at end of file diff --git a/jsgenerator-test/jsgenerator-test-api/src/test/resources/jsFilesOutput/querySelectorNotAdded/commentConversionModeActivated/sample.js b/jsgenerator-test/jsgenerator-test-api/src/test/resources/jsFilesOutput/querySelectorNotAdded/commentConversionModeActivated/sample.js index 6ab80134..1b7ff5af 100644 --- a/jsgenerator-test/jsgenerator-test-api/src/test/resources/jsFilesOutput/querySelectorNotAdded/commentConversionModeActivated/sample.js +++ b/jsgenerator-test/jsgenerator-test-api/src/test/resources/jsFilesOutput/querySelectorNotAdded/commentConversionModeActivated/sample.js @@ -1,102 +1,102 @@ -{{keyword}} html_000 = document.createElement('html'); -{{keyword}} text_000 = document.createTextNode(` `); -html_000.appendChild(text_000); -{{keyword}} head_000 = document.createElement('head'); -{{keyword}} text_001 = document.createTextNode(` `); -head_000.appendChild(text_001); -{{keyword}} meta_000 = document.createElement('meta'); -meta_000.setAttribute(`charset`, `utf-8`); -head_000.appendChild(meta_000); +{{keyword}} html_001 = document.createElement('html'); +{{keyword}} text_001 = document.createTextNode(` `); +html_001.appendChild(text_001); +{{keyword}} head_001 = document.createElement('head'); {{keyword}} text_002 = document.createTextNode(` `); -head_000.appendChild(text_002); -{{keyword}} title_000 = document.createElement('title'); -{{keyword}} text_003 = document.createTextNode(`Sample`); -title_000.appendChild(text_003); -head_000.appendChild(title_000); -{{keyword}} text_004 = document.createTextNode(` `); -head_000.appendChild(text_004); -{{keyword}} link_000 = document.createElement('link'); -link_000.setAttribute(`rel`, `stylesheet`); -link_000.setAttribute(`href`, ``); -head_000.appendChild(link_000); -{{keyword}} text_005 = document.createTextNode(` `); -head_000.appendChild(text_005); -html_000.appendChild(head_000); +head_001.appendChild(text_002); +{{keyword}} meta_001 = document.createElement('meta'); +meta_001.setAttribute(`charset`, `utf-8`); +head_001.appendChild(meta_001); +{{keyword}} text_003 = document.createTextNode(` `); +head_001.appendChild(text_003); +{{keyword}} title_001 = document.createElement('title'); +{{keyword}} text_004 = document.createTextNode(`Sample`); +title_001.appendChild(text_004); +head_001.appendChild(title_001); +{{keyword}} text_005 = document.createTextNode(` `); +head_001.appendChild(text_005); +{{keyword}} link_001 = document.createElement('link'); +link_001.setAttribute(`rel`, `stylesheet`); +link_001.setAttribute(`href`, ``); +head_001.appendChild(link_001); {{keyword}} text_006 = document.createTextNode(` `); -html_000.appendChild(text_006); -{{keyword}} body_000 = document.createElement('body'); -{{keyword}} text_007 = document.createTextNode(` `); -body_000.appendChild(text_007); -{{keyword}} div_000 = document.createElement('div'); -div_000.setAttribute(`id`, `container`); -{{keyword}} text_008 = document.createTextNode(` `); -div_000.appendChild(text_008); +head_001.appendChild(text_006); +html_001.appendChild(head_001); +{{keyword}} text_007 = document.createTextNode(` `); +html_001.appendChild(text_007); +{{keyword}} body_001 = document.createElement('body'); +{{keyword}} text_008 = document.createTextNode(` `); +body_001.appendChild(text_008); {{keyword}} div_001 = document.createElement('div'); -div_001.setAttribute(`id`, `header`); -{{keyword}} text_009 = document.createTextNode(` `); +div_001.setAttribute(`id`, `container`); +{{keyword}} text_009 = document.createTextNode(` `); div_001.appendChild(text_009); -{{keyword}} comment_000 = document.createComment(` Sample H1 `); -div_001.appendChild(comment_000); -{{keyword}} text_010 = document.createTextNode(` `); -div_001.appendChild(text_010); -{{keyword}} h1_000 = document.createElement('h1'); -{{keyword}} text_011 = document.createTextNode(`Sample`); -h1_000.appendChild(text_011); -div_001.appendChild(h1_000); -{{keyword}} text_012 = document.createTextNode(` `); -div_001.appendChild(text_012); -{{keyword}} img_000 = document.createElement('img'); -img_000.setAttribute(`src`, `kanye.jpg`); -img_000.setAttribute(`alt`, `kanye`); -div_001.appendChild(img_000); -{{keyword}} text_013 = document.createTextNode(` `); -div_001.appendChild(text_013); -div_000.appendChild(div_001); -{{keyword}} text_014 = document.createTextNode(` `); -div_000.appendChild(text_014); {{keyword}} div_002 = document.createElement('div'); -div_002.setAttribute(`id`, `main`); -{{keyword}} text_015 = document.createTextNode(` `); -div_002.appendChild(text_015); -{{keyword}} h2_000 = document.createElement('h2'); -{{keyword}} text_016 = document.createTextNode(`Main`); -h2_000.appendChild(text_016); -div_002.appendChild(h2_000); -{{keyword}} text_017 = document.createTextNode(` `); -div_002.appendChild(text_017); -{{keyword}} p_000 = document.createElement('p'); -{{keyword}} text_018 = document.createTextNode(`This is the main content.`); -p_000.appendChild(text_018); -div_002.appendChild(p_000); -{{keyword}} text_019 = document.createTextNode(` `); -div_002.appendChild(text_019); +div_002.setAttribute(`id`, `header`); +{{keyword}} text_010 = document.createTextNode(` `); +div_002.appendChild(text_010); +{{keyword}} comment_001 = document.createComment(` Sample H1 `); +div_002.appendChild(comment_001); +{{keyword}} text_011 = document.createTextNode(` `); +div_002.appendChild(text_011); +{{keyword}} h1_001 = document.createElement('h1'); +{{keyword}} text_012 = document.createTextNode(`Sample`); +h1_001.appendChild(text_012); +div_002.appendChild(h1_001); +{{keyword}} text_013 = document.createTextNode(` `); +div_002.appendChild(text_013); {{keyword}} img_001 = document.createElement('img'); -img_001.setAttribute(`src`, ``); -img_001.setAttribute(`alt`, ``); +img_001.setAttribute(`src`, `kanye.jpg`); +img_001.setAttribute(`alt`, `kanye`); div_002.appendChild(img_001); -{{keyword}} text_020 = document.createTextNode(` `); -div_002.appendChild(text_020); -div_000.appendChild(div_002); -{{keyword}} text_021 = document.createTextNode(` `); -div_000.appendChild(text_021); +{{keyword}} text_014 = document.createTextNode(` `); +div_002.appendChild(text_014); +div_001.appendChild(div_002); +{{keyword}} text_015 = document.createTextNode(` `); +div_001.appendChild(text_015); {{keyword}} div_003 = document.createElement('div'); -div_003.setAttribute(`id`, `footer`); -{{keyword}} text_022 = document.createTextNode(` `); -div_003.appendChild(text_022); -{{keyword}} comment_001 = document.createComment(` Copyright `); -div_003.appendChild(comment_001); -{{keyword}} text_023 = document.createTextNode(` `); -div_003.appendChild(text_023); +div_003.setAttribute(`id`, `main`); +{{keyword}} text_016 = document.createTextNode(` `); +div_003.appendChild(text_016); +{{keyword}} h2_001 = document.createElement('h2'); +{{keyword}} text_017 = document.createTextNode(`Main`); +h2_001.appendChild(text_017); +div_003.appendChild(h2_001); +{{keyword}} text_018 = document.createTextNode(` `); +div_003.appendChild(text_018); {{keyword}} p_001 = document.createElement('p'); -{{keyword}} text_024 = document.createTextNode(`Copyright © 2019`); -p_001.appendChild(text_024); +{{keyword}} text_019 = document.createTextNode(`This is the main content.`); +p_001.appendChild(text_019); div_003.appendChild(p_001); -{{keyword}} text_025 = document.createTextNode(` `); -div_003.appendChild(text_025); -div_000.appendChild(div_003); -{{keyword}} text_026 = document.createTextNode(` `); -div_000.appendChild(text_026); -body_000.appendChild(div_000); -{{keyword}} text_027 = document.createTextNode(` `); -body_000.appendChild(text_027); -html_000.appendChild(body_000); \ No newline at end of file +{{keyword}} text_020 = document.createTextNode(` `); +div_003.appendChild(text_020); +{{keyword}} img_002 = document.createElement('img'); +img_002.setAttribute(`src`, ``); +img_002.setAttribute(`alt`, ``); +div_003.appendChild(img_002); +{{keyword}} text_021 = document.createTextNode(` `); +div_003.appendChild(text_021); +div_001.appendChild(div_003); +{{keyword}} text_022 = document.createTextNode(` `); +div_001.appendChild(text_022); +{{keyword}} div_004 = document.createElement('div'); +div_004.setAttribute(`id`, `footer`); +{{keyword}} text_023 = document.createTextNode(` `); +div_004.appendChild(text_023); +{{keyword}} comment_002 = document.createComment(` Copyright `); +div_004.appendChild(comment_002); +{{keyword}} text_024 = document.createTextNode(` `); +div_004.appendChild(text_024); +{{keyword}} p_002 = document.createElement('p'); +{{keyword}} text_025 = document.createTextNode(`Copyright © 2019`); +p_002.appendChild(text_025); +div_004.appendChild(p_002); +{{keyword}} text_026 = document.createTextNode(` `); +div_004.appendChild(text_026); +div_001.appendChild(div_004); +{{keyword}} text_027 = document.createTextNode(` `); +div_001.appendChild(text_027); +body_001.appendChild(div_001); +{{keyword}} text_028 = document.createTextNode(` `); +body_001.appendChild(text_028); +html_001.appendChild(body_001); \ No newline at end of file diff --git a/jsgenerator-test/jsgenerator-test-api/src/test/resources/jsFilesOutput/querySelectorNotAdded/commentConversionModeNotActivated/sample.js b/jsgenerator-test/jsgenerator-test-api/src/test/resources/jsFilesOutput/querySelectorNotAdded/commentConversionModeNotActivated/sample.js index 11731262..ce7e66f5 100644 --- a/jsgenerator-test/jsgenerator-test-api/src/test/resources/jsFilesOutput/querySelectorNotAdded/commentConversionModeNotActivated/sample.js +++ b/jsgenerator-test/jsgenerator-test-api/src/test/resources/jsFilesOutput/querySelectorNotAdded/commentConversionModeNotActivated/sample.js @@ -1,98 +1,98 @@ -{{keyword}} html_000 = document.createElement('html'); -{{keyword}} text_000 = document.createTextNode(` `); -html_000.appendChild(text_000); -{{keyword}} head_000 = document.createElement('head'); -{{keyword}} text_001 = document.createTextNode(` `); -head_000.appendChild(text_001); -{{keyword}} meta_000 = document.createElement('meta'); -meta_000.setAttribute(`charset`, `utf-8`); -head_000.appendChild(meta_000); +{{keyword}} html_001 = document.createElement('html'); +{{keyword}} text_001 = document.createTextNode(` `); +html_001.appendChild(text_001); +{{keyword}} head_001 = document.createElement('head'); {{keyword}} text_002 = document.createTextNode(` `); -head_000.appendChild(text_002); -{{keyword}} title_000 = document.createElement('title'); -{{keyword}} text_003 = document.createTextNode(`Sample`); -title_000.appendChild(text_003); -head_000.appendChild(title_000); -{{keyword}} text_004 = document.createTextNode(` `); -head_000.appendChild(text_004); -{{keyword}} link_000 = document.createElement('link'); -link_000.setAttribute(`rel`, `stylesheet`); -link_000.setAttribute(`href`, ``); -head_000.appendChild(link_000); -{{keyword}} text_005 = document.createTextNode(` `); -head_000.appendChild(text_005); -html_000.appendChild(head_000); +head_001.appendChild(text_002); +{{keyword}} meta_001 = document.createElement('meta'); +meta_001.setAttribute(`charset`, `utf-8`); +head_001.appendChild(meta_001); +{{keyword}} text_003 = document.createTextNode(` `); +head_001.appendChild(text_003); +{{keyword}} title_001 = document.createElement('title'); +{{keyword}} text_004 = document.createTextNode(`Sample`); +title_001.appendChild(text_004); +head_001.appendChild(title_001); +{{keyword}} text_005 = document.createTextNode(` `); +head_001.appendChild(text_005); +{{keyword}} link_001 = document.createElement('link'); +link_001.setAttribute(`rel`, `stylesheet`); +link_001.setAttribute(`href`, ``); +head_001.appendChild(link_001); {{keyword}} text_006 = document.createTextNode(` `); -html_000.appendChild(text_006); -{{keyword}} body_000 = document.createElement('body'); -{{keyword}} text_007 = document.createTextNode(` `); -body_000.appendChild(text_007); -{{keyword}} div_000 = document.createElement('div'); -div_000.setAttribute(`id`, `container`); -{{keyword}} text_008 = document.createTextNode(` `); -div_000.appendChild(text_008); +head_001.appendChild(text_006); +html_001.appendChild(head_001); +{{keyword}} text_007 = document.createTextNode(` `); +html_001.appendChild(text_007); +{{keyword}} body_001 = document.createElement('body'); +{{keyword}} text_008 = document.createTextNode(` `); +body_001.appendChild(text_008); {{keyword}} div_001 = document.createElement('div'); -div_001.setAttribute(`id`, `header`); -{{keyword}} text_009 = document.createTextNode(` `); +div_001.setAttribute(`id`, `container`); +{{keyword}} text_009 = document.createTextNode(` `); div_001.appendChild(text_009); -{{keyword}} text_010 = document.createTextNode(` `); -div_001.appendChild(text_010); -{{keyword}} h1_000 = document.createElement('h1'); -{{keyword}} text_011 = document.createTextNode(`Sample`); -h1_000.appendChild(text_011); -div_001.appendChild(h1_000); -{{keyword}} text_012 = document.createTextNode(` `); -div_001.appendChild(text_012); -{{keyword}} img_000 = document.createElement('img'); -img_000.setAttribute(`src`, `kanye.jpg`); -img_000.setAttribute(`alt`, `kanye`); -div_001.appendChild(img_000); -{{keyword}} text_013 = document.createTextNode(` `); -div_001.appendChild(text_013); -div_000.appendChild(div_001); -{{keyword}} text_014 = document.createTextNode(` `); -div_000.appendChild(text_014); {{keyword}} div_002 = document.createElement('div'); -div_002.setAttribute(`id`, `main`); -{{keyword}} text_015 = document.createTextNode(` `); -div_002.appendChild(text_015); -{{keyword}} h2_000 = document.createElement('h2'); -{{keyword}} text_016 = document.createTextNode(`Main`); -h2_000.appendChild(text_016); -div_002.appendChild(h2_000); -{{keyword}} text_017 = document.createTextNode(` `); -div_002.appendChild(text_017); -{{keyword}} p_000 = document.createElement('p'); -{{keyword}} text_018 = document.createTextNode(`This is the main content.`); -p_000.appendChild(text_018); -div_002.appendChild(p_000); -{{keyword}} text_019 = document.createTextNode(` `); -div_002.appendChild(text_019); +div_002.setAttribute(`id`, `header`); +{{keyword}} text_010 = document.createTextNode(` `); +div_002.appendChild(text_010); +{{keyword}} text_011 = document.createTextNode(` `); +div_002.appendChild(text_011); +{{keyword}} h1_001 = document.createElement('h1'); +{{keyword}} text_012 = document.createTextNode(`Sample`); +h1_001.appendChild(text_012); +div_002.appendChild(h1_001); +{{keyword}} text_013 = document.createTextNode(` `); +div_002.appendChild(text_013); {{keyword}} img_001 = document.createElement('img'); -img_001.setAttribute(`src`, ``); -img_001.setAttribute(`alt`, ``); +img_001.setAttribute(`src`, `kanye.jpg`); +img_001.setAttribute(`alt`, `kanye`); div_002.appendChild(img_001); -{{keyword}} text_020 = document.createTextNode(` `); -div_002.appendChild(text_020); -div_000.appendChild(div_002); -{{keyword}} text_021 = document.createTextNode(` `); -div_000.appendChild(text_021); +{{keyword}} text_014 = document.createTextNode(` `); +div_002.appendChild(text_014); +div_001.appendChild(div_002); +{{keyword}} text_015 = document.createTextNode(` `); +div_001.appendChild(text_015); {{keyword}} div_003 = document.createElement('div'); -div_003.setAttribute(`id`, `footer`); -{{keyword}} text_022 = document.createTextNode(` `); -div_003.appendChild(text_022); -{{keyword}} text_023 = document.createTextNode(` `); -div_003.appendChild(text_023); +div_003.setAttribute(`id`, `main`); +{{keyword}} text_016 = document.createTextNode(` `); +div_003.appendChild(text_016); +{{keyword}} h2_001 = document.createElement('h2'); +{{keyword}} text_017 = document.createTextNode(`Main`); +h2_001.appendChild(text_017); +div_003.appendChild(h2_001); +{{keyword}} text_018 = document.createTextNode(` `); +div_003.appendChild(text_018); {{keyword}} p_001 = document.createElement('p'); -{{keyword}} text_024 = document.createTextNode(`Copyright © 2019`); -p_001.appendChild(text_024); +{{keyword}} text_019 = document.createTextNode(`This is the main content.`); +p_001.appendChild(text_019); div_003.appendChild(p_001); -{{keyword}} text_025 = document.createTextNode(` `); -div_003.appendChild(text_025); -div_000.appendChild(div_003); -{{keyword}} text_026 = document.createTextNode(` `); -div_000.appendChild(text_026); -body_000.appendChild(div_000); -{{keyword}} text_027 = document.createTextNode(` `); -body_000.appendChild(text_027); -html_000.appendChild(body_000); \ No newline at end of file +{{keyword}} text_020 = document.createTextNode(` `); +div_003.appendChild(text_020); +{{keyword}} img_002 = document.createElement('img'); +img_002.setAttribute(`src`, ``); +img_002.setAttribute(`alt`, ``); +div_003.appendChild(img_002); +{{keyword}} text_021 = document.createTextNode(` `); +div_003.appendChild(text_021); +div_001.appendChild(div_003); +{{keyword}} text_022 = document.createTextNode(` `); +div_001.appendChild(text_022); +{{keyword}} div_004 = document.createElement('div'); +div_004.setAttribute(`id`, `footer`); +{{keyword}} text_023 = document.createTextNode(` `); +div_004.appendChild(text_023); +{{keyword}} text_024 = document.createTextNode(` `); +div_004.appendChild(text_024); +{{keyword}} p_002 = document.createElement('p'); +{{keyword}} text_025 = document.createTextNode(`Copyright © 2019`); +p_002.appendChild(text_025); +div_004.appendChild(p_002); +{{keyword}} text_026 = document.createTextNode(` `); +div_004.appendChild(text_026); +div_001.appendChild(div_004); +{{keyword}} text_027 = document.createTextNode(` `); +div_001.appendChild(text_027); +body_001.appendChild(div_001); +{{keyword}} text_028 = document.createTextNode(` `); +body_001.appendChild(text_028); +html_001.appendChild(body_001); \ No newline at end of file diff --git a/jsgenerator-test/jsgenerator-test-api/src/test/resources/jsFilesOutput/querySelectorNotAdded/sample.js b/jsgenerator-test/jsgenerator-test-api/src/test/resources/jsFilesOutput/querySelectorNotAdded/sample.js index e63b7bfb..d50660f7 100644 --- a/jsgenerator-test/jsgenerator-test-api/src/test/resources/jsFilesOutput/querySelectorNotAdded/sample.js +++ b/jsgenerator-test/jsgenerator-test-api/src/test/resources/jsFilesOutput/querySelectorNotAdded/sample.js @@ -1,94 +1,94 @@ -{{keyword}} html_000 = document.createElement('html'); -{{keyword}} text_000 = document.createTextNode(` `); -html_000.appendChild(text_000); -{{keyword}} head_000 = document.createElement('head'); -{{keyword}} text_001 = document.createTextNode(` `); -head_000.appendChild(text_001); -{{keyword}} meta_000 = document.createElement('meta'); -meta_000.setAttribute(`charset`, `utf-8`); -head_000.appendChild(meta_000); +{{keyword}} html_001 = document.createElement('html'); +{{keyword}} text_001 = document.createTextNode(` `); +html_001.appendChild(text_001); +{{keyword}} head_001 = document.createElement('head'); {{keyword}} text_002 = document.createTextNode(` `); -head_000.appendChild(text_002); -{{keyword}} title_000 = document.createElement('title'); -{{keyword}} text_003 = document.createTextNode(`Sample`); -title_000.appendChild(text_003); -head_000.appendChild(title_000); -{{keyword}} text_004 = document.createTextNode(` `); -head_000.appendChild(text_004); -{{keyword}} link_000 = document.createElement('link'); -link_000.setAttribute(`rel`, `stylesheet`); -link_000.setAttribute(`href`, ``); -head_000.appendChild(link_000); -{{keyword}} text_005 = document.createTextNode(` `); -head_000.appendChild(text_005); -html_000.appendChild(head_000); +head_001.appendChild(text_002); +{{keyword}} meta_001 = document.createElement('meta'); +meta_001.setAttribute(`charset`, `utf-8`); +head_001.appendChild(meta_001); +{{keyword}} text_003 = document.createTextNode(` `); +head_001.appendChild(text_003); +{{keyword}} title_001 = document.createElement('title'); +{{keyword}} text_004 = document.createTextNode(`Sample`); +title_001.appendChild(text_004); +head_001.appendChild(title_001); +{{keyword}} text_005 = document.createTextNode(` `); +head_001.appendChild(text_005); +{{keyword}} link_001 = document.createElement('link'); +link_001.setAttribute(`rel`, `stylesheet`); +link_001.setAttribute(`href`, ``); +head_001.appendChild(link_001); {{keyword}} text_006 = document.createTextNode(` `); -html_000.appendChild(text_006); -{{keyword}} body_000 = document.createElement('body'); -{{keyword}} text_007 = document.createTextNode(` `); -body_000.appendChild(text_007); -{{keyword}} div_000 = document.createElement('div'); -div_000.setAttribute(`id`, `container`); -{{keyword}} text_008 = document.createTextNode(` `); -div_000.appendChild(text_008); +head_001.appendChild(text_006); +html_001.appendChild(head_001); +{{keyword}} text_007 = document.createTextNode(` `); +html_001.appendChild(text_007); +{{keyword}} body_001 = document.createElement('body'); +{{keyword}} text_008 = document.createTextNode(` `); +body_001.appendChild(text_008); {{keyword}} div_001 = document.createElement('div'); -div_001.setAttribute(`id`, `header`); -{{keyword}} text_009 = document.createTextNode(` `); +div_001.setAttribute(`id`, `container`); +{{keyword}} text_009 = document.createTextNode(` `); div_001.appendChild(text_009); -{{keyword}} h1_000 = document.createElement('h1'); -{{keyword}} text_010 = document.createTextNode(`Sample`); -h1_000.appendChild(text_010); -div_001.appendChild(h1_000); -{{keyword}} text_011 = document.createTextNode(` `); -div_001.appendChild(text_011); -{{keyword}} img_000 = document.createElement('img'); -img_000.setAttribute(`src`, `kanye.jpg`); -img_000.setAttribute(`alt`, `kanye`); -div_001.appendChild(img_000); -{{keyword}} text_012 = document.createTextNode(` `); -div_001.appendChild(text_012); -div_000.appendChild(div_001); -{{keyword}} text_013 = document.createTextNode(` `); -div_000.appendChild(text_013); {{keyword}} div_002 = document.createElement('div'); -div_002.setAttribute(`id`, `main`); -{{keyword}} text_014 = document.createTextNode(` `); -div_002.appendChild(text_014); -{{keyword}} h2_000 = document.createElement('h2'); -{{keyword}} text_015 = document.createTextNode(`Main`); -h2_000.appendChild(text_015); -div_002.appendChild(h2_000); -{{keyword}} text_016 = document.createTextNode(` `); -div_002.appendChild(text_016); -{{keyword}} p_000 = document.createElement('p'); -{{keyword}} text_017 = document.createTextNode(`This is the main content.`); -p_000.appendChild(text_017); -div_002.appendChild(p_000); -{{keyword}} text_018 = document.createTextNode(` `); -div_002.appendChild(text_018); +div_002.setAttribute(`id`, `header`); +{{keyword}} text_010 = document.createTextNode(` `); +div_002.appendChild(text_010); +{{keyword}} h1_001 = document.createElement('h1'); +{{keyword}} text_011 = document.createTextNode(`Sample`); +h1_001.appendChild(text_011); +div_002.appendChild(h1_001); +{{keyword}} text_012 = document.createTextNode(` `); +div_002.appendChild(text_012); {{keyword}} img_001 = document.createElement('img'); -img_001.setAttribute(`src`, ``); -img_001.setAttribute(`alt`, ``); +img_001.setAttribute(`src`, `kanye.jpg`); +img_001.setAttribute(`alt`, `kanye`); div_002.appendChild(img_001); -{{keyword}} text_019 = document.createTextNode(` `); -div_002.appendChild(text_019); -div_000.appendChild(div_002); -{{keyword}} text_020 = document.createTextNode(` `); -div_000.appendChild(text_020); +{{keyword}} text_013 = document.createTextNode(` `); +div_002.appendChild(text_013); +div_001.appendChild(div_002); +{{keyword}} text_014 = document.createTextNode(` `); +div_001.appendChild(text_014); {{keyword}} div_003 = document.createElement('div'); -div_003.setAttribute(`id`, `footer`); -{{keyword}} text_021 = document.createTextNode(` `); -div_003.appendChild(text_021); +div_003.setAttribute(`id`, `main`); +{{keyword}} text_015 = document.createTextNode(` `); +div_003.appendChild(text_015); +{{keyword}} h2_001 = document.createElement('h2'); +{{keyword}} text_016 = document.createTextNode(`Main`); +h2_001.appendChild(text_016); +div_003.appendChild(h2_001); +{{keyword}} text_017 = document.createTextNode(` `); +div_003.appendChild(text_017); {{keyword}} p_001 = document.createElement('p'); -{{keyword}} text_022 = document.createTextNode(`Copyright - 2019`); -p_001.appendChild(text_022); +{{keyword}} text_018 = document.createTextNode(`This is the main content.`); +p_001.appendChild(text_018); div_003.appendChild(p_001); -{{keyword}} text_023 = document.createTextNode(` `); -div_003.appendChild(text_023); -div_000.appendChild(div_003); -{{keyword}} text_024 = document.createTextNode(` `); -div_000.appendChild(text_024); -body_000.appendChild(div_000); -{{keyword}} text_025 = document.createTextNode(` `); -body_000.appendChild(text_025); -html_000.appendChild(body_000); \ No newline at end of file +{{keyword}} text_019 = document.createTextNode(` `); +div_003.appendChild(text_019); +{{keyword}} img_002 = document.createElement('img'); +img_002.setAttribute(`src`, ``); +img_002.setAttribute(`alt`, ``); +div_003.appendChild(img_002); +{{keyword}} text_020 = document.createTextNode(` `); +div_003.appendChild(text_020); +div_001.appendChild(div_003); +{{keyword}} text_021 = document.createTextNode(` `); +div_001.appendChild(text_021); +{{keyword}} div_004 = document.createElement('div'); +div_004.setAttribute(`id`, `footer`); +{{keyword}} text_022 = document.createTextNode(` `); +div_004.appendChild(text_022); +{{keyword}} p_002 = document.createElement('p'); +{{keyword}} text_023 = document.createTextNode(`Copyright - 2019`); +p_002.appendChild(text_023); +div_004.appendChild(p_002); +{{keyword}} text_024 = document.createTextNode(` `); +div_004.appendChild(text_024); +div_001.appendChild(div_004); +{{keyword}} text_025 = document.createTextNode(` `); +div_001.appendChild(text_025); +body_001.appendChild(div_001); +{{keyword}} text_026 = document.createTextNode(` `); +body_001.appendChild(text_026); +html_001.appendChild(body_001); \ No newline at end of file diff --git a/jsgenerator-test/jsgenerator-test-core/src/test/java/com/osscameroon/jsgenerator/test/core/ConverterTest.java b/jsgenerator-test/jsgenerator-test-core/src/test/java/com/osscameroon/jsgenerator/test/core/ConverterTest.java index a179682b..102f13f8 100644 --- a/jsgenerator-test/jsgenerator-test-core/src/test/java/com/osscameroon/jsgenerator/test/core/ConverterTest.java +++ b/jsgenerator-test/jsgenerator-test-core/src/test/java/com/osscameroon/jsgenerator/test/core/ConverterTest.java @@ -5,7 +5,6 @@ import com.osscameroon.jsgenerator.core.VariableDeclaration; import lombok.NonNull; import org.junit.jupiter.api.BeforeEach; -import org.junit.jupiter.api.Disabled; import org.junit.jupiter.api.extension.ExtendWith; import org.junit.jupiter.params.ParameterizedTest; import org.junit.jupiter.params.provider.Arguments; @@ -188,68 +187,68 @@ void comparisonBetweenJsGeneratorAndOtherConverters(final VariableDeclaration va if (querySelectorAdded) { - assertThat(converted).containsExactly( "%s targetElement_000 = document.querySelector(`:root > body`);".formatted(keyword), - "%s h1_000 = document.createElement('h1');".formatted(keyword), - "%s text_000 = document.createTextNode(`HTML To JavaScript`);".formatted(keyword), - "h1_000.appendChild(text_000);", - "targetElement_000.appendChild(h1_000);", - "%s ol_000 = document.createElement('ol');".formatted(keyword), - "%s text_001 = document.createTextNode(` `);".formatted(keyword), - "ol_000.appendChild(text_001);", - "%s li_000 = document.createElement('li');".formatted(keyword), - "%s text_002 = document.createTextNode(`First item`);".formatted(keyword), - "li_000.appendChild(text_002);", - "ol_000.appendChild(li_000);", - "%s text_003 = document.createTextNode(` `);".formatted(keyword), - "ol_000.appendChild(text_003);", + assertThat(converted).containsExactly( "%s targetElement_001 = document.querySelector(`:root > body`);".formatted(keyword), + "%s h1_001 = document.createElement('h1');".formatted(keyword), + "%s text_001 = document.createTextNode(`HTML To JavaScript`);".formatted(keyword), + "h1_001.appendChild(text_001);", + "targetElement_001.appendChild(h1_001);", + "%s ol_001 = document.createElement('ol');".formatted(keyword), + "%s text_002 = document.createTextNode(` `);".formatted(keyword), + "ol_001.appendChild(text_002);", "%s li_001 = document.createElement('li');".formatted(keyword), - "%s text_004 = document.createTextNode(`Second item`);".formatted(keyword), - "li_001.appendChild(text_004);", - "ol_000.appendChild(li_001);", - "%s text_005 = document.createTextNode(` `);".formatted(keyword), - "ol_000.appendChild(text_005);", + "%s text_003 = document.createTextNode(`First item`);".formatted(keyword), + "li_001.appendChild(text_003);", + "ol_001.appendChild(li_001);", + "%s text_004 = document.createTextNode(` `);".formatted(keyword), + "ol_001.appendChild(text_004);", "%s li_002 = document.createElement('li');".formatted(keyword), - "%s text_006 = document.createTextNode(`Third item`);".formatted(keyword), - "li_002.appendChild(text_006);", - "ol_000.appendChild(li_002);", - "%s text_007 = document.createTextNode(` `);".formatted(keyword), - "ol_000.appendChild(text_007);", + "%s text_005 = document.createTextNode(`Second item`);".formatted(keyword), + "li_002.appendChild(text_005);", + "ol_001.appendChild(li_002);", + "%s text_006 = document.createTextNode(` `);".formatted(keyword), + "ol_001.appendChild(text_006);", "%s li_003 = document.createElement('li');".formatted(keyword), - "%s text_008 = document.createTextNode(`Fourth item`);".formatted(keyword), - "li_003.appendChild(text_008);", - "ol_000.appendChild(li_003);", - "targetElement_000.appendChild(ol_000);" + "%s text_007 = document.createTextNode(`Third item`);".formatted(keyword), + "li_003.appendChild(text_007);", + "ol_001.appendChild(li_003);", + "%s text_008 = document.createTextNode(` `);".formatted(keyword), + "ol_001.appendChild(text_008);", + "%s li_004 = document.createElement('li');".formatted(keyword), + "%s text_009 = document.createTextNode(`Fourth item`);".formatted(keyword), + "li_004.appendChild(text_009);", + "ol_001.appendChild(li_004);", + "targetElement_001.appendChild(ol_001);" ); } else { assertThat(converted).containsExactly( - "%s h1_000 = document.createElement('h1');".formatted(keyword), - "%s text_000 = document.createTextNode(`HTML To JavaScript`);".formatted(keyword), - "h1_000.appendChild(text_000);", - "%s ol_000 = document.createElement('ol');".formatted(keyword), - "%s text_001 = document.createTextNode(` `);".formatted(keyword), - "ol_000.appendChild(text_001);", - "%s li_000 = document.createElement('li');".formatted(keyword), - "%s text_002 = document.createTextNode(`First item`);".formatted(keyword), - "li_000.appendChild(text_002);", - "ol_000.appendChild(li_000);", - "%s text_003 = document.createTextNode(` `);".formatted(keyword), - "ol_000.appendChild(text_003);", + "%s h1_001 = document.createElement('h1');".formatted(keyword), + "%s text_001 = document.createTextNode(`HTML To JavaScript`);".formatted(keyword), + "h1_001.appendChild(text_001);", + "%s ol_001 = document.createElement('ol');".formatted(keyword), + "%s text_002 = document.createTextNode(` `);".formatted(keyword), + "ol_001.appendChild(text_002);", "%s li_001 = document.createElement('li');".formatted(keyword), - "%s text_004 = document.createTextNode(`Second item`);".formatted(keyword), - "li_001.appendChild(text_004);", - "ol_000.appendChild(li_001);", - "%s text_005 = document.createTextNode(` `);".formatted(keyword), - "ol_000.appendChild(text_005);", + "%s text_003 = document.createTextNode(`First item`);".formatted(keyword), + "li_001.appendChild(text_003);", + "ol_001.appendChild(li_001);", + "%s text_004 = document.createTextNode(` `);".formatted(keyword), + "ol_001.appendChild(text_004);", "%s li_002 = document.createElement('li');".formatted(keyword), - "%s text_006 = document.createTextNode(`Third item`);".formatted(keyword), - "li_002.appendChild(text_006);", - "ol_000.appendChild(li_002);", - "%s text_007 = document.createTextNode(` `);".formatted(keyword), - "ol_000.appendChild(text_007);", + "%s text_005 = document.createTextNode(`Second item`);".formatted(keyword), + "li_002.appendChild(text_005);", + "ol_001.appendChild(li_002);", + "%s text_006 = document.createTextNode(` `);".formatted(keyword), + "ol_001.appendChild(text_006);", "%s li_003 = document.createElement('li');".formatted(keyword), - "%s text_008 = document.createTextNode(`Fourth item`);".formatted(keyword), - "li_003.appendChild(text_008);", - "ol_000.appendChild(li_003);" + "%s text_007 = document.createTextNode(`Third item`);".formatted(keyword), + "li_003.appendChild(text_007);", + "ol_001.appendChild(li_003);", + "%s text_008 = document.createTextNode(` `);".formatted(keyword), + "ol_001.appendChild(text_008);", + "%s li_004 = document.createElement('li');".formatted(keyword), + "%s text_009 = document.createTextNode(`Fourth item`);".formatted(keyword), + "li_004.appendChild(text_009);", + "ol_001.appendChild(li_004);" ); } } @@ -276,158 +275,158 @@ void comparisonBetweenJsGeneratorAndOtherConvertersWithComment(final VariableDec if (querySelectorAdded) { if(commentConversionModeActivated){ - assertThat(converted).containsExactly( "%s targetElement_000 = document.querySelector(`:root > body`);".formatted(keyword), - "%s h1_000 = document.createElement('h1');".formatted(keyword), - "%s text_000 = document.createTextNode(`HTML To JavaScript`);".formatted(keyword), - "h1_000.appendChild(text_000);", - "targetElement_000.appendChild(h1_000);", - "%s ol_000 = document.createElement('ol');".formatted(keyword), - "%s text_001 = document.createTextNode(` `);".formatted(keyword), - "ol_000.appendChild(text_001);", - "%s li_000 = document.createElement('li');".formatted(keyword), - "%s text_002 = document.createTextNode(`First item`);".formatted(keyword), - "li_000.appendChild(text_002);", - "ol_000.appendChild(li_000);", - "%s text_003 = document.createTextNode(` `);".formatted(keyword), - "ol_000.appendChild(text_003);", - "%s comment_000 = document.createComment(`Second item`);".formatted(keyword), - "ol_000.appendChild(comment_000);", - "%s text_004 = document.createTextNode(` `);".formatted(keyword), - "ol_000.appendChild(text_004);", + assertThat(converted).containsExactly( "%s targetElement_001 = document.querySelector(`:root > body`);".formatted(keyword), + "%s h1_001 = document.createElement('h1');".formatted(keyword), + "%s text_001 = document.createTextNode(`HTML To JavaScript`);".formatted(keyword), + "h1_001.appendChild(text_001);", + "targetElement_001.appendChild(h1_001);", + "%s ol_001 = document.createElement('ol');".formatted(keyword), + "%s text_002 = document.createTextNode(` `);".formatted(keyword), + "ol_001.appendChild(text_002);", "%s li_001 = document.createElement('li');".formatted(keyword), - "%s text_005 = document.createTextNode(`Second item`);".formatted(keyword), - "li_001.appendChild(text_005);", - "ol_000.appendChild(li_001);", - "%s text_006 = document.createTextNode(` `);".formatted(keyword), - "ol_000.appendChild(text_006);", + "%s text_003 = document.createTextNode(`First item`);".formatted(keyword), + "li_001.appendChild(text_003);", + "ol_001.appendChild(li_001);", + "%s text_004 = document.createTextNode(` `);".formatted(keyword), + "ol_001.appendChild(text_004);", + "%s comment_001 = document.createComment(`Second item`);".formatted(keyword), + "ol_001.appendChild(comment_001);", + "%s text_005 = document.createTextNode(` `);".formatted(keyword), + "ol_001.appendChild(text_005);", "%s li_002 = document.createElement('li');".formatted(keyword), - "%s text_007 = document.createTextNode(`Third item`);".formatted(keyword), - "li_002.appendChild(text_007);", - "ol_000.appendChild(li_002);", - "%s text_008 = document.createTextNode(` `);".formatted(keyword), - "ol_000.appendChild(text_008);", - "%s comment_001 = document.createComment(`Fourth item`);".formatted(keyword), - "ol_000.appendChild(comment_001);", - "%s text_009 = document.createTextNode(` `);".formatted(keyword), - "ol_000.appendChild(text_009);", + "%s text_006 = document.createTextNode(`Second item`);".formatted(keyword), + "li_002.appendChild(text_006);", + "ol_001.appendChild(li_002);", + "%s text_007 = document.createTextNode(` `);".formatted(keyword), + "ol_001.appendChild(text_007);", "%s li_003 = document.createElement('li');".formatted(keyword), - "%s text_010 = document.createTextNode(`Fourth item`);".formatted(keyword), - "li_003.appendChild(text_010);", - "ol_000.appendChild(li_003);", - "targetElement_000.appendChild(ol_000);" + "%s text_008 = document.createTextNode(`Third item`);".formatted(keyword), + "li_003.appendChild(text_008);", + "ol_001.appendChild(li_003);", + "%s text_009 = document.createTextNode(` `);".formatted(keyword), + "ol_001.appendChild(text_009);", + "%s comment_002 = document.createComment(`Fourth item`);".formatted(keyword), + "ol_001.appendChild(comment_002);", + "%s text_010 = document.createTextNode(` `);".formatted(keyword), + "ol_001.appendChild(text_010);", + "%s li_004 = document.createElement('li');".formatted(keyword), + "%s text_011 = document.createTextNode(`Fourth item`);".formatted(keyword), + "li_004.appendChild(text_011);", + "ol_001.appendChild(li_004);", + "targetElement_001.appendChild(ol_001);" ); }else{ - assertThat(converted).containsExactly( "%s targetElement_000 = document.querySelector(`:root > body`);".formatted(keyword), - "%s h1_000 = document.createElement('h1');".formatted(keyword), - "%s text_000 = document.createTextNode(`HTML To JavaScript`);".formatted(keyword), - "h1_000.appendChild(text_000);", - "targetElement_000.appendChild(h1_000);", - "%s ol_000 = document.createElement('ol');".formatted(keyword), - "%s text_001 = document.createTextNode(` `);".formatted(keyword), - "ol_000.appendChild(text_001);", - "%s li_000 = document.createElement('li');".formatted(keyword), - "%s text_002 = document.createTextNode(`First item`);".formatted(keyword), - "li_000.appendChild(text_002);", - "ol_000.appendChild(li_000);", - "%s text_003 = document.createTextNode(` `);".formatted(keyword), - "ol_000.appendChild(text_003);", - "%s text_004 = document.createTextNode(` `);".formatted(keyword), - "ol_000.appendChild(text_004);", + assertThat(converted).containsExactly( "%s targetElement_001 = document.querySelector(`:root > body`);".formatted(keyword), + "%s h1_001 = document.createElement('h1');".formatted(keyword), + "%s text_001 = document.createTextNode(`HTML To JavaScript`);".formatted(keyword), + "h1_001.appendChild(text_001);", + "targetElement_001.appendChild(h1_001);", + "%s ol_001 = document.createElement('ol');".formatted(keyword), + "%s text_002 = document.createTextNode(` `);".formatted(keyword), + "ol_001.appendChild(text_002);", "%s li_001 = document.createElement('li');".formatted(keyword), - "%s text_005 = document.createTextNode(`Second item`);".formatted(keyword), - "li_001.appendChild(text_005);", - "ol_000.appendChild(li_001);", - "%s text_006 = document.createTextNode(` `);".formatted(keyword), - "ol_000.appendChild(text_006);", + "%s text_003 = document.createTextNode(`First item`);".formatted(keyword), + "li_001.appendChild(text_003);", + "ol_001.appendChild(li_001);", + "%s text_004 = document.createTextNode(` `);".formatted(keyword), + "ol_001.appendChild(text_004);", + "%s text_005 = document.createTextNode(` `);".formatted(keyword), + "ol_001.appendChild(text_005);", "%s li_002 = document.createElement('li');".formatted(keyword), - "%s text_007 = document.createTextNode(`Third item`);".formatted(keyword), - "li_002.appendChild(text_007);", - "ol_000.appendChild(li_002);", - "%s text_008 = document.createTextNode(` `);".formatted(keyword), - "ol_000.appendChild(text_008);", - "%s text_009 = document.createTextNode(` `);".formatted(keyword), - "ol_000.appendChild(text_009);", + "%s text_006 = document.createTextNode(`Second item`);".formatted(keyword), + "li_002.appendChild(text_006);", + "ol_001.appendChild(li_002);", + "%s text_007 = document.createTextNode(` `);".formatted(keyword), + "ol_001.appendChild(text_007);", "%s li_003 = document.createElement('li');".formatted(keyword), - "%s text_010 = document.createTextNode(`Fourth item`);".formatted(keyword), - "li_003.appendChild(text_010);", - "ol_000.appendChild(li_003);", - "targetElement_000.appendChild(ol_000);" + "%s text_008 = document.createTextNode(`Third item`);".formatted(keyword), + "li_003.appendChild(text_008);", + "ol_001.appendChild(li_003);", + "%s text_009 = document.createTextNode(` `);".formatted(keyword), + "ol_001.appendChild(text_009);", + "%s text_010 = document.createTextNode(` `);".formatted(keyword), + "ol_001.appendChild(text_010);", + "%s li_004 = document.createElement('li');".formatted(keyword), + "%s text_011 = document.createTextNode(`Fourth item`);".formatted(keyword), + "li_004.appendChild(text_011);", + "ol_001.appendChild(li_004);", + "targetElement_001.appendChild(ol_001);" ); } } else { if(commentConversionModeActivated){ assertThat(converted).containsExactly( - "%s h1_000 = document.createElement('h1');".formatted(keyword), - "%s text_000 = document.createTextNode(`HTML To JavaScript`);".formatted(keyword), - "h1_000.appendChild(text_000);", - "%s ol_000 = document.createElement('ol');".formatted(keyword), - "%s text_001 = document.createTextNode(` `);".formatted(keyword), - "ol_000.appendChild(text_001);", - "%s li_000 = document.createElement('li');".formatted(keyword), - "%s text_002 = document.createTextNode(`First item`);".formatted(keyword), - "li_000.appendChild(text_002);", - "ol_000.appendChild(li_000);", - "%s text_003 = document.createTextNode(` `);".formatted(keyword), - "ol_000.appendChild(text_003);", - "%s comment_000 = document.createComment(`Second item`);".formatted(keyword), - "ol_000.appendChild(comment_000);", - "%s text_004 = document.createTextNode(` `);".formatted(keyword), - "ol_000.appendChild(text_004);", + "%s h1_001 = document.createElement('h1');".formatted(keyword), + "%s text_001 = document.createTextNode(`HTML To JavaScript`);".formatted(keyword), + "h1_001.appendChild(text_001);", + "%s ol_001 = document.createElement('ol');".formatted(keyword), + "%s text_002 = document.createTextNode(` `);".formatted(keyword), + "ol_001.appendChild(text_002);", "%s li_001 = document.createElement('li');".formatted(keyword), - "%s text_005 = document.createTextNode(`Second item`);".formatted(keyword), - "li_001.appendChild(text_005);", - "ol_000.appendChild(li_001);", - "%s text_006 = document.createTextNode(` `);".formatted(keyword), - "ol_000.appendChild(text_006);", + "%s text_003 = document.createTextNode(`First item`);".formatted(keyword), + "li_001.appendChild(text_003);", + "ol_001.appendChild(li_001);", + "%s text_004 = document.createTextNode(` `);".formatted(keyword), + "ol_001.appendChild(text_004);", + "%s comment_001 = document.createComment(`Second item`);".formatted(keyword), + "ol_001.appendChild(comment_001);", + "%s text_005 = document.createTextNode(` `);".formatted(keyword), + "ol_001.appendChild(text_005);", "%s li_002 = document.createElement('li');".formatted(keyword), - "%s text_007 = document.createTextNode(`Third item`);".formatted(keyword), - "li_002.appendChild(text_007);", - "ol_000.appendChild(li_002);", - "%s text_008 = document.createTextNode(` `);".formatted(keyword), - "ol_000.appendChild(text_008);", - "%s comment_001 = document.createComment(`Fourth item`);".formatted(keyword), - "ol_000.appendChild(comment_001);", - "%s text_009 = document.createTextNode(` `);".formatted(keyword), - "ol_000.appendChild(text_009);", + "%s text_006 = document.createTextNode(`Second item`);".formatted(keyword), + "li_002.appendChild(text_006);", + "ol_001.appendChild(li_002);", + "%s text_007 = document.createTextNode(` `);".formatted(keyword), + "ol_001.appendChild(text_007);", "%s li_003 = document.createElement('li');".formatted(keyword), - "%s text_010 = document.createTextNode(`Fourth item`);".formatted(keyword), - "li_003.appendChild(text_010);", - "ol_000.appendChild(li_003);" + "%s text_008 = document.createTextNode(`Third item`);".formatted(keyword), + "li_003.appendChild(text_008);", + "ol_001.appendChild(li_003);", + "%s text_009 = document.createTextNode(` `);".formatted(keyword), + "ol_001.appendChild(text_009);", + "%s comment_002 = document.createComment(`Fourth item`);".formatted(keyword), + "ol_001.appendChild(comment_002);", + "%s text_010 = document.createTextNode(` `);".formatted(keyword), + "ol_001.appendChild(text_010);", + "%s li_004 = document.createElement('li');".formatted(keyword), + "%s text_011 = document.createTextNode(`Fourth item`);".formatted(keyword), + "li_004.appendChild(text_011);", + "ol_001.appendChild(li_004);" ); }else{ assertThat(converted).containsExactly( - "%s h1_000 = document.createElement('h1');".formatted(keyword), - "%s text_000 = document.createTextNode(`HTML To JavaScript`);".formatted(keyword), - "h1_000.appendChild(text_000);", - "%s ol_000 = document.createElement('ol');".formatted(keyword), - "%s text_001 = document.createTextNode(` `);".formatted(keyword), - "ol_000.appendChild(text_001);", - "%s li_000 = document.createElement('li');".formatted(keyword), - "%s text_002 = document.createTextNode(`First item`);".formatted(keyword), - "li_000.appendChild(text_002);", - "ol_000.appendChild(li_000);", - "%s text_003 = document.createTextNode(` `);".formatted(keyword), - "ol_000.appendChild(text_003);", - "%s text_004 = document.createTextNode(` `);".formatted(keyword), - "ol_000.appendChild(text_004);", + "%s h1_001 = document.createElement('h1');".formatted(keyword), + "%s text_001 = document.createTextNode(`HTML To JavaScript`);".formatted(keyword), + "h1_001.appendChild(text_001);", + "%s ol_001 = document.createElement('ol');".formatted(keyword), + "%s text_002 = document.createTextNode(` `);".formatted(keyword), + "ol_001.appendChild(text_002);", "%s li_001 = document.createElement('li');".formatted(keyword), - "%s text_005 = document.createTextNode(`Second item`);".formatted(keyword), - "li_001.appendChild(text_005);", - "ol_000.appendChild(li_001);", - "%s text_006 = document.createTextNode(` `);".formatted(keyword), - "ol_000.appendChild(text_006);", + "%s text_003 = document.createTextNode(`First item`);".formatted(keyword), + "li_001.appendChild(text_003);", + "ol_001.appendChild(li_001);", + "%s text_004 = document.createTextNode(` `);".formatted(keyword), + "ol_001.appendChild(text_004);", + "%s text_005 = document.createTextNode(` `);".formatted(keyword), + "ol_001.appendChild(text_005);", "%s li_002 = document.createElement('li');".formatted(keyword), - "%s text_007 = document.createTextNode(`Third item`);".formatted(keyword), - "li_002.appendChild(text_007);", - "ol_000.appendChild(li_002);", - "%s text_008 = document.createTextNode(` `);".formatted(keyword), - "ol_000.appendChild(text_008);", - "%s text_009 = document.createTextNode(` `);".formatted(keyword), - "ol_000.appendChild(text_009);", + "%s text_006 = document.createTextNode(`Second item`);".formatted(keyword), + "li_002.appendChild(text_006);", + "ol_001.appendChild(li_002);", + "%s text_007 = document.createTextNode(` `);".formatted(keyword), + "ol_001.appendChild(text_007);", "%s li_003 = document.createElement('li');".formatted(keyword), - "%s text_010 = document.createTextNode(`Fourth item`);".formatted(keyword), - "li_003.appendChild(text_010);", - "ol_000.appendChild(li_003);" + "%s text_008 = document.createTextNode(`Third item`);".formatted(keyword), + "li_003.appendChild(text_008);", + "ol_001.appendChild(li_003);", + "%s text_009 = document.createTextNode(` `);".formatted(keyword), + "ol_001.appendChild(text_009);", + "%s text_010 = document.createTextNode(` `);".formatted(keyword), + "ol_001.appendChild(text_010);", + "%s li_004 = document.createElement('li');".formatted(keyword), + "%s text_011 = document.createTextNode(`Fourth item`);".formatted(keyword), + "li_004.appendChild(text_011);", + "ol_001.appendChild(li_004);" ); } } @@ -447,23 +446,23 @@ void issue145WithCustomTagJavaScriptIdentifiers(final VariableDeclaration variab if (querySelectorAdded) { assertThat(converted).containsExactly( - "%s targetElement_000 = document.querySelector(`:root > body`);".formatted(keyword), - "%s custom_angulartext_000 = document.createElement('AngularText');".formatted(keyword), - "%s text_000 = document.createTextNode(`Angular`);".formatted(keyword), - "custom_angulartext_000.appendChild(text_000);", - "targetElement_000.appendChild(custom_angulartext_000);", - "%s custom_web_component_000 = document.createElement('web-component');".formatted(keyword), - "%s text_001 = document.createTextNode(`Web Component`);".formatted(keyword), - "custom_web_component_000.appendChild(text_001);", - "targetElement_000.appendChild(custom_web_component_000);"); + "%s targetElement_001 = document.querySelector(`:root > body`);".formatted(keyword), + "%s custom_angulartext_001 = document.createElement('AngularText');".formatted(keyword), + "%s text_001 = document.createTextNode(`Angular`);".formatted(keyword), + "custom_angulartext_001.appendChild(text_001);", + "targetElement_001.appendChild(custom_angulartext_001);", + "%s custom_web_component_001 = document.createElement('web-component');".formatted(keyword), + "%s text_002 = document.createTextNode(`Web Component`);".formatted(keyword), + "custom_web_component_001.appendChild(text_002);", + "targetElement_001.appendChild(custom_web_component_001);"); } else { assertThat(converted).containsExactly( - "%s custom_angulartext_000 = document.createElement('AngularText');".formatted(keyword), - "%s text_000 = document.createTextNode(`Angular`);".formatted(keyword), - "custom_angulartext_000.appendChild(text_000);", - "%s custom_web_component_000 = document.createElement('web-component');".formatted(keyword), - "%s text_001 = document.createTextNode(`Web Component`);".formatted(keyword), - "custom_web_component_000.appendChild(text_001);"); + "%s custom_angulartext_001 = document.createElement('AngularText');".formatted(keyword), + "%s text_001 = document.createTextNode(`Angular`);".formatted(keyword), + "custom_angulartext_001.appendChild(text_001);", + "%s custom_web_component_001 = document.createElement('web-component');".formatted(keyword), + "%s text_002 = document.createTextNode(`Web Component`);".formatted(keyword), + "custom_web_component_001.appendChild(text_002);"); } } @@ -483,53 +482,53 @@ void issue145WithCustomTagJavaScriptIdentifiersWithComment(final VariableDeclara if (querySelectorAdded) { if (commentConversionModeActivated){ assertThat(converted).containsExactly( - "%s targetElement_000 = document.querySelector(`:root > body`);".formatted(keyword), - "%s comment_000 = document.createComment(`Angular Comment`);".formatted(keyword), - "targetElement_000.appendChild(comment_000);", - "%s custom_angulartext_000 = document.createElement('AngularText');".formatted(keyword), - "%s text_000 = document.createTextNode(`Angular`);".formatted(keyword), - "custom_angulartext_000.appendChild(text_000);", - "targetElement_000.appendChild(custom_angulartext_000);", - "%s comment_001 = document.createComment(`Web Component`);".formatted(keyword), - "targetElement_000.appendChild(comment_001);", - "%s custom_web_component_000 = document.createElement('web-component');".formatted(keyword), - "%s text_001 = document.createTextNode(`Web Component`);".formatted(keyword), - "custom_web_component_000.appendChild(text_001);", - "targetElement_000.appendChild(custom_web_component_000);", - "%s comment_002 = document.createComment(`Custom Tags`);".formatted(keyword), - "targetElement_000.appendChild(comment_002);"); + "%s targetElement_001 = document.querySelector(`:root > body`);".formatted(keyword), + "%s comment_001 = document.createComment(`Angular Comment`);".formatted(keyword), + "targetElement_001.appendChild(comment_001);", + "%s custom_angulartext_001 = document.createElement('AngularText');".formatted(keyword), + "%s text_001 = document.createTextNode(`Angular`);".formatted(keyword), + "custom_angulartext_001.appendChild(text_001);", + "targetElement_001.appendChild(custom_angulartext_001);", + "%s comment_002 = document.createComment(`Web Component`);".formatted(keyword), + "targetElement_001.appendChild(comment_002);", + "%s custom_web_component_001 = document.createElement('web-component');".formatted(keyword), + "%s text_002 = document.createTextNode(`Web Component`);".formatted(keyword), + "custom_web_component_001.appendChild(text_002);", + "targetElement_001.appendChild(custom_web_component_001);", + "%s comment_003 = document.createComment(`Custom Tags`);".formatted(keyword), + "targetElement_001.appendChild(comment_003);"); }else{ assertThat(converted).containsExactly( - "%s targetElement_000 = document.querySelector(`:root > body`);".formatted(keyword), - "%s custom_angulartext_000 = document.createElement('AngularText');".formatted(keyword), - "%s text_000 = document.createTextNode(`Angular`);".formatted(keyword), - "custom_angulartext_000.appendChild(text_000);", - "targetElement_000.appendChild(custom_angulartext_000);", - "%s custom_web_component_000 = document.createElement('web-component');".formatted(keyword), - "%s text_001 = document.createTextNode(`Web Component`);".formatted(keyword), - "custom_web_component_000.appendChild(text_001);", - "targetElement_000.appendChild(custom_web_component_000);"); + "%s targetElement_001 = document.querySelector(`:root > body`);".formatted(keyword), + "%s custom_angulartext_001 = document.createElement('AngularText');".formatted(keyword), + "%s text_001 = document.createTextNode(`Angular`);".formatted(keyword), + "custom_angulartext_001.appendChild(text_001);", + "targetElement_001.appendChild(custom_angulartext_001);", + "%s custom_web_component_001 = document.createElement('web-component');".formatted(keyword), + "%s text_002 = document.createTextNode(`Web Component`);".formatted(keyword), + "custom_web_component_001.appendChild(text_002);", + "targetElement_001.appendChild(custom_web_component_001);"); } } else { if (commentConversionModeActivated){ assertThat(converted).containsExactly( - "%s comment_000 = document.createComment(`Angular Comment`);".formatted(keyword), - "%s custom_angulartext_000 = document.createElement('AngularText');".formatted(keyword), - "%s text_000 = document.createTextNode(`Angular`);".formatted(keyword), - "custom_angulartext_000.appendChild(text_000);", - "%s comment_001 = document.createComment(`Web Component`);".formatted(keyword), - "%s custom_web_component_000 = document.createElement('web-component');".formatted(keyword), - "%s text_001 = document.createTextNode(`Web Component`);".formatted(keyword), - "custom_web_component_000.appendChild(text_001);", - "%s comment_002 = document.createComment(`Custom Tags`);".formatted(keyword)); + "%s comment_001 = document.createComment(`Angular Comment`);".formatted(keyword), + "%s custom_angulartext_001 = document.createElement('AngularText');".formatted(keyword), + "%s text_001 = document.createTextNode(`Angular`);".formatted(keyword), + "custom_angulartext_001.appendChild(text_001);", + "%s comment_002 = document.createComment(`Web Component`);".formatted(keyword), + "%s custom_web_component_001 = document.createElement('web-component');".formatted(keyword), + "%s text_002 = document.createTextNode(`Web Component`);".formatted(keyword), + "custom_web_component_001.appendChild(text_002);", + "%s comment_003 = document.createComment(`Custom Tags`);".formatted(keyword)); }else{ assertThat(converted).containsExactly( - "%s custom_angulartext_000 = document.createElement('AngularText');".formatted(keyword), - "%s text_000 = document.createTextNode(`Angular`);".formatted(keyword), - "custom_angulartext_000.appendChild(text_000);", - "%s custom_web_component_000 = document.createElement('web-component');".formatted(keyword), - "%s text_001 = document.createTextNode(`Web Component`);".formatted(keyword), - "custom_web_component_000.appendChild(text_001);"); + "%s custom_angulartext_001 = document.createElement('AngularText');".formatted(keyword), + "%s text_001 = document.createTextNode(`Angular`);".formatted(keyword), + "custom_angulartext_001.appendChild(text_001);", + "%s custom_web_component_001 = document.createElement('web-component');".formatted(keyword), + "%s text_002 = document.createTextNode(`Web Component`);".formatted(keyword), + "custom_web_component_001.appendChild(text_002);"); } } } @@ -551,84 +550,84 @@ void issue41WithSelfClosingTags(final VariableDeclaration variableDeclaration, f if (querySelectorAdded) { if(commentConversionModeActivated){ assertThat(converted).containsExactly( - "%s targetElement_000 = document.querySelector(`:root > body`);".formatted(keyword), - "%s input_000 = document.createElement('input');".formatted(keyword), - "input_000.setAttribute(`type`, `text`);", - "targetElement_000.appendChild(input_000);", - "%s span_000 = document.createElement('span');".formatted(keyword), - "%s text_000 = document.createTextNode(`Hello`);".formatted(keyword), - "span_000.appendChild(text_000);", - "targetElement_000.appendChild(span_000);", - "%s comment_000 = document.createComment(` Hello `);".formatted(keyword), - "targetElement_000.appendChild(comment_000);", - "%s text_001 = document.createTextNode(`Bye!`);".formatted(keyword), - "targetElement_000.appendChild(text_001);", - "%s script_000 = document.createElement('script');".formatted(keyword), - "script_000.type = `text/javascript`;", + "%s targetElement_001 = document.querySelector(`:root > body`);".formatted(keyword), + "%s input_001 = document.createElement('input');".formatted(keyword), + "input_001.setAttribute(`type`, `text`);", + "targetElement_001.appendChild(input_001);", + "%s span_001 = document.createElement('span');".formatted(keyword), + "%s text_001 = document.createTextNode(`Hello`);".formatted(keyword), + "span_001.appendChild(text_001);", + "targetElement_001.appendChild(span_001);", + "%s comment_001 = document.createComment(` Hello `);".formatted(keyword), + "targetElement_001.appendChild(comment_001);", + "%s text_002 = document.createTextNode(`Bye!`);".formatted(keyword), + "targetElement_001.appendChild(text_002);", + "%s script_001 = document.createElement('script');".formatted(keyword), + "script_001.type = `text/javascript`;", "try {", - "%s text_002 = document.createTextNode(`// no-comment`);".formatted(keyword), - "script_000.appendChild(text_002);", - "targetElement_000.appendChild(script_000);", + "%s text_003 = document.createTextNode(`// no-comment`);".formatted(keyword), + "script_001.appendChild(text_003);", + "targetElement_001.appendChild(script_001);", "} catch (_) {", - "script_000.text = `// no-comment`;", - "targetElement_000.appendChild(script_000);", + "script_001.text = `// no-comment`;", + "targetElement_001.appendChild(script_001);", "}"); }else{ assertThat(converted).containsExactly( - "%s targetElement_000 = document.querySelector(`:root > body`);".formatted(keyword), - "%s input_000 = document.createElement('input');".formatted(keyword), - "input_000.setAttribute(`type`, `text`);", - "targetElement_000.appendChild(input_000);", - "%s span_000 = document.createElement('span');".formatted(keyword), - "%s text_000 = document.createTextNode(`Hello`);".formatted(keyword), - "span_000.appendChild(text_000);", - "targetElement_000.appendChild(span_000);", - "%s text_001 = document.createTextNode(`Bye!`);".formatted(keyword), - "targetElement_000.appendChild(text_001);", - "%s script_000 = document.createElement('script');".formatted(keyword), - "script_000.type = `text/javascript`;", + "%s targetElement_001 = document.querySelector(`:root > body`);".formatted(keyword), + "%s input_001 = document.createElement('input');".formatted(keyword), + "input_001.setAttribute(`type`, `text`);", + "targetElement_001.appendChild(input_001);", + "%s span_001 = document.createElement('span');".formatted(keyword), + "%s text_001 = document.createTextNode(`Hello`);".formatted(keyword), + "span_001.appendChild(text_001);", + "targetElement_001.appendChild(span_001);", + "%s text_002 = document.createTextNode(`Bye!`);".formatted(keyword), + "targetElement_001.appendChild(text_002);", + "%s script_001 = document.createElement('script');".formatted(keyword), + "script_001.type = `text/javascript`;", "try {", - "%s text_002 = document.createTextNode(`// no-comment`);".formatted(keyword), - "script_000.appendChild(text_002);", - "targetElement_000.appendChild(script_000);", + "%s text_003 = document.createTextNode(`// no-comment`);".formatted(keyword), + "script_001.appendChild(text_003);", + "targetElement_001.appendChild(script_001);", "} catch (_) {", - "script_000.text = `// no-comment`;", - "targetElement_000.appendChild(script_000);", + "script_001.text = `// no-comment`;", + "targetElement_001.appendChild(script_001);", "}"); } } else { if(commentConversionModeActivated){ assertThat(converted).containsExactly( - "%s input_000 = document.createElement('input');".formatted(keyword), - "input_000.setAttribute(`type`, `text`);", - "%s span_000 = document.createElement('span');".formatted(keyword), - "%s text_000 = document.createTextNode(`Hello`);".formatted(keyword), - "span_000.appendChild(text_000);", - "%s comment_000 = document.createComment(` Hello `);".formatted(keyword), - "%s text_001 = document.createTextNode(`Bye!`);".formatted(keyword), - "%s script_000 = document.createElement('script');".formatted(keyword), - "script_000.type = `text/javascript`;", + "%s input_001 = document.createElement('input');".formatted(keyword), + "input_001.setAttribute(`type`, `text`);", + "%s span_001 = document.createElement('span');".formatted(keyword), + "%s text_001 = document.createTextNode(`Hello`);".formatted(keyword), + "span_001.appendChild(text_001);", + "%s comment_001 = document.createComment(` Hello `);".formatted(keyword), + "%s text_002 = document.createTextNode(`Bye!`);".formatted(keyword), + "%s script_001 = document.createElement('script');".formatted(keyword), + "script_001.type = `text/javascript`;", "try {", - "%s text_002 = document.createTextNode(`// no-comment`);".formatted(keyword), - "script_000.appendChild(text_002);", + "%s text_003 = document.createTextNode(`// no-comment`);".formatted(keyword), + "script_001.appendChild(text_003);", "} catch (_) {", - "script_000.text = `// no-comment`;", + "script_001.text = `// no-comment`;", "}"); }else{ assertThat(converted).containsExactly( - "%s input_000 = document.createElement('input');".formatted(keyword), - "input_000.setAttribute(`type`, `text`);", - "%s span_000 = document.createElement('span');".formatted(keyword), - "%s text_000 = document.createTextNode(`Hello`);".formatted(keyword), - "span_000.appendChild(text_000);", - "%s text_001 = document.createTextNode(`Bye!`);".formatted(keyword), - "%s script_000 = document.createElement('script');".formatted(keyword), - "script_000.type = `text/javascript`;", + "%s input_001 = document.createElement('input');".formatted(keyword), + "input_001.setAttribute(`type`, `text`);", + "%s span_001 = document.createElement('span');".formatted(keyword), + "%s text_001 = document.createTextNode(`Hello`);".formatted(keyword), + "span_001.appendChild(text_001);", + "%s text_002 = document.createTextNode(`Bye!`);".formatted(keyword), + "%s script_001 = document.createElement('script');".formatted(keyword), + "script_001.type = `text/javascript`;", "try {", - "%s text_002 = document.createTextNode(`// no-comment`);".formatted(keyword), - "script_000.appendChild(text_002);", + "%s text_003 = document.createTextNode(`// no-comment`);".formatted(keyword), + "script_001.appendChild(text_003);", "} catch (_) {", - "script_000.text = `// no-comment`;", + "script_001.text = `// no-comment`;", "}"); } } @@ -646,10 +645,10 @@ void produceValidCodeWhenGivenCDATA(VariableDeclaration variableDeclaration, fin if (querySelectorAdded) { assertThat(converted).containsExactly( - "%s targetElement_000 = document.querySelector(`:root > body`);".formatted(keyword), - "%s text_000 = document.createTextNode(` < %s > & `);".formatted(keyword, token), - "targetElement_000.appendChild(text_000);"); - } else {assertThat(converted).containsExactly("%s text_000 = document.createTextNode(` < %s > & `);".formatted(keyword, token));} + "%s targetElement_001 = document.querySelector(`:root > body`);".formatted(keyword), + "%s text_001 = document.createTextNode(` < %s > & `);".formatted(keyword, token), + "targetElement_001.appendChild(text_001);"); + } else {assertThat(converted).containsExactly("%s text_001 = document.createTextNode(` < %s > & `);".formatted(keyword, token));} } @ParameterizedTest @@ -664,10 +663,10 @@ void produceValidCodeWhenGivenPlainText(VariableDeclaration variableDeclaration, if (querySelectorAdded) { assertThat(converted).containsExactly( - "%s targetElement_000 = document.querySelector(`:root > body`);".formatted(keyword), - "%s text_000 = document.createTextNode(`%s`);".formatted(keyword, token), - "targetElement_000.appendChild(text_000);"); - } else {assertThat(converted).containsExactly("%s text_000 = document.createTextNode(`%s`);".formatted(keyword, token));} + "%s targetElement_001 = document.querySelector(`:root > body`);".formatted(keyword), + "%s text_001 = document.createTextNode(`%s`);".formatted(keyword, token), + "targetElement_001.appendChild(text_001);"); + } else {assertThat(converted).containsExactly("%s text_001 = document.createTextNode(`%s`);".formatted(keyword, token));} } @ParameterizedTest @@ -682,23 +681,23 @@ void produceValidCodeWhenGivenPlainTextWithComment(VariableDeclaration variableD if (querySelectorAdded) { if(commentConversionModeActivated){ - assertThat(converted).containsExactly("%s targetElement_000 = document.querySelector(`:root > body`);".formatted(keyword), - "%s comment_000 = document.createComment(` %s `);".formatted(keyword, token), - "targetElement_000.appendChild(comment_000);", - "%s text_000 = document.createTextNode(` %s`);".formatted(keyword, token), - "targetElement_000.appendChild(text_000);"); + assertThat(converted).containsExactly("%s targetElement_001 = document.querySelector(`:root > body`);".formatted(keyword), + "%s comment_001 = document.createComment(` %s `);".formatted(keyword, token), + "targetElement_001.appendChild(comment_001);", + "%s text_001 = document.createTextNode(` %s`);".formatted(keyword, token), + "targetElement_001.appendChild(text_001);"); }else{ - assertThat(converted).containsExactly("%s targetElement_000 = document.querySelector(`:root > body`);".formatted(keyword), - "%s text_000 = document.createTextNode(` %s`);".formatted(keyword, token), - "targetElement_000.appendChild(text_000);"); + assertThat(converted).containsExactly("%s targetElement_001 = document.querySelector(`:root > body`);".formatted(keyword), + "%s text_001 = document.createTextNode(` %s`);".formatted(keyword, token), + "targetElement_001.appendChild(text_001);"); } } else { if(commentConversionModeActivated){ assertThat(converted).containsExactly( - "%s comment_000 = document.createComment(` %s `);".formatted(keyword, token), - "%s text_000 = document.createTextNode(` %s`);".formatted(keyword, token)); - }else{assertThat(converted).containsExactly("%s text_000 = document.createTextNode(` %s`);".formatted(keyword, token));} + "%s comment_001 = document.createComment(` %s `);".formatted(keyword, token), + "%s text_001 = document.createTextNode(` %s`);".formatted(keyword, token)); + }else{assertThat(converted).containsExactly("%s text_001 = document.createTextNode(` %s`);".formatted(keyword, token));} } } @@ -716,16 +715,16 @@ void produceValidCodeWhenGivenComment(VariableDeclaration variableDeclaration, f if (querySelectorAdded) { if(commentConversionModeActivated){ assertThat(converted).containsExactly( - "%s targetElement_000 = document.querySelector(`:root > body`);".formatted(keyword), - "%s comment_000 = document.createComment(` %s `);".formatted(keyword, token), - "targetElement_000.appendChild(comment_000);"); + "%s targetElement_001 = document.querySelector(`:root > body`);".formatted(keyword), + "%s comment_001 = document.createComment(` %s `);".formatted(keyword, token), + "targetElement_001.appendChild(comment_001);"); }else{ assertThat(converted).containsExactly( - "%s targetElement_000 = document.querySelector(`:root > body`);".formatted(keyword)); + "%s targetElement_001 = document.querySelector(`:root > body`);".formatted(keyword)); } } else { if(commentConversionModeActivated){ - assertThat(converted).containsExactly("%s comment_000 = document.createComment(` %s `);".formatted(keyword, token)); + assertThat(converted).containsExactly("%s comment_001 = document.createComment(` %s `);".formatted(keyword, token)); }else{ assertThat(converted).containsExactly(); } @@ -744,26 +743,26 @@ void produceValidCodeWhenGivenScript(VariableDeclaration variableDeclaration, fi if (querySelectorAdded) { assertThat(converted).containsExactly( - "%s targetElement_000 = document.querySelector(`:root > body`);".formatted(keyword), - "%s script_000 = document.createElement('script');".formatted(keyword), - "script_000.type = `text/javascript`;", + "%s targetElement_001 = document.querySelector(`:root > body`);".formatted(keyword), + "%s script_001 = document.createElement('script');".formatted(keyword), + "script_001.type = `text/javascript`;", "try {", - "%s text_000 = document.createTextNode(`console.log(\\`%s\\`)`);".formatted(keyword, token), - "script_000.appendChild(text_000);", - "targetElement_000.appendChild(script_000);", + "%s text_001 = document.createTextNode(`console.log(\\`%s\\`)`);".formatted(keyword, token), + "script_001.appendChild(text_001);", + "targetElement_001.appendChild(script_001);", "} catch (_) {", - "script_000.text = `console.log(\\`%s\\`)`;".formatted(token), - "targetElement_000.appendChild(script_000);", + "script_001.text = `console.log(\\`%s\\`)`;".formatted(token), + "targetElement_001.appendChild(script_001);", "}"); } else { assertThat(converted).containsExactly( - "%s script_000 = document.createElement('script');".formatted(keyword), - "script_000.type = `text/javascript`;", + "%s script_001 = document.createElement('script');".formatted(keyword), + "script_001.type = `text/javascript`;", "try {", - "%s text_000 = document.createTextNode(`console.log(\\`%s\\`)`);".formatted(keyword, token), - "script_000.appendChild(text_000);", + "%s text_001 = document.createTextNode(`console.log(\\`%s\\`)`);".formatted(keyword, token), + "script_001.appendChild(text_001);", "} catch (_) {", - "script_000.text = `console.log(\\`%s\\`)`;".formatted(token), + "script_001.text = `console.log(\\`%s\\`)`;".formatted(token), "}"); } } @@ -781,10 +780,10 @@ void produceValidCodeWhenGivenTagWithAttributes(VariableDeclaration variableDecl printConverted(converted); assertThat(converted).containsExactly( - "%s targetElement_000 = document.querySelector(`:root > body`);".formatted(keyword), - "%s div_000 = document.createElement('div');".formatted(keyword), - "div_000.setAttribute(`id`, `id-value`);", - "targetElement_000.appendChild(div_000);"); + "%s targetElement_001 = document.querySelector(`:root > body`);".formatted(keyword), + "%s div_001 = document.createElement('div');".formatted(keyword), + "div_001.setAttribute(`id`, `id-value`);", + "targetElement_001.appendChild(div_001);"); input = "
"; configuration = new Configuration(variableDeclaration, true); @@ -792,10 +791,10 @@ void produceValidCodeWhenGivenTagWithAttributes(VariableDeclaration variableDecl printConverted(converted); assertThat(converted).containsExactly( - "%s targetElement_000 = document.querySelector(`:root > body`);".formatted(keyword), - "%s details_000 = document.createElement('details');".formatted(keyword), - "details_000.setAttribute(`open`, `true`);", - "targetElement_000.appendChild(details_000);"); + "%s targetElement_001 = document.querySelector(`:root > body`);".formatted(keyword), + "%s details_001 = document.createElement('details');".formatted(keyword), + "details_001.setAttribute(`open`, `true`);", + "targetElement_001.appendChild(details_001);"); input = "

"; configuration = new Configuration(variableDeclaration, true); @@ -803,10 +802,10 @@ void produceValidCodeWhenGivenTagWithAttributes(VariableDeclaration variableDecl printConverted(converted); assertThat(converted).containsExactly( - "%s targetElement_000 = document.querySelector(`:root > body`);".formatted(keyword), - "%s p_000 = document.createElement('p');".formatted(keyword), - "p_000.setAttribute(`class`, ``);", - "targetElement_000.appendChild(p_000);"); + "%s targetElement_001 = document.querySelector(`:root > body`);".formatted(keyword), + "%s p_001 = document.createElement('p');".formatted(keyword), + "p_001.setAttribute(`class`, ``);", + "targetElement_001.appendChild(p_001);"); input = "

"; configuration = new Configuration(variableDeclaration, true); @@ -814,10 +813,10 @@ void produceValidCodeWhenGivenTagWithAttributes(VariableDeclaration variableDecl printConverted(converted); assertThat(converted).containsExactly( - "%s targetElement_000 = document.querySelector(`:root > body`);".formatted(keyword), - "%s p_000 = document.createElement('p');".formatted(keyword), - "p_000.setAttribute(`class`, `class-value`);", - "targetElement_000.appendChild(p_000);"); + "%s targetElement_001 = document.querySelector(`:root > body`);".formatted(keyword), + "%s p_001 = document.createElement('p');".formatted(keyword), + "p_001.setAttribute(`class`, `class-value`);", + "targetElement_001.appendChild(p_001);"); } else { @@ -827,8 +826,8 @@ void produceValidCodeWhenGivenTagWithAttributes(VariableDeclaration variableDecl printConverted(converted); assertThat(converted).containsExactly( - "%s div_000 = document.createElement('div');".formatted(keyword), - "div_000.setAttribute(`id`, `id-value`);"); + "%s div_001 = document.createElement('div');".formatted(keyword), + "div_001.setAttribute(`id`, `id-value`);"); input = "
"; configuration = new Configuration(variableDeclaration, false); @@ -836,8 +835,8 @@ void produceValidCodeWhenGivenTagWithAttributes(VariableDeclaration variableDecl printConverted(converted); assertThat(converted).containsExactly( - "%s details_000 = document.createElement('details');".formatted(keyword), - "details_000.setAttribute(`open`, `true`);"); + "%s details_001 = document.createElement('details');".formatted(keyword), + "details_001.setAttribute(`open`, `true`);"); input = "

"; configuration = new Configuration(variableDeclaration, false); @@ -845,8 +844,8 @@ void produceValidCodeWhenGivenTagWithAttributes(VariableDeclaration variableDecl printConverted(converted); assertThat(converted).containsExactly( - "%s p_000 = document.createElement('p');".formatted(keyword), - "p_000.setAttribute(`class`, ``);"); + "%s p_001 = document.createElement('p');".formatted(keyword), + "p_001.setAttribute(`class`, ``);"); input = "

"; configuration = new Configuration(variableDeclaration, false); @@ -854,8 +853,8 @@ void produceValidCodeWhenGivenTagWithAttributes(VariableDeclaration variableDecl printConverted(converted); assertThat(converted).containsExactly( - "%s p_000 = document.createElement('p');".formatted(keyword), - "p_000.setAttribute(`class`, `class-value`);"); + "%s p_001 = document.createElement('p');".formatted(keyword), + "p_001.setAttribute(`class`, `class-value`);"); } } @@ -874,21 +873,21 @@ void produceValidCodeWhenGivenTagWithAttributesWithComment(VariableDeclaration v printConverted(converted); assertThat(converted).containsExactly( - "%s targetElement_000 = document.querySelector(`:root > body`);".formatted(keyword), - "%s comment_000 = document.createComment(` Div with id `);".formatted(keyword), - "targetElement_000.appendChild(comment_000);", - "%s div_000 = document.createElement('div');".formatted(keyword), - "div_000.setAttribute(`id`, `id-value`);", - "targetElement_000.appendChild(div_000);"); + "%s targetElement_001 = document.querySelector(`:root > body`);".formatted(keyword), + "%s comment_001 = document.createComment(` Div with id `);".formatted(keyword), + "targetElement_001.appendChild(comment_001);", + "%s div_001 = document.createElement('div');".formatted(keyword), + "div_001.setAttribute(`id`, `id-value`);", + "targetElement_001.appendChild(div_001);"); }else{ printConverted(converted); assertThat(converted).containsExactly( - "%s targetElement_000 = document.querySelector(`:root > body`);".formatted(keyword), - "%s div_000 = document.createElement('div');".formatted(keyword), - "div_000.setAttribute(`id`, `id-value`);", - "targetElement_000.appendChild(div_000);"); + "%s targetElement_001 = document.querySelector(`:root > body`);".formatted(keyword), + "%s div_001 = document.createElement('div');".formatted(keyword), + "div_001.setAttribute(`id`, `id-value`);", + "targetElement_001.appendChild(div_001);"); } @@ -900,21 +899,21 @@ void produceValidCodeWhenGivenTagWithAttributesWithComment(VariableDeclaration v printConverted(converted); assertThat(converted).containsExactly( - "%s targetElement_000 = document.querySelector(`:root > body`);".formatted(keyword), - "%s comment_000 = document.createComment(` Details tag with open attribute `);".formatted(keyword), - "targetElement_000.appendChild(comment_000);", - "%s details_000 = document.createElement('details');".formatted(keyword), - "details_000.setAttribute(`open`, `true`);", - "targetElement_000.appendChild(details_000);"); + "%s targetElement_001 = document.querySelector(`:root > body`);".formatted(keyword), + "%s comment_001 = document.createComment(` Details tag with open attribute `);".formatted(keyword), + "targetElement_001.appendChild(comment_001);", + "%s details_001 = document.createElement('details');".formatted(keyword), + "details_001.setAttribute(`open`, `true`);", + "targetElement_001.appendChild(details_001);"); }else{ printConverted(converted); assertThat(converted).containsExactly( - "%s targetElement_000 = document.querySelector(`:root > body`);".formatted(keyword), - "%s details_000 = document.createElement('details');".formatted(keyword), - "details_000.setAttribute(`open`, `true`);", - "targetElement_000.appendChild(details_000);"); + "%s targetElement_001 = document.querySelector(`:root > body`);".formatted(keyword), + "%s details_001 = document.createElement('details');".formatted(keyword), + "details_001.setAttribute(`open`, `true`);", + "targetElement_001.appendChild(details_001);"); } @@ -926,21 +925,21 @@ void produceValidCodeWhenGivenTagWithAttributesWithComment(VariableDeclaration v printConverted(converted); assertThat(converted).containsExactly( - "%s targetElement_000 = document.querySelector(`:root > body`);".formatted(keyword), - "%s comment_000 = document.createComment(` Paragraph tag with empty class attribute `);".formatted(keyword), - "targetElement_000.appendChild(comment_000);", - "%s p_000 = document.createElement('p');".formatted(keyword), - "p_000.setAttribute(`class`, ``);", - "targetElement_000.appendChild(p_000);"); + "%s targetElement_001 = document.querySelector(`:root > body`);".formatted(keyword), + "%s comment_001 = document.createComment(` Paragraph tag with empty class attribute `);".formatted(keyword), + "targetElement_001.appendChild(comment_001);", + "%s p_001 = document.createElement('p');".formatted(keyword), + "p_001.setAttribute(`class`, ``);", + "targetElement_001.appendChild(p_001);"); }else{ printConverted(converted); assertThat(converted).containsExactly( - "%s targetElement_000 = document.querySelector(`:root > body`);".formatted(keyword), - "%s p_000 = document.createElement('p');".formatted(keyword), - "p_000.setAttribute(`class`, ``);", - "targetElement_000.appendChild(p_000);"); + "%s targetElement_001 = document.querySelector(`:root > body`);".formatted(keyword), + "%s p_001 = document.createElement('p');".formatted(keyword), + "p_001.setAttribute(`class`, ``);", + "targetElement_001.appendChild(p_001);"); } input = "

"; @@ -951,21 +950,21 @@ void produceValidCodeWhenGivenTagWithAttributesWithComment(VariableDeclaration v printConverted(converted); assertThat(converted).containsExactly( - "%s targetElement_000 = document.querySelector(`:root > body`);".formatted(keyword), - "%s comment_000 = document.createComment(` Paragraph tag with class attribute `);".formatted(keyword), - "targetElement_000.appendChild(comment_000);", - "%s p_000 = document.createElement('p');".formatted(keyword), - "p_000.setAttribute(`class`, `class-value`);", - "targetElement_000.appendChild(p_000);"); + "%s targetElement_001 = document.querySelector(`:root > body`);".formatted(keyword), + "%s comment_001 = document.createComment(` Paragraph tag with class attribute `);".formatted(keyword), + "targetElement_001.appendChild(comment_001);", + "%s p_001 = document.createElement('p');".formatted(keyword), + "p_001.setAttribute(`class`, `class-value`);", + "targetElement_001.appendChild(p_001);"); }else{ printConverted(converted); assertThat(converted).containsExactly( - "%s targetElement_000 = document.querySelector(`:root > body`);".formatted(keyword), - "%s p_000 = document.createElement('p');".formatted(keyword), - "p_000.setAttribute(`class`, `class-value`);", - "targetElement_000.appendChild(p_000);"); + "%s targetElement_001 = document.querySelector(`:root > body`);".formatted(keyword), + "%s p_001 = document.createElement('p');".formatted(keyword), + "p_001.setAttribute(`class`, `class-value`);", + "targetElement_001.appendChild(p_001);"); } } else { @@ -977,15 +976,15 @@ void produceValidCodeWhenGivenTagWithAttributesWithComment(VariableDeclaration v if(commentConversionModeActivated){ printConverted(converted); assertThat(converted).containsExactly( - "%s comment_000 = document.createComment(` Div with id `);".formatted(keyword), - "%s div_000 = document.createElement('div');".formatted(keyword), - "div_000.setAttribute(`id`, `id-value`);"); + "%s comment_001 = document.createComment(` Div with id `);".formatted(keyword), + "%s div_001 = document.createElement('div');".formatted(keyword), + "div_001.setAttribute(`id`, `id-value`);"); }else{ printConverted(converted); assertThat(converted).containsExactly( - "%s div_000 = document.createElement('div');".formatted(keyword), - "div_000.setAttribute(`id`, `id-value`);"); + "%s div_001 = document.createElement('div');".formatted(keyword), + "div_001.setAttribute(`id`, `id-value`);"); } input = "
"; @@ -996,16 +995,16 @@ void produceValidCodeWhenGivenTagWithAttributesWithComment(VariableDeclaration v printConverted(converted); assertThat(converted).containsExactly( - "%s comment_000 = document.createComment(` Details tag with open attribute `);".formatted(keyword), - "%s details_000 = document.createElement('details');".formatted(keyword), - "details_000.setAttribute(`open`, `true`);"); + "%s comment_001 = document.createComment(` Details tag with open attribute `);".formatted(keyword), + "%s details_001 = document.createElement('details');".formatted(keyword), + "details_001.setAttribute(`open`, `true`);"); }else{ printConverted(converted); assertThat(converted).containsExactly( - "%s details_000 = document.createElement('details');".formatted(keyword), - "details_000.setAttribute(`open`, `true`);"); + "%s details_001 = document.createElement('details');".formatted(keyword), + "details_001.setAttribute(`open`, `true`);"); } @@ -1017,16 +1016,16 @@ void produceValidCodeWhenGivenTagWithAttributesWithComment(VariableDeclaration v printConverted(converted); assertThat(converted).containsExactly( - "%s comment_000 = document.createComment(` Paragraph tag with empty class attribute `);".formatted(keyword), - "%s p_000 = document.createElement('p');".formatted(keyword), - "p_000.setAttribute(`class`, ``);"); + "%s comment_001 = document.createComment(` Paragraph tag with empty class attribute `);".formatted(keyword), + "%s p_001 = document.createElement('p');".formatted(keyword), + "p_001.setAttribute(`class`, ``);"); }else{ printConverted(converted); assertThat(converted).containsExactly( - "%s p_000 = document.createElement('p');".formatted(keyword), - "p_000.setAttribute(`class`, ``);"); + "%s p_001 = document.createElement('p');".formatted(keyword), + "p_001.setAttribute(`class`, ``);"); } input = "

"; @@ -1037,16 +1036,16 @@ void produceValidCodeWhenGivenTagWithAttributesWithComment(VariableDeclaration v printConverted(converted); assertThat(converted).containsExactly( - "%s comment_000 = document.createComment(` Paragraph tag with class attribute `);".formatted(keyword), - "%s p_000 = document.createElement('p');".formatted(keyword), - "p_000.setAttribute(`class`, `class-value`);"); + "%s comment_001 = document.createComment(` Paragraph tag with class attribute `);".formatted(keyword), + "%s p_001 = document.createElement('p');".formatted(keyword), + "p_001.setAttribute(`class`, `class-value`);"); }else{ printConverted(converted); assertThat(converted).containsExactly( - "%s p_000 = document.createElement('p');".formatted(keyword), - "p_000.setAttribute(`class`, `class-value`);"); + "%s p_001 = document.createElement('p');".formatted(keyword), + "p_001.setAttribute(`class`, `class-value`);"); } } @@ -1066,25 +1065,25 @@ void produceValidCodeWhenGivenMultipleNodeAtRoot(VariableDeclaration variableDec if (querySelectorAdded) { if(commentConversionModeActivated){ assertThat(converted).containsExactly( - "%s targetElement_000 = document.querySelector(`:root > body`);".formatted(keyword), - "%s comment_000 = document.createComment(` %s `);".formatted(keyword, token), - "targetElement_000.appendChild(comment_000);", - "%s div_000 = document.createElement('div');".formatted(keyword), - "targetElement_000.appendChild(div_000);"); + "%s targetElement_001 = document.querySelector(`:root > body`);".formatted(keyword), + "%s comment_001 = document.createComment(` %s `);".formatted(keyword, token), + "targetElement_001.appendChild(comment_001);", + "%s div_001 = document.createElement('div');".formatted(keyword), + "targetElement_001.appendChild(div_001);"); }else{ assertThat(converted).containsExactly( - "%s targetElement_000 = document.querySelector(`:root > body`);".formatted(keyword), - "%s div_000 = document.createElement('div');".formatted(keyword), - "targetElement_000.appendChild(div_000);"); + "%s targetElement_001 = document.querySelector(`:root > body`);".formatted(keyword), + "%s div_001 = document.createElement('div');".formatted(keyword), + "targetElement_001.appendChild(div_001);"); } } else { if(commentConversionModeActivated){ assertThat(converted).containsExactly( - "%s comment_000 = document.createComment(` %s `);".formatted(keyword, token), - "%s div_000 = document.createElement('div');".formatted(keyword)); + "%s comment_001 = document.createComment(` %s `);".formatted(keyword, token), + "%s div_001 = document.createElement('div');".formatted(keyword)); }else{ - assertThat(converted).containsExactly("%s div_000 = document.createElement('div');".formatted(keyword)); + assertThat(converted).containsExactly("%s div_001 = document.createElement('div');".formatted(keyword)); } } } @@ -1101,17 +1100,17 @@ void produceValidCodeWithIncrementVariableNameWhenGivenMultipleNodeWithSameTagNa if (querySelectorAdded) { assertThat(converted).containsExactly( - "%s targetElement_000 = document.querySelector(`:root > body`);".formatted(keyword), - "%s div_000 = document.createElement('div');".formatted(keyword), - "targetElement_000.appendChild(div_000);", + "%s targetElement_001 = document.querySelector(`:root > body`);".formatted(keyword), "%s div_001 = document.createElement('div');".formatted(keyword), - "targetElement_000.appendChild(div_001);"); + "targetElement_001.appendChild(div_001);", + "%s div_002 = document.createElement('div');".formatted(keyword), + "targetElement_001.appendChild(div_002);"); } else { assertThat(converted).containsExactly( - "%s div_000 = document.createElement('div');".formatted(keyword), - "%s div_001 = document.createElement('div');".formatted(keyword)); + "%s div_001 = document.createElement('div');".formatted(keyword), + "%s div_002 = document.createElement('div');".formatted(keyword)); } } @@ -1126,37 +1125,37 @@ void produceValidCodeWhenGivenNestedNodes(VariableDeclaration variableDeclaratio if (querySelectorAdded) { assertThat(converted).containsExactly( - "%s targetElement_000 = document.querySelector(`:root > body`);".formatted(keyword), - "%s div_000 = document.createElement('div');".formatted(keyword), - "%s text_000 = document.createTextNode(`A `);".formatted(keyword), - "div_000.appendChild(text_000);", - "%s strong_000 = document.createElement('strong');".formatted(keyword), - "%s text_001 = document.createTextNode(`...`);".formatted(keyword), - "strong_000.appendChild(text_001);", - "div_000.appendChild(strong_000);", - "targetElement_000.appendChild(div_000);", + "%s targetElement_001 = document.querySelector(`:root > body`);".formatted(keyword), "%s div_001 = document.createElement('div');".formatted(keyword), - "%s p_000 = document.createElement('p');".formatted(keyword), - "%s text_002 = document.createTextNode(`Well, case!`);".formatted(keyword), - "p_000.appendChild(text_002);", - "div_001.appendChild(p_000);", - "targetElement_000.appendChild(div_001);"); + "%s text_001 = document.createTextNode(`A `);".formatted(keyword), + "div_001.appendChild(text_001);", + "%s strong_001 = document.createElement('strong');".formatted(keyword), + "%s text_002 = document.createTextNode(`...`);".formatted(keyword), + "strong_001.appendChild(text_002);", + "div_001.appendChild(strong_001);", + "targetElement_001.appendChild(div_001);", + "%s div_002 = document.createElement('div');".formatted(keyword), + "%s p_001 = document.createElement('p');".formatted(keyword), + "%s text_003 = document.createTextNode(`Well, case!`);".formatted(keyword), + "p_001.appendChild(text_003);", + "div_002.appendChild(p_001);", + "targetElement_001.appendChild(div_002);"); } else { assertThat(converted).containsExactly( - "%s div_000 = document.createElement('div');".formatted(keyword), - "%s text_000 = document.createTextNode(`A `);".formatted(keyword), - "div_000.appendChild(text_000);", - "%s strong_000 = document.createElement('strong');".formatted(keyword), - "%s text_001 = document.createTextNode(`...`);".formatted(keyword), - "strong_000.appendChild(text_001);", - "div_000.appendChild(strong_000);", "%s div_001 = document.createElement('div');".formatted(keyword), - "%s p_000 = document.createElement('p');".formatted(keyword), - "%s text_002 = document.createTextNode(`Well, case!`);".formatted(keyword), - "p_000.appendChild(text_002);", - "div_001.appendChild(p_000);"); + "%s text_001 = document.createTextNode(`A `);".formatted(keyword), + "div_001.appendChild(text_001);", + "%s strong_001 = document.createElement('strong');".formatted(keyword), + "%s text_002 = document.createTextNode(`...`);".formatted(keyword), + "strong_001.appendChild(text_002);", + "div_001.appendChild(strong_001);", + "%s div_002 = document.createElement('div');".formatted(keyword), + "%s p_001 = document.createElement('p');".formatted(keyword), + "%s text_003 = document.createTextNode(`Well, case!`);".formatted(keyword), + "p_001.appendChild(text_003);", + "div_002.appendChild(p_001);"); } } @@ -1183,201 +1182,201 @@ void produceValidCodeWhenGivenPathToAFile(VariableDeclaration variableDeclaratio //TODO: `:root > body` please, where did you get it ? from Jsoup ? assertThat(converted).containsExactly( - "%s targetElement_000 = document.querySelector(`:root > body`);".formatted(keyword), - "%s html_000 = document.createElement('html');".formatted(keyword), - "%s text_000 = document.createTextNode(` `);".formatted(keyword), - "html_000.appendChild(text_000);", - "%s head_000 = document.createElement('head');".formatted(keyword), - "%s text_001 = document.createTextNode(` `);".formatted(keyword), - "head_000.appendChild(text_001);", - "%s meta_000 = document.createElement('meta');".formatted(keyword), - "meta_000.setAttribute(`charset`, `utf-8`);", - "head_000.appendChild(meta_000);", + "%s targetElement_001 = document.querySelector(`:root > body`);".formatted(keyword), + "%s html_001 = document.createElement('html');".formatted(keyword), + "%s text_001 = document.createTextNode(` `);".formatted(keyword), + "html_001.appendChild(text_001);", + "%s head_001 = document.createElement('head');".formatted(keyword), "%s text_002 = document.createTextNode(` `);".formatted(keyword), - "head_000.appendChild(text_002);", - "%s title_000 = document.createElement('title');".formatted(keyword), - "%s text_003 = document.createTextNode(`Sample`);".formatted(keyword), - "title_000.appendChild(text_003);", - "head_000.appendChild(title_000);", - "%s text_004 = document.createTextNode(` `);".formatted(keyword), - "head_000.appendChild(text_004);", - "%s link_000 = document.createElement('link');".formatted(keyword), - "link_000.setAttribute(`rel`, `stylesheet`);", - "link_000.setAttribute(`href`, ``);", - "head_000.appendChild(link_000);", - "%s text_005 = document.createTextNode(` `);".formatted(keyword), - "head_000.appendChild(text_005);", - "html_000.appendChild(head_000);", + "head_001.appendChild(text_002);", + "%s meta_001 = document.createElement('meta');".formatted(keyword), + "meta_001.setAttribute(`charset`, `utf-8`);", + "head_001.appendChild(meta_001);", + "%s text_003 = document.createTextNode(` `);".formatted(keyword), + "head_001.appendChild(text_003);", + "%s title_001 = document.createElement('title');".formatted(keyword), + "%s text_004 = document.createTextNode(`Sample`);".formatted(keyword), + "title_001.appendChild(text_004);", + "head_001.appendChild(title_001);", + "%s text_005 = document.createTextNode(` `);".formatted(keyword), + "head_001.appendChild(text_005);", + "%s link_001 = document.createElement('link');".formatted(keyword), + "link_001.setAttribute(`rel`, `stylesheet`);", + "link_001.setAttribute(`href`, ``);", + "head_001.appendChild(link_001);", "%s text_006 = document.createTextNode(` `);".formatted(keyword), - "html_000.appendChild(text_006);", - "%s body_000 = document.createElement('body');".formatted(keyword), - "%s text_007 = document.createTextNode(` `);".formatted(keyword), - "body_000.appendChild(text_007);", - "%s div_000 = document.createElement('div');".formatted(keyword), - "div_000.setAttribute(`id`, `container`);", - "%s text_008 = document.createTextNode(` `);".formatted(keyword), - "div_000.appendChild(text_008);", + "head_001.appendChild(text_006);", + "html_001.appendChild(head_001);", + "%s text_007 = document.createTextNode(` `);".formatted(keyword), + "html_001.appendChild(text_007);", + "%s body_001 = document.createElement('body');".formatted(keyword), + "%s text_008 = document.createTextNode(` `);".formatted(keyword), + "body_001.appendChild(text_008);", "%s div_001 = document.createElement('div');".formatted(keyword), - "div_001.setAttribute(`id`, `header`);", - "%s text_009 = document.createTextNode(` `);".formatted(keyword), + "div_001.setAttribute(`id`, `container`);", + "%s text_009 = document.createTextNode(` `);".formatted(keyword), "div_001.appendChild(text_009);", - "%s h1_000 = document.createElement('h1');".formatted(keyword), - "%s text_010 = document.createTextNode(`Sample`);".formatted(keyword), - "h1_000.appendChild(text_010);", - "div_001.appendChild(h1_000);", - "%s text_011 = document.createTextNode(` `);".formatted(keyword), - "div_001.appendChild(text_011);", - "%s img_000 = document.createElement('img');".formatted(keyword), - "img_000.setAttribute(`src`, `kanye.jpg`);", - "img_000.setAttribute(`alt`, `kanye`);", - "div_001.appendChild(img_000);", - "%s text_012 = document.createTextNode(` `);".formatted(keyword), - "div_001.appendChild(text_012);", - "div_000.appendChild(div_001);", - "%s text_013 = document.createTextNode(` `);".formatted(keyword), - "div_000.appendChild(text_013);", "%s div_002 = document.createElement('div');".formatted(keyword), - "div_002.setAttribute(`id`, `main`);", - "%s text_014 = document.createTextNode(` `);".formatted(keyword), - "div_002.appendChild(text_014);", - "%s h2_000 = document.createElement('h2');".formatted(keyword), - "%s text_015 = document.createTextNode(`Main`);".formatted(keyword), - "h2_000.appendChild(text_015);", - "div_002.appendChild(h2_000);", - "%s text_016 = document.createTextNode(` `);".formatted(keyword), - "div_002.appendChild(text_016);", - "%s p_000 = document.createElement('p');".formatted(keyword), - "%s text_017 = document.createTextNode(`This is the main content.`);".formatted(keyword), - "p_000.appendChild(text_017);", - "div_002.appendChild(p_000);", - "%s text_018 = document.createTextNode(` `);".formatted(keyword), - "div_002.appendChild(text_018);", + "div_002.setAttribute(`id`, `header`);", + "%s text_010 = document.createTextNode(` `);".formatted(keyword), + "div_002.appendChild(text_010);", + "%s h1_001 = document.createElement('h1');".formatted(keyword), + "%s text_011 = document.createTextNode(`Sample`);".formatted(keyword), + "h1_001.appendChild(text_011);", + "div_002.appendChild(h1_001);", + "%s text_012 = document.createTextNode(` `);".formatted(keyword), + "div_002.appendChild(text_012);", "%s img_001 = document.createElement('img');".formatted(keyword), - "img_001.setAttribute(`src`, ``);", - "img_001.setAttribute(`alt`, ``);", + "img_001.setAttribute(`src`, `kanye.jpg`);", + "img_001.setAttribute(`alt`, `kanye`);", "div_002.appendChild(img_001);", - "%s text_019 = document.createTextNode(` `);".formatted(keyword), - "div_002.appendChild(text_019);", - "div_000.appendChild(div_002);", - "%s text_020 = document.createTextNode(` `);".formatted(keyword), - "div_000.appendChild(text_020);", + "%s text_013 = document.createTextNode(` `);".formatted(keyword), + "div_002.appendChild(text_013);", + "div_001.appendChild(div_002);", + "%s text_014 = document.createTextNode(` `);".formatted(keyword), + "div_001.appendChild(text_014);", "%s div_003 = document.createElement('div');".formatted(keyword), - "div_003.setAttribute(`id`, `footer`);", - "%s text_021 = document.createTextNode(` `);".formatted(keyword), - "div_003.appendChild(text_021);", + "div_003.setAttribute(`id`, `main`);", + "%s text_015 = document.createTextNode(` `);".formatted(keyword), + "div_003.appendChild(text_015);", + "%s h2_001 = document.createElement('h2');".formatted(keyword), + "%s text_016 = document.createTextNode(`Main`);".formatted(keyword), + "h2_001.appendChild(text_016);", + "div_003.appendChild(h2_001);", + "%s text_017 = document.createTextNode(` `);".formatted(keyword), + "div_003.appendChild(text_017);", "%s p_001 = document.createElement('p');".formatted(keyword), - "%s text_022 = document.createTextNode(`Copyright © 2019`);".formatted(keyword), - "p_001.appendChild(text_022);", + "%s text_018 = document.createTextNode(`This is the main content.`);".formatted(keyword), + "p_001.appendChild(text_018);", "div_003.appendChild(p_001);", - "%s text_023 = document.createTextNode(` `);".formatted(keyword), - "div_003.appendChild(text_023);", - "div_000.appendChild(div_003);", - "%s text_024 = document.createTextNode(` `);".formatted(keyword), - "div_000.appendChild(text_024);", - "body_000.appendChild(div_000);", - "%s text_025 = document.createTextNode(` `);".formatted(keyword), - "body_000.appendChild(text_025);", - "html_000.appendChild(body_000);", - "targetElement_000.appendChild(html_000);"); + "%s text_019 = document.createTextNode(` `);".formatted(keyword), + "div_003.appendChild(text_019);", + "%s img_002 = document.createElement('img');".formatted(keyword), + "img_002.setAttribute(`src`, ``);", + "img_002.setAttribute(`alt`, ``);", + "div_003.appendChild(img_002);", + "%s text_020 = document.createTextNode(` `);".formatted(keyword), + "div_003.appendChild(text_020);", + "div_001.appendChild(div_003);", + "%s text_021 = document.createTextNode(` `);".formatted(keyword), + "div_001.appendChild(text_021);", + "%s div_004 = document.createElement('div');".formatted(keyword), + "div_004.setAttribute(`id`, `footer`);", + "%s text_022 = document.createTextNode(` `);".formatted(keyword), + "div_004.appendChild(text_022);", + "%s p_002 = document.createElement('p');".formatted(keyword), + "%s text_023 = document.createTextNode(`Copyright © 2019`);".formatted(keyword), + "p_002.appendChild(text_023);", + "div_004.appendChild(p_002);", + "%s text_024 = document.createTextNode(` `);".formatted(keyword), + "div_004.appendChild(text_024);", + "div_001.appendChild(div_004);", + "%s text_025 = document.createTextNode(` `);".formatted(keyword), + "div_001.appendChild(text_025);", + "body_001.appendChild(div_001);", + "%s text_026 = document.createTextNode(` `);".formatted(keyword), + "body_001.appendChild(text_026);", + "html_001.appendChild(body_001);", + "targetElement_001.appendChild(html_001);"); } else { assertThat(converted).containsExactly( - "%s html_000 = document.createElement('html');".formatted(keyword), - "%s text_000 = document.createTextNode(` `);".formatted(keyword), - "html_000.appendChild(text_000);", - "%s head_000 = document.createElement('head');".formatted(keyword), - "%s text_001 = document.createTextNode(` `);".formatted(keyword), - "head_000.appendChild(text_001);", - "%s meta_000 = document.createElement('meta');".formatted(keyword), - "meta_000.setAttribute(`charset`, `utf-8`);", - "head_000.appendChild(meta_000);", + "%s html_001 = document.createElement('html');".formatted(keyword), + "%s text_001 = document.createTextNode(` `);".formatted(keyword), + "html_001.appendChild(text_001);", + "%s head_001 = document.createElement('head');".formatted(keyword), "%s text_002 = document.createTextNode(` `);".formatted(keyword), - "head_000.appendChild(text_002);", - "%s title_000 = document.createElement('title');".formatted(keyword), - "%s text_003 = document.createTextNode(`Sample`);".formatted(keyword), - "title_000.appendChild(text_003);", - "head_000.appendChild(title_000);", - "%s text_004 = document.createTextNode(` `);".formatted(keyword), - "head_000.appendChild(text_004);", - "%s link_000 = document.createElement('link');".formatted(keyword), - "link_000.setAttribute(`rel`, `stylesheet`);", - "link_000.setAttribute(`href`, ``);", - "head_000.appendChild(link_000);", - "%s text_005 = document.createTextNode(` `);".formatted(keyword), - "head_000.appendChild(text_005);", - "html_000.appendChild(head_000);", + "head_001.appendChild(text_002);", + "%s meta_001 = document.createElement('meta');".formatted(keyword), + "meta_001.setAttribute(`charset`, `utf-8`);", + "head_001.appendChild(meta_001);", + "%s text_003 = document.createTextNode(` `);".formatted(keyword), + "head_001.appendChild(text_003);", + "%s title_001 = document.createElement('title');".formatted(keyword), + "%s text_004 = document.createTextNode(`Sample`);".formatted(keyword), + "title_001.appendChild(text_004);", + "head_001.appendChild(title_001);", + "%s text_005 = document.createTextNode(` `);".formatted(keyword), + "head_001.appendChild(text_005);", + "%s link_001 = document.createElement('link');".formatted(keyword), + "link_001.setAttribute(`rel`, `stylesheet`);", + "link_001.setAttribute(`href`, ``);", + "head_001.appendChild(link_001);", "%s text_006 = document.createTextNode(` `);".formatted(keyword), - "html_000.appendChild(text_006);", - "%s body_000 = document.createElement('body');".formatted(keyword), - "%s text_007 = document.createTextNode(` `);".formatted(keyword), - "body_000.appendChild(text_007);", - "%s div_000 = document.createElement('div');".formatted(keyword), - "div_000.setAttribute(`id`, `container`);", - "%s text_008 = document.createTextNode(` `);".formatted(keyword), - "div_000.appendChild(text_008);", + "head_001.appendChild(text_006);", + "html_001.appendChild(head_001);", + "%s text_007 = document.createTextNode(` `);".formatted(keyword), + "html_001.appendChild(text_007);", + "%s body_001 = document.createElement('body');".formatted(keyword), + "%s text_008 = document.createTextNode(` `);".formatted(keyword), + "body_001.appendChild(text_008);", "%s div_001 = document.createElement('div');".formatted(keyword), - "div_001.setAttribute(`id`, `header`);", - "%s text_009 = document.createTextNode(` `);".formatted(keyword), + "div_001.setAttribute(`id`, `container`);", + "%s text_009 = document.createTextNode(` `);".formatted(keyword), "div_001.appendChild(text_009);", - "%s h1_000 = document.createElement('h1');".formatted(keyword), - "%s text_010 = document.createTextNode(`Sample`);".formatted(keyword), - "h1_000.appendChild(text_010);", - "div_001.appendChild(h1_000);", - "%s text_011 = document.createTextNode(` `);".formatted(keyword), - "div_001.appendChild(text_011);", - "%s img_000 = document.createElement('img');".formatted(keyword), - "img_000.setAttribute(`src`, `kanye.jpg`);", - "img_000.setAttribute(`alt`, `kanye`);", - "div_001.appendChild(img_000);", - "%s text_012 = document.createTextNode(` `);".formatted(keyword), - "div_001.appendChild(text_012);", - "div_000.appendChild(div_001);", - "%s text_013 = document.createTextNode(` `);".formatted(keyword), - "div_000.appendChild(text_013);", "%s div_002 = document.createElement('div');".formatted(keyword), - "div_002.setAttribute(`id`, `main`);", - "%s text_014 = document.createTextNode(` `);".formatted(keyword), - "div_002.appendChild(text_014);", - "%s h2_000 = document.createElement('h2');".formatted(keyword), - "%s text_015 = document.createTextNode(`Main`);".formatted(keyword), - "h2_000.appendChild(text_015);", - "div_002.appendChild(h2_000);", - "%s text_016 = document.createTextNode(` `);".formatted(keyword), - "div_002.appendChild(text_016);", - "%s p_000 = document.createElement('p');".formatted(keyword), - "%s text_017 = document.createTextNode(`This is the main content.`);".formatted(keyword), - "p_000.appendChild(text_017);", - "div_002.appendChild(p_000);", - "%s text_018 = document.createTextNode(` `);".formatted(keyword), - "div_002.appendChild(text_018);", + "div_002.setAttribute(`id`, `header`);", + "%s text_010 = document.createTextNode(` `);".formatted(keyword), + "div_002.appendChild(text_010);", + "%s h1_001 = document.createElement('h1');".formatted(keyword), + "%s text_011 = document.createTextNode(`Sample`);".formatted(keyword), + "h1_001.appendChild(text_011);", + "div_002.appendChild(h1_001);", + "%s text_012 = document.createTextNode(` `);".formatted(keyword), + "div_002.appendChild(text_012);", "%s img_001 = document.createElement('img');".formatted(keyword), - "img_001.setAttribute(`src`, ``);", - "img_001.setAttribute(`alt`, ``);", + "img_001.setAttribute(`src`, `kanye.jpg`);", + "img_001.setAttribute(`alt`, `kanye`);", "div_002.appendChild(img_001);", - "%s text_019 = document.createTextNode(` `);".formatted(keyword), - "div_002.appendChild(text_019);", - "div_000.appendChild(div_002);", - "%s text_020 = document.createTextNode(` `);".formatted(keyword), - "div_000.appendChild(text_020);", + "%s text_013 = document.createTextNode(` `);".formatted(keyword), + "div_002.appendChild(text_013);", + "div_001.appendChild(div_002);", + "%s text_014 = document.createTextNode(` `);".formatted(keyword), + "div_001.appendChild(text_014);", "%s div_003 = document.createElement('div');".formatted(keyword), - "div_003.setAttribute(`id`, `footer`);", - "%s text_021 = document.createTextNode(` `);".formatted(keyword), - "div_003.appendChild(text_021);", + "div_003.setAttribute(`id`, `main`);", + "%s text_015 = document.createTextNode(` `);".formatted(keyword), + "div_003.appendChild(text_015);", + "%s h2_001 = document.createElement('h2');".formatted(keyword), + "%s text_016 = document.createTextNode(`Main`);".formatted(keyword), + "h2_001.appendChild(text_016);", + "div_003.appendChild(h2_001);", + "%s text_017 = document.createTextNode(` `);".formatted(keyword), + "div_003.appendChild(text_017);", "%s p_001 = document.createElement('p');".formatted(keyword), - "%s text_022 = document.createTextNode(`Copyright © 2019`);".formatted(keyword), - "p_001.appendChild(text_022);", + "%s text_018 = document.createTextNode(`This is the main content.`);".formatted(keyword), + "p_001.appendChild(text_018);", "div_003.appendChild(p_001);", - "%s text_023 = document.createTextNode(` `);".formatted(keyword), - "div_003.appendChild(text_023);", - "div_000.appendChild(div_003);", - "%s text_024 = document.createTextNode(` `);".formatted(keyword), - "div_000.appendChild(text_024);", - "body_000.appendChild(div_000);", - "%s text_025 = document.createTextNode(` `);".formatted(keyword), - "body_000.appendChild(text_025);", - "html_000.appendChild(body_000);"); + "%s text_019 = document.createTextNode(` `);".formatted(keyword), + "div_003.appendChild(text_019);", + "%s img_002 = document.createElement('img');".formatted(keyword), + "img_002.setAttribute(`src`, ``);", + "img_002.setAttribute(`alt`, ``);", + "div_003.appendChild(img_002);", + "%s text_020 = document.createTextNode(` `);".formatted(keyword), + "div_003.appendChild(text_020);", + "div_001.appendChild(div_003);", + "%s text_021 = document.createTextNode(` `);".formatted(keyword), + "div_001.appendChild(text_021);", + "%s div_004 = document.createElement('div');".formatted(keyword), + "div_004.setAttribute(`id`, `footer`);", + "%s text_022 = document.createTextNode(` `);".formatted(keyword), + "div_004.appendChild(text_022);", + "%s p_002 = document.createElement('p');".formatted(keyword), + "%s text_023 = document.createTextNode(`Copyright © 2019`);".formatted(keyword), + "p_002.appendChild(text_023);", + "div_004.appendChild(p_002);", + "%s text_024 = document.createTextNode(` `);".formatted(keyword), + "div_004.appendChild(text_024);", + "div_001.appendChild(div_004);", + "%s text_025 = document.createTextNode(` `);".formatted(keyword), + "div_001.appendChild(text_025);", + "body_001.appendChild(div_001);", + "%s text_026 = document.createTextNode(` `);".formatted(keyword), + "body_001.appendChild(text_026);", + "html_001.appendChild(body_001);"); } } @@ -1406,215 +1405,215 @@ void produceValidCodeWhenGivenPathToAFileWithComment(VariableDeclaration variabl if(commentConversionModeActivated){ assertThat(converted).containsExactly( - "%s targetElement_000 = document.querySelector(`:root > body`);".formatted(keyword), - "%s html_000 = document.createElement('html');".formatted(keyword), - "%s text_000 = document.createTextNode(` `);".formatted(keyword), - "html_000.appendChild(text_000);", - "%s head_000 = document.createElement('head');".formatted(keyword), - "%s text_001 = document.createTextNode(` `);".formatted(keyword), - "head_000.appendChild(text_001);", - "%s meta_000 = document.createElement('meta');".formatted(keyword), - "meta_000.setAttribute(`charset`, `utf-8`);", - "head_000.appendChild(meta_000);", + "%s targetElement_001 = document.querySelector(`:root > body`);".formatted(keyword), + "%s html_001 = document.createElement('html');".formatted(keyword), + "%s text_001 = document.createTextNode(` `);".formatted(keyword), + "html_001.appendChild(text_001);", + "%s head_001 = document.createElement('head');".formatted(keyword), "%s text_002 = document.createTextNode(` `);".formatted(keyword), - "head_000.appendChild(text_002);", - "%s title_000 = document.createElement('title');".formatted(keyword), - "%s text_003 = document.createTextNode(`Sample`);".formatted(keyword), - "title_000.appendChild(text_003);", - "head_000.appendChild(title_000);", - "%s text_004 = document.createTextNode(` `);".formatted(keyword), - "head_000.appendChild(text_004);", - "%s link_000 = document.createElement('link');".formatted(keyword), - "link_000.setAttribute(`rel`, `stylesheet`);", - "link_000.setAttribute(`href`, ``);", - "head_000.appendChild(link_000);", - "%s text_005 = document.createTextNode(` `);".formatted(keyword), - "head_000.appendChild(text_005);", - "html_000.appendChild(head_000);", + "head_001.appendChild(text_002);", + "%s meta_001 = document.createElement('meta');".formatted(keyword), + "meta_001.setAttribute(`charset`, `utf-8`);", + "head_001.appendChild(meta_001);", + "%s text_003 = document.createTextNode(` `);".formatted(keyword), + "head_001.appendChild(text_003);", + "%s title_001 = document.createElement('title');".formatted(keyword), + "%s text_004 = document.createTextNode(`Sample`);".formatted(keyword), + "title_001.appendChild(text_004);", + "head_001.appendChild(title_001);", + "%s text_005 = document.createTextNode(` `);".formatted(keyword), + "head_001.appendChild(text_005);", + "%s link_001 = document.createElement('link');".formatted(keyword), + "link_001.setAttribute(`rel`, `stylesheet`);", + "link_001.setAttribute(`href`, ``);", + "head_001.appendChild(link_001);", "%s text_006 = document.createTextNode(` `);".formatted(keyword), - "html_000.appendChild(text_006);", - "%s body_000 = document.createElement('body');".formatted(keyword), - "%s text_007 = document.createTextNode(` `);".formatted(keyword), - "body_000.appendChild(text_007);", - "%s div_000 = document.createElement('div');".formatted(keyword), - "div_000.setAttribute(`id`, `container`);", - "%s text_008 = document.createTextNode(` `);".formatted(keyword), - "div_000.appendChild(text_008);", + "head_001.appendChild(text_006);", + "html_001.appendChild(head_001);", + "%s text_007 = document.createTextNode(` `);".formatted(keyword), + "html_001.appendChild(text_007);", + "%s body_001 = document.createElement('body');".formatted(keyword), + "%s text_008 = document.createTextNode(` `);".formatted(keyword), + "body_001.appendChild(text_008);", "%s div_001 = document.createElement('div');".formatted(keyword), - "div_001.setAttribute(`id`, `header`);", - "%s text_009 = document.createTextNode(` `);".formatted(keyword), + "div_001.setAttribute(`id`, `container`);", + "%s text_009 = document.createTextNode(` `);".formatted(keyword), "div_001.appendChild(text_009);", - "%s comment_000 = document.createComment(` Sample H1 `);".formatted(keyword), - "div_001.appendChild(comment_000);", - "%s text_010 = document.createTextNode(` `);".formatted(keyword), - "div_001.appendChild(text_010);", - "%s h1_000 = document.createElement('h1');".formatted(keyword), - "%s text_011 = document.createTextNode(`Sample`);".formatted(keyword), - "h1_000.appendChild(text_011);", - "div_001.appendChild(h1_000);", - "%s text_012 = document.createTextNode(` `);".formatted(keyword), - "div_001.appendChild(text_012);", - "%s img_000 = document.createElement('img');".formatted(keyword), - "img_000.setAttribute(`src`, `kanye.jpg`);", - "img_000.setAttribute(`alt`, `kanye`);", - "div_001.appendChild(img_000);", - "%s text_013 = document.createTextNode(` `);".formatted(keyword), - "div_001.appendChild(text_013);", - "div_000.appendChild(div_001);", - "%s text_014 = document.createTextNode(` `);".formatted(keyword), - "div_000.appendChild(text_014);", "%s div_002 = document.createElement('div');".formatted(keyword), - "div_002.setAttribute(`id`, `main`);", - "%s text_015 = document.createTextNode(` `);".formatted(keyword), - "div_002.appendChild(text_015);", - "%s h2_000 = document.createElement('h2');".formatted(keyword), - "%s text_016 = document.createTextNode(`Main`);".formatted(keyword), - "h2_000.appendChild(text_016);", - "div_002.appendChild(h2_000);", - "%s text_017 = document.createTextNode(` `);".formatted(keyword), - "div_002.appendChild(text_017);", - "%s p_000 = document.createElement('p');".formatted(keyword), - "%s text_018 = document.createTextNode(`This is the main content.`);".formatted(keyword), - "p_000.appendChild(text_018);", - "div_002.appendChild(p_000);", - "%s text_019 = document.createTextNode(` `);".formatted(keyword), - "div_002.appendChild(text_019);", + "div_002.setAttribute(`id`, `header`);", + "%s text_010 = document.createTextNode(` `);".formatted(keyword), + "div_002.appendChild(text_010);", + "%s comment_001 = document.createComment(` Sample H1 `);".formatted(keyword), + "div_002.appendChild(comment_001);", + "%s text_011 = document.createTextNode(` `);".formatted(keyword), + "div_002.appendChild(text_011);", + "%s h1_001 = document.createElement('h1');".formatted(keyword), + "%s text_012 = document.createTextNode(`Sample`);".formatted(keyword), + "h1_001.appendChild(text_012);", + "div_002.appendChild(h1_001);", + "%s text_013 = document.createTextNode(` `);".formatted(keyword), + "div_002.appendChild(text_013);", "%s img_001 = document.createElement('img');".formatted(keyword), - "img_001.setAttribute(`src`, ``);", - "img_001.setAttribute(`alt`, ``);", + "img_001.setAttribute(`src`, `kanye.jpg`);", + "img_001.setAttribute(`alt`, `kanye`);", "div_002.appendChild(img_001);", - "%s text_020 = document.createTextNode(` `);".formatted(keyword), - "div_002.appendChild(text_020);", - "div_000.appendChild(div_002);", - "%s text_021 = document.createTextNode(` `);".formatted(keyword), - "div_000.appendChild(text_021);", + "%s text_014 = document.createTextNode(` `);".formatted(keyword), + "div_002.appendChild(text_014);", + "div_001.appendChild(div_002);", + "%s text_015 = document.createTextNode(` `);".formatted(keyword), + "div_001.appendChild(text_015);", "%s div_003 = document.createElement('div');".formatted(keyword), - "div_003.setAttribute(`id`, `footer`);", - "%s text_022 = document.createTextNode(` `);".formatted(keyword), - "div_003.appendChild(text_022);", - "%s comment_001 = document.createComment(` Copyright `);".formatted(keyword), - "div_003.appendChild(comment_001);", - "%s text_023 = document.createTextNode(` `);".formatted(keyword), - "div_003.appendChild(text_023);", + "div_003.setAttribute(`id`, `main`);", + "%s text_016 = document.createTextNode(` `);".formatted(keyword), + "div_003.appendChild(text_016);", + "%s h2_001 = document.createElement('h2');".formatted(keyword), + "%s text_017 = document.createTextNode(`Main`);".formatted(keyword), + "h2_001.appendChild(text_017);", + "div_003.appendChild(h2_001);", + "%s text_018 = document.createTextNode(` `);".formatted(keyword), + "div_003.appendChild(text_018);", "%s p_001 = document.createElement('p');".formatted(keyword), - "%s text_024 = document.createTextNode(`Copyright © 2019`);".formatted(keyword), - "p_001.appendChild(text_024);", + "%s text_019 = document.createTextNode(`This is the main content.`);".formatted(keyword), + "p_001.appendChild(text_019);", "div_003.appendChild(p_001);", - "%s text_025 = document.createTextNode(` `);".formatted(keyword), - "div_003.appendChild(text_025);", - "div_000.appendChild(div_003);", - "%s text_026 = document.createTextNode(` `);".formatted(keyword), - "div_000.appendChild(text_026);", - "body_000.appendChild(div_000);", - "%s text_027 = document.createTextNode(` `);".formatted(keyword), - "body_000.appendChild(text_027);", - "html_000.appendChild(body_000);", - "targetElement_000.appendChild(html_000);"); + "%s text_020 = document.createTextNode(` `);".formatted(keyword), + "div_003.appendChild(text_020);", + "%s img_002 = document.createElement('img');".formatted(keyword), + "img_002.setAttribute(`src`, ``);", + "img_002.setAttribute(`alt`, ``);", + "div_003.appendChild(img_002);", + "%s text_021 = document.createTextNode(` `);".formatted(keyword), + "div_003.appendChild(text_021);", + "div_001.appendChild(div_003);", + "%s text_022 = document.createTextNode(` `);".formatted(keyword), + "div_001.appendChild(text_022);", + "%s div_004 = document.createElement('div');".formatted(keyword), + "div_004.setAttribute(`id`, `footer`);", + "%s text_023 = document.createTextNode(` `);".formatted(keyword), + "div_004.appendChild(text_023);", + "%s comment_002 = document.createComment(` Copyright `);".formatted(keyword), + "div_004.appendChild(comment_002);", + "%s text_024 = document.createTextNode(` `);".formatted(keyword), + "div_004.appendChild(text_024);", + "%s p_002 = document.createElement('p');".formatted(keyword), + "%s text_025 = document.createTextNode(`Copyright © 2019`);".formatted(keyword), + "p_002.appendChild(text_025);", + "div_004.appendChild(p_002);", + "%s text_026 = document.createTextNode(` `);".formatted(keyword), + "div_004.appendChild(text_026);", + "div_001.appendChild(div_004);", + "%s text_027 = document.createTextNode(` `);".formatted(keyword), + "div_001.appendChild(text_027);", + "body_001.appendChild(div_001);", + "%s text_028 = document.createTextNode(` `);".formatted(keyword), + "body_001.appendChild(text_028);", + "html_001.appendChild(body_001);", + "targetElement_001.appendChild(html_001);"); }else{ assertThat(converted).containsExactly( - "%s targetElement_000 = document.querySelector(`:root > body`);".formatted(keyword), - "%s html_000 = document.createElement('html');".formatted(keyword), - "%s text_000 = document.createTextNode(` `);".formatted(keyword), - "html_000.appendChild(text_000);", - "%s head_000 = document.createElement('head');".formatted(keyword), - "%s text_001 = document.createTextNode(` `);".formatted(keyword), - "head_000.appendChild(text_001);", - "%s meta_000 = document.createElement('meta');".formatted(keyword), - "meta_000.setAttribute(`charset`, `utf-8`);", - "head_000.appendChild(meta_000);", + "%s targetElement_001 = document.querySelector(`:root > body`);".formatted(keyword), + "%s html_001 = document.createElement('html');".formatted(keyword), + "%s text_001 = document.createTextNode(` `);".formatted(keyword), + "html_001.appendChild(text_001);", + "%s head_001 = document.createElement('head');".formatted(keyword), "%s text_002 = document.createTextNode(` `);".formatted(keyword), - "head_000.appendChild(text_002);", - "%s title_000 = document.createElement('title');".formatted(keyword), - "%s text_003 = document.createTextNode(`Sample`);".formatted(keyword), - "title_000.appendChild(text_003);", - "head_000.appendChild(title_000);", - "%s text_004 = document.createTextNode(` `);".formatted(keyword), - "head_000.appendChild(text_004);", - "%s link_000 = document.createElement('link');".formatted(keyword), - "link_000.setAttribute(`rel`, `stylesheet`);", - "link_000.setAttribute(`href`, ``);", - "head_000.appendChild(link_000);", - "%s text_005 = document.createTextNode(` `);".formatted(keyword), - "head_000.appendChild(text_005);", - "html_000.appendChild(head_000);", + "head_001.appendChild(text_002);", + "%s meta_001 = document.createElement('meta');".formatted(keyword), + "meta_001.setAttribute(`charset`, `utf-8`);", + "head_001.appendChild(meta_001);", + "%s text_003 = document.createTextNode(` `);".formatted(keyword), + "head_001.appendChild(text_003);", + "%s title_001 = document.createElement('title');".formatted(keyword), + "%s text_004 = document.createTextNode(`Sample`);".formatted(keyword), + "title_001.appendChild(text_004);", + "head_001.appendChild(title_001);", + "%s text_005 = document.createTextNode(` `);".formatted(keyword), + "head_001.appendChild(text_005);", + "%s link_001 = document.createElement('link');".formatted(keyword), + "link_001.setAttribute(`rel`, `stylesheet`);", + "link_001.setAttribute(`href`, ``);", + "head_001.appendChild(link_001);", "%s text_006 = document.createTextNode(` `);".formatted(keyword), - "html_000.appendChild(text_006);", - "%s body_000 = document.createElement('body');".formatted(keyword), - "%s text_007 = document.createTextNode(` `);".formatted(keyword), - "body_000.appendChild(text_007);", - "%s div_000 = document.createElement('div');".formatted(keyword), - "div_000.setAttribute(`id`, `container`);", - "%s text_008 = document.createTextNode(` `);".formatted(keyword), - "div_000.appendChild(text_008);", + "head_001.appendChild(text_006);", + "html_001.appendChild(head_001);", + "%s text_007 = document.createTextNode(` `);".formatted(keyword), + "html_001.appendChild(text_007);", + "%s body_001 = document.createElement('body');".formatted(keyword), + "%s text_008 = document.createTextNode(` `);".formatted(keyword), + "body_001.appendChild(text_008);", "%s div_001 = document.createElement('div');".formatted(keyword), - "div_001.setAttribute(`id`, `header`);", - "%s text_009 = document.createTextNode(` `);".formatted(keyword), + "div_001.setAttribute(`id`, `container`);", + "%s text_009 = document.createTextNode(` `);".formatted(keyword), "div_001.appendChild(text_009);", - "%s text_010 = document.createTextNode(` `);".formatted(keyword), - "div_001.appendChild(text_010);", - "%s h1_000 = document.createElement('h1');".formatted(keyword), - "%s text_011 = document.createTextNode(`Sample`);".formatted(keyword), - "h1_000.appendChild(text_011);", - "div_001.appendChild(h1_000);", - "%s text_012 = document.createTextNode(` `);".formatted(keyword), - "div_001.appendChild(text_012);", - "%s img_000 = document.createElement('img');".formatted(keyword), - "img_000.setAttribute(`src`, `kanye.jpg`);", - "img_000.setAttribute(`alt`, `kanye`);", - "div_001.appendChild(img_000);", - "%s text_013 = document.createTextNode(` `);".formatted(keyword), - "div_001.appendChild(text_013);", - "div_000.appendChild(div_001);", - "%s text_014 = document.createTextNode(` `);".formatted(keyword), - "div_000.appendChild(text_014);", "%s div_002 = document.createElement('div');".formatted(keyword), - "div_002.setAttribute(`id`, `main`);", - "%s text_015 = document.createTextNode(` `);".formatted(keyword), - "div_002.appendChild(text_015);", - "%s h2_000 = document.createElement('h2');".formatted(keyword), - "%s text_016 = document.createTextNode(`Main`);".formatted(keyword), - "h2_000.appendChild(text_016);", - "div_002.appendChild(h2_000);", - "%s text_017 = document.createTextNode(` `);".formatted(keyword), - "div_002.appendChild(text_017);", - "%s p_000 = document.createElement('p');".formatted(keyword), - "%s text_018 = document.createTextNode(`This is the main content.`);".formatted(keyword), - "p_000.appendChild(text_018);", - "div_002.appendChild(p_000);", - "%s text_019 = document.createTextNode(` `);".formatted(keyword), - "div_002.appendChild(text_019);", + "div_002.setAttribute(`id`, `header`);", + "%s text_010 = document.createTextNode(` `);".formatted(keyword), + "div_002.appendChild(text_010);", + "%s text_011 = document.createTextNode(` `);".formatted(keyword), + "div_002.appendChild(text_011);", + "%s h1_001 = document.createElement('h1');".formatted(keyword), + "%s text_012 = document.createTextNode(`Sample`);".formatted(keyword), + "h1_001.appendChild(text_012);", + "div_002.appendChild(h1_001);", + "%s text_013 = document.createTextNode(` `);".formatted(keyword), + "div_002.appendChild(text_013);", "%s img_001 = document.createElement('img');".formatted(keyword), - "img_001.setAttribute(`src`, ``);", - "img_001.setAttribute(`alt`, ``);", + "img_001.setAttribute(`src`, `kanye.jpg`);", + "img_001.setAttribute(`alt`, `kanye`);", "div_002.appendChild(img_001);", - "%s text_020 = document.createTextNode(` `);".formatted(keyword), - "div_002.appendChild(text_020);", - "div_000.appendChild(div_002);", - "%s text_021 = document.createTextNode(` `);".formatted(keyword), - "div_000.appendChild(text_021);", + "%s text_014 = document.createTextNode(` `);".formatted(keyword), + "div_002.appendChild(text_014);", + "div_001.appendChild(div_002);", + "%s text_015 = document.createTextNode(` `);".formatted(keyword), + "div_001.appendChild(text_015);", "%s div_003 = document.createElement('div');".formatted(keyword), - "div_003.setAttribute(`id`, `footer`);", - "%s text_022 = document.createTextNode(` `);".formatted(keyword), - "div_003.appendChild(text_022);", - "%s text_023 = document.createTextNode(` `);".formatted(keyword), - "div_003.appendChild(text_023);", + "div_003.setAttribute(`id`, `main`);", + "%s text_016 = document.createTextNode(` `);".formatted(keyword), + "div_003.appendChild(text_016);", + "%s h2_001 = document.createElement('h2');".formatted(keyword), + "%s text_017 = document.createTextNode(`Main`);".formatted(keyword), + "h2_001.appendChild(text_017);", + "div_003.appendChild(h2_001);", + "%s text_018 = document.createTextNode(` `);".formatted(keyword), + "div_003.appendChild(text_018);", "%s p_001 = document.createElement('p');".formatted(keyword), - "%s text_024 = document.createTextNode(`Copyright © 2019`);".formatted(keyword), - "p_001.appendChild(text_024);", + "%s text_019 = document.createTextNode(`This is the main content.`);".formatted(keyword), + "p_001.appendChild(text_019);", "div_003.appendChild(p_001);", - "%s text_025 = document.createTextNode(` `);".formatted(keyword), - "div_003.appendChild(text_025);", - "div_000.appendChild(div_003);", - "%s text_026 = document.createTextNode(` `);".formatted(keyword), - "div_000.appendChild(text_026);", - "body_000.appendChild(div_000);", - "%s text_027 = document.createTextNode(` `);".formatted(keyword), - "body_000.appendChild(text_027);", - "html_000.appendChild(body_000);", - "targetElement_000.appendChild(html_000);"); + "%s text_020 = document.createTextNode(` `);".formatted(keyword), + "div_003.appendChild(text_020);", + "%s img_002 = document.createElement('img');".formatted(keyword), + "img_002.setAttribute(`src`, ``);", + "img_002.setAttribute(`alt`, ``);", + "div_003.appendChild(img_002);", + "%s text_021 = document.createTextNode(` `);".formatted(keyword), + "div_003.appendChild(text_021);", + "div_001.appendChild(div_003);", + "%s text_022 = document.createTextNode(` `);".formatted(keyword), + "div_001.appendChild(text_022);", + "%s div_004 = document.createElement('div');".formatted(keyword), + "div_004.setAttribute(`id`, `footer`);", + "%s text_023 = document.createTextNode(` `);".formatted(keyword), + "div_004.appendChild(text_023);", + "%s text_024 = document.createTextNode(` `);".formatted(keyword), + "div_004.appendChild(text_024);", + "%s p_002 = document.createElement('p');".formatted(keyword), + "%s text_025 = document.createTextNode(`Copyright © 2019`);".formatted(keyword), + "p_002.appendChild(text_025);", + "div_004.appendChild(p_002);", + "%s text_026 = document.createTextNode(` `);".formatted(keyword), + "div_004.appendChild(text_026);", + "div_001.appendChild(div_004);", + "%s text_027 = document.createTextNode(` `);".formatted(keyword), + "div_001.appendChild(text_027);", + "body_001.appendChild(div_001);", + "%s text_028 = document.createTextNode(` `);".formatted(keyword), + "body_001.appendChild(text_028);", + "html_001.appendChild(body_001);", + "targetElement_001.appendChild(html_001);"); } @@ -1625,210 +1624,210 @@ void produceValidCodeWhenGivenPathToAFileWithComment(VariableDeclaration variabl if(commentConversionModeActivated){ assertThat(converted).containsExactly( - "%s html_000 = document.createElement('html');".formatted(keyword), - "%s text_000 = document.createTextNode(` `);".formatted(keyword), - "html_000.appendChild(text_000);", - "%s head_000 = document.createElement('head');".formatted(keyword), - "%s text_001 = document.createTextNode(` `);".formatted(keyword), - "head_000.appendChild(text_001);", - "%s meta_000 = document.createElement('meta');".formatted(keyword), - "meta_000.setAttribute(`charset`, `utf-8`);", - "head_000.appendChild(meta_000);", + "%s html_001 = document.createElement('html');".formatted(keyword), + "%s text_001 = document.createTextNode(` `);".formatted(keyword), + "html_001.appendChild(text_001);", + "%s head_001 = document.createElement('head');".formatted(keyword), "%s text_002 = document.createTextNode(` `);".formatted(keyword), - "head_000.appendChild(text_002);", - "%s title_000 = document.createElement('title');".formatted(keyword), - "%s text_003 = document.createTextNode(`Sample`);".formatted(keyword), - "title_000.appendChild(text_003);", - "head_000.appendChild(title_000);", - "%s text_004 = document.createTextNode(` `);".formatted(keyword), - "head_000.appendChild(text_004);", - "%s link_000 = document.createElement('link');".formatted(keyword), - "link_000.setAttribute(`rel`, `stylesheet`);", - "link_000.setAttribute(`href`, ``);", - "head_000.appendChild(link_000);", - "%s text_005 = document.createTextNode(` `);".formatted(keyword), - "head_000.appendChild(text_005);", - "html_000.appendChild(head_000);", + "head_001.appendChild(text_002);", + "%s meta_001 = document.createElement('meta');".formatted(keyword), + "meta_001.setAttribute(`charset`, `utf-8`);", + "head_001.appendChild(meta_001);", + "%s text_003 = document.createTextNode(` `);".formatted(keyword), + "head_001.appendChild(text_003);", + "%s title_001 = document.createElement('title');".formatted(keyword), + "%s text_004 = document.createTextNode(`Sample`);".formatted(keyword), + "title_001.appendChild(text_004);", + "head_001.appendChild(title_001);", + "%s text_005 = document.createTextNode(` `);".formatted(keyword), + "head_001.appendChild(text_005);", + "%s link_001 = document.createElement('link');".formatted(keyword), + "link_001.setAttribute(`rel`, `stylesheet`);", + "link_001.setAttribute(`href`, ``);", + "head_001.appendChild(link_001);", "%s text_006 = document.createTextNode(` `);".formatted(keyword), - "html_000.appendChild(text_006);", - "%s body_000 = document.createElement('body');".formatted(keyword), - "%s text_007 = document.createTextNode(` `);".formatted(keyword), - "body_000.appendChild(text_007);", - "%s div_000 = document.createElement('div');".formatted(keyword), - "div_000.setAttribute(`id`, `container`);", - "%s text_008 = document.createTextNode(` `);".formatted(keyword), - "div_000.appendChild(text_008);", + "head_001.appendChild(text_006);", + "html_001.appendChild(head_001);", + "%s text_007 = document.createTextNode(` `);".formatted(keyword), + "html_001.appendChild(text_007);", + "%s body_001 = document.createElement('body');".formatted(keyword), + "%s text_008 = document.createTextNode(` `);".formatted(keyword), + "body_001.appendChild(text_008);", "%s div_001 = document.createElement('div');".formatted(keyword), - "div_001.setAttribute(`id`, `header`);", - "%s text_009 = document.createTextNode(` `);".formatted(keyword), + "div_001.setAttribute(`id`, `container`);", + "%s text_009 = document.createTextNode(` `);".formatted(keyword), "div_001.appendChild(text_009);", - "%s comment_000 = document.createComment(` Sample H1 `);".formatted(keyword), - "div_001.appendChild(comment_000);", - "%s text_010 = document.createTextNode(` `);".formatted(keyword), - "div_001.appendChild(text_010);", - "%s h1_000 = document.createElement('h1');".formatted(keyword), - "%s text_011 = document.createTextNode(`Sample`);".formatted(keyword), - "h1_000.appendChild(text_011);", - "div_001.appendChild(h1_000);", - "%s text_012 = document.createTextNode(` `);".formatted(keyword), - "div_001.appendChild(text_012);", - "%s img_000 = document.createElement('img');".formatted(keyword), - "img_000.setAttribute(`src`, `kanye.jpg`);", - "img_000.setAttribute(`alt`, `kanye`);", - "div_001.appendChild(img_000);", - "%s text_013 = document.createTextNode(` `);".formatted(keyword), - "div_001.appendChild(text_013);", - "div_000.appendChild(div_001);", - "%s text_014 = document.createTextNode(` `);".formatted(keyword), - "div_000.appendChild(text_014);", "%s div_002 = document.createElement('div');".formatted(keyword), - "div_002.setAttribute(`id`, `main`);", - "%s text_015 = document.createTextNode(` `);".formatted(keyword), - "div_002.appendChild(text_015);", - "%s h2_000 = document.createElement('h2');".formatted(keyword), - "%s text_016 = document.createTextNode(`Main`);".formatted(keyword), - "h2_000.appendChild(text_016);", - "div_002.appendChild(h2_000);", - "%s text_017 = document.createTextNode(` `);".formatted(keyword), - "div_002.appendChild(text_017);", - "%s p_000 = document.createElement('p');".formatted(keyword), - "%s text_018 = document.createTextNode(`This is the main content.`);".formatted(keyword), - "p_000.appendChild(text_018);", - "div_002.appendChild(p_000);", - "%s text_019 = document.createTextNode(` `);".formatted(keyword), - "div_002.appendChild(text_019);", + "div_002.setAttribute(`id`, `header`);", + "%s text_010 = document.createTextNode(` `);".formatted(keyword), + "div_002.appendChild(text_010);", + "%s comment_001 = document.createComment(` Sample H1 `);".formatted(keyword), + "div_002.appendChild(comment_001);", + "%s text_011 = document.createTextNode(` `);".formatted(keyword), + "div_002.appendChild(text_011);", + "%s h1_001 = document.createElement('h1');".formatted(keyword), + "%s text_012 = document.createTextNode(`Sample`);".formatted(keyword), + "h1_001.appendChild(text_012);", + "div_002.appendChild(h1_001);", + "%s text_013 = document.createTextNode(` `);".formatted(keyword), + "div_002.appendChild(text_013);", "%s img_001 = document.createElement('img');".formatted(keyword), - "img_001.setAttribute(`src`, ``);", - "img_001.setAttribute(`alt`, ``);", + "img_001.setAttribute(`src`, `kanye.jpg`);", + "img_001.setAttribute(`alt`, `kanye`);", "div_002.appendChild(img_001);", - "%s text_020 = document.createTextNode(` `);".formatted(keyword), - "div_002.appendChild(text_020);", - "div_000.appendChild(div_002);", - "%s text_021 = document.createTextNode(` `);".formatted(keyword), - "div_000.appendChild(text_021);", + "%s text_014 = document.createTextNode(` `);".formatted(keyword), + "div_002.appendChild(text_014);", + "div_001.appendChild(div_002);", + "%s text_015 = document.createTextNode(` `);".formatted(keyword), + "div_001.appendChild(text_015);", "%s div_003 = document.createElement('div');".formatted(keyword), - "div_003.setAttribute(`id`, `footer`);", - "%s text_022 = document.createTextNode(` `);".formatted(keyword), - "div_003.appendChild(text_022);", - "%s comment_001 = document.createComment(` Copyright `);".formatted(keyword), - "div_003.appendChild(comment_001);", - "%s text_023 = document.createTextNode(` `);".formatted(keyword), - "div_003.appendChild(text_023);", + "div_003.setAttribute(`id`, `main`);", + "%s text_016 = document.createTextNode(` `);".formatted(keyword), + "div_003.appendChild(text_016);", + "%s h2_001 = document.createElement('h2');".formatted(keyword), + "%s text_017 = document.createTextNode(`Main`);".formatted(keyword), + "h2_001.appendChild(text_017);", + "div_003.appendChild(h2_001);", + "%s text_018 = document.createTextNode(` `);".formatted(keyword), + "div_003.appendChild(text_018);", "%s p_001 = document.createElement('p');".formatted(keyword), - "%s text_024 = document.createTextNode(`Copyright © 2019`);".formatted(keyword), - "p_001.appendChild(text_024);", + "%s text_019 = document.createTextNode(`This is the main content.`);".formatted(keyword), + "p_001.appendChild(text_019);", "div_003.appendChild(p_001);", - "%s text_025 = document.createTextNode(` `);".formatted(keyword), - "div_003.appendChild(text_025);", - "div_000.appendChild(div_003);", - "%s text_026 = document.createTextNode(` `);".formatted(keyword), - "div_000.appendChild(text_026);", - "body_000.appendChild(div_000);", - "%s text_027 = document.createTextNode(` `);".formatted(keyword), - "body_000.appendChild(text_027);", - "html_000.appendChild(body_000);"); + "%s text_020 = document.createTextNode(` `);".formatted(keyword), + "div_003.appendChild(text_020);", + "%s img_002 = document.createElement('img');".formatted(keyword), + "img_002.setAttribute(`src`, ``);", + "img_002.setAttribute(`alt`, ``);", + "div_003.appendChild(img_002);", + "%s text_021 = document.createTextNode(` `);".formatted(keyword), + "div_003.appendChild(text_021);", + "div_001.appendChild(div_003);", + "%s text_022 = document.createTextNode(` `);".formatted(keyword), + "div_001.appendChild(text_022);", + "%s div_004 = document.createElement('div');".formatted(keyword), + "div_004.setAttribute(`id`, `footer`);", + "%s text_023 = document.createTextNode(` `);".formatted(keyword), + "div_004.appendChild(text_023);", + "%s comment_002 = document.createComment(` Copyright `);".formatted(keyword), + "div_004.appendChild(comment_002);", + "%s text_024 = document.createTextNode(` `);".formatted(keyword), + "div_004.appendChild(text_024);", + "%s p_002 = document.createElement('p');".formatted(keyword), + "%s text_025 = document.createTextNode(`Copyright © 2019`);".formatted(keyword), + "p_002.appendChild(text_025);", + "div_004.appendChild(p_002);", + "%s text_026 = document.createTextNode(` `);".formatted(keyword), + "div_004.appendChild(text_026);", + "div_001.appendChild(div_004);", + "%s text_027 = document.createTextNode(` `);".formatted(keyword), + "div_001.appendChild(text_027);", + "body_001.appendChild(div_001);", + "%s text_028 = document.createTextNode(` `);".formatted(keyword), + "body_001.appendChild(text_028);", + "html_001.appendChild(body_001);"); }else{ - assertThat(converted).containsExactly("%s html_000 = document.createElement('html');".formatted(keyword), - "%s text_000 = document.createTextNode(` `);".formatted(keyword), - "html_000.appendChild(text_000);", - "%s head_000 = document.createElement('head');".formatted(keyword), - "%s text_001 = document.createTextNode(` `);".formatted(keyword), - "head_000.appendChild(text_001);", - "%s meta_000 = document.createElement('meta');".formatted(keyword), - "meta_000.setAttribute(`charset`, `utf-8`);", - "head_000.appendChild(meta_000);", + assertThat(converted).containsExactly("%s html_001 = document.createElement('html');".formatted(keyword), + "%s text_001 = document.createTextNode(` `);".formatted(keyword), + "html_001.appendChild(text_001);", + "%s head_001 = document.createElement('head');".formatted(keyword), "%s text_002 = document.createTextNode(` `);".formatted(keyword), - "head_000.appendChild(text_002);", - "%s title_000 = document.createElement('title');".formatted(keyword), - "%s text_003 = document.createTextNode(`Sample`);".formatted(keyword), - "title_000.appendChild(text_003);", - "head_000.appendChild(title_000);", - "%s text_004 = document.createTextNode(` `);".formatted(keyword), - "head_000.appendChild(text_004);", - "%s link_000 = document.createElement('link');".formatted(keyword), - "link_000.setAttribute(`rel`, `stylesheet`);", - "link_000.setAttribute(`href`, ``);", - "head_000.appendChild(link_000);", - "%s text_005 = document.createTextNode(` `);".formatted(keyword), - "head_000.appendChild(text_005);", - "html_000.appendChild(head_000);", + "head_001.appendChild(text_002);", + "%s meta_001 = document.createElement('meta');".formatted(keyword), + "meta_001.setAttribute(`charset`, `utf-8`);", + "head_001.appendChild(meta_001);", + "%s text_003 = document.createTextNode(` `);".formatted(keyword), + "head_001.appendChild(text_003);", + "%s title_001 = document.createElement('title');".formatted(keyword), + "%s text_004 = document.createTextNode(`Sample`);".formatted(keyword), + "title_001.appendChild(text_004);", + "head_001.appendChild(title_001);", + "%s text_005 = document.createTextNode(` `);".formatted(keyword), + "head_001.appendChild(text_005);", + "%s link_001 = document.createElement('link');".formatted(keyword), + "link_001.setAttribute(`rel`, `stylesheet`);", + "link_001.setAttribute(`href`, ``);", + "head_001.appendChild(link_001);", "%s text_006 = document.createTextNode(` `);".formatted(keyword), - "html_000.appendChild(text_006);", - "%s body_000 = document.createElement('body');".formatted(keyword), - "%s text_007 = document.createTextNode(` `);".formatted(keyword), - "body_000.appendChild(text_007);", - "%s div_000 = document.createElement('div');".formatted(keyword), - "div_000.setAttribute(`id`, `container`);", - "%s text_008 = document.createTextNode(` `);".formatted(keyword), - "div_000.appendChild(text_008);", + "head_001.appendChild(text_006);", + "html_001.appendChild(head_001);", + "%s text_007 = document.createTextNode(` `);".formatted(keyword), + "html_001.appendChild(text_007);", + "%s body_001 = document.createElement('body');".formatted(keyword), + "%s text_008 = document.createTextNode(` `);".formatted(keyword), + "body_001.appendChild(text_008);", "%s div_001 = document.createElement('div');".formatted(keyword), - "div_001.setAttribute(`id`, `header`);", - "%s text_009 = document.createTextNode(` `);".formatted(keyword), + "div_001.setAttribute(`id`, `container`);", + "%s text_009 = document.createTextNode(` `);".formatted(keyword), "div_001.appendChild(text_009);", - "%s text_010 = document.createTextNode(` `);".formatted(keyword), - "div_001.appendChild(text_010);", - "%s h1_000 = document.createElement('h1');".formatted(keyword), - "%s text_011 = document.createTextNode(`Sample`);".formatted(keyword), - "h1_000.appendChild(text_011);", - "div_001.appendChild(h1_000);", - "%s text_012 = document.createTextNode(` `);".formatted(keyword), - "div_001.appendChild(text_012);", - "%s img_000 = document.createElement('img');".formatted(keyword), - "img_000.setAttribute(`src`, `kanye.jpg`);", - "img_000.setAttribute(`alt`, `kanye`);", - "div_001.appendChild(img_000);", - "%s text_013 = document.createTextNode(` `);".formatted(keyword), - "div_001.appendChild(text_013);", - "div_000.appendChild(div_001);", - "%s text_014 = document.createTextNode(` `);".formatted(keyword), - "div_000.appendChild(text_014);", "%s div_002 = document.createElement('div');".formatted(keyword), - "div_002.setAttribute(`id`, `main`);", - "%s text_015 = document.createTextNode(` `);".formatted(keyword), - "div_002.appendChild(text_015);", - "%s h2_000 = document.createElement('h2');".formatted(keyword), - "%s text_016 = document.createTextNode(`Main`);".formatted(keyword), - "h2_000.appendChild(text_016);", - "div_002.appendChild(h2_000);", - "%s text_017 = document.createTextNode(` `);".formatted(keyword), - "div_002.appendChild(text_017);", - "%s p_000 = document.createElement('p');".formatted(keyword), - "%s text_018 = document.createTextNode(`This is the main content.`);".formatted(keyword), - "p_000.appendChild(text_018);", - "div_002.appendChild(p_000);", - "%s text_019 = document.createTextNode(` `);".formatted(keyword), - "div_002.appendChild(text_019);", + "div_002.setAttribute(`id`, `header`);", + "%s text_010 = document.createTextNode(` `);".formatted(keyword), + "div_002.appendChild(text_010);", + "%s text_011 = document.createTextNode(` `);".formatted(keyword), + "div_002.appendChild(text_011);", + "%s h1_001 = document.createElement('h1');".formatted(keyword), + "%s text_012 = document.createTextNode(`Sample`);".formatted(keyword), + "h1_001.appendChild(text_012);", + "div_002.appendChild(h1_001);", + "%s text_013 = document.createTextNode(` `);".formatted(keyword), + "div_002.appendChild(text_013);", "%s img_001 = document.createElement('img');".formatted(keyword), - "img_001.setAttribute(`src`, ``);", - "img_001.setAttribute(`alt`, ``);", + "img_001.setAttribute(`src`, `kanye.jpg`);", + "img_001.setAttribute(`alt`, `kanye`);", "div_002.appendChild(img_001);", - "%s text_020 = document.createTextNode(` `);".formatted(keyword), - "div_002.appendChild(text_020);", - "div_000.appendChild(div_002);", - "%s text_021 = document.createTextNode(` `);".formatted(keyword), - "div_000.appendChild(text_021);", + "%s text_014 = document.createTextNode(` `);".formatted(keyword), + "div_002.appendChild(text_014);", + "div_001.appendChild(div_002);", + "%s text_015 = document.createTextNode(` `);".formatted(keyword), + "div_001.appendChild(text_015);", "%s div_003 = document.createElement('div');".formatted(keyword), - "div_003.setAttribute(`id`, `footer`);", - "%s text_022 = document.createTextNode(` `);".formatted(keyword), - "div_003.appendChild(text_022);", - "%s text_023 = document.createTextNode(` `);".formatted(keyword), - "div_003.appendChild(text_023);", + "div_003.setAttribute(`id`, `main`);", + "%s text_016 = document.createTextNode(` `);".formatted(keyword), + "div_003.appendChild(text_016);", + "%s h2_001 = document.createElement('h2');".formatted(keyword), + "%s text_017 = document.createTextNode(`Main`);".formatted(keyword), + "h2_001.appendChild(text_017);", + "div_003.appendChild(h2_001);", + "%s text_018 = document.createTextNode(` `);".formatted(keyword), + "div_003.appendChild(text_018);", "%s p_001 = document.createElement('p');".formatted(keyword), - "%s text_024 = document.createTextNode(`Copyright © 2019`);".formatted(keyword), - "p_001.appendChild(text_024);", + "%s text_019 = document.createTextNode(`This is the main content.`);".formatted(keyword), + "p_001.appendChild(text_019);", "div_003.appendChild(p_001);", - "%s text_025 = document.createTextNode(` `);".formatted(keyword), - "div_003.appendChild(text_025);", - "div_000.appendChild(div_003);", - "%s text_026 = document.createTextNode(` `);".formatted(keyword), - "div_000.appendChild(text_026);", - "body_000.appendChild(div_000);", - "%s text_027 = document.createTextNode(` `);".formatted(keyword), - "body_000.appendChild(text_027);", - "html_000.appendChild(body_000);"); + "%s text_020 = document.createTextNode(` `);".formatted(keyword), + "div_003.appendChild(text_020);", + "%s img_002 = document.createElement('img');".formatted(keyword), + "img_002.setAttribute(`src`, ``);", + "img_002.setAttribute(`alt`, ``);", + "div_003.appendChild(img_002);", + "%s text_021 = document.createTextNode(` `);".formatted(keyword), + "div_003.appendChild(text_021);", + "div_001.appendChild(div_003);", + "%s text_022 = document.createTextNode(` `);".formatted(keyword), + "div_001.appendChild(text_022);", + "%s div_004 = document.createElement('div');".formatted(keyword), + "div_004.setAttribute(`id`, `footer`);", + "%s text_023 = document.createTextNode(` `);".formatted(keyword), + "div_004.appendChild(text_023);", + "%s text_024 = document.createTextNode(` `);".formatted(keyword), + "div_004.appendChild(text_024);", + "%s p_002 = document.createElement('p');".formatted(keyword), + "%s text_025 = document.createTextNode(`Copyright © 2019`);".formatted(keyword), + "p_002.appendChild(text_025);", + "div_004.appendChild(p_002);", + "%s text_026 = document.createTextNode(` `);".formatted(keyword), + "div_004.appendChild(text_026);", + "div_001.appendChild(div_004);", + "%s text_027 = document.createTextNode(` `);".formatted(keyword), + "div_001.appendChild(text_027);", + "body_001.appendChild(div_001);", + "%s text_028 = document.createTextNode(` `);".formatted(keyword), + "body_001.appendChild(text_028);", + "html_001.appendChild(body_001);"); }