Skip to content

Commit 8e7be79

Browse files
committed
fix: fix tests on jsgenerator-api
1 parent 8bc818c commit 8e7be79

File tree

7 files changed

+573
-573
lines changed

7 files changed

+573
-573
lines changed

jsgenerator-test/jsgenerator-test-api/src/test/java/com/osscameroon/jsgenerator/test/api/JsGeneratorApiTest.java

+39-39
Original file line numberDiff line numberDiff line change
@@ -180,12 +180,12 @@ void convertInlineContent(final VariableDeclaration variableDeclaration, final b
180180
jsonPath("$.content.length()").value(1),
181181
jsonPath("$.content.[0].filename").value("%s.0.%s".formatted(prefix, extension)),
182182
jsonPath("$.content.[0].content").value(new Match(new String[]{
183-
"%s targetElement_000 = document.querySelector(`:root > body`);".formatted(keyword),
184-
"%s div_000 = document.createElement('div');".formatted(keyword),
185-
"div_000.setAttribute(`contenteditable`, `true`);",
186-
"%s text_000 = document.createTextNode(`%s`);".formatted(keyword, content),
187-
"div_000.appendChild(text_000);",
188-
"targetElement_000.appendChild(div_000);"
183+
"%s targetElement_001 = document.querySelector(`:root > body`);".formatted(keyword),
184+
"%s div_001 = document.createElement('div');".formatted(keyword),
185+
"div_001.setAttribute(`contenteditable`, `true`);",
186+
"%s text_001 = document.createTextNode(`%s`);".formatted(keyword, content),
187+
"div_001.appendChild(text_001);",
188+
"targetElement_001.appendChild(div_001);"
189189
})));
190190

191191

@@ -210,10 +210,10 @@ void convertInlineContent(final VariableDeclaration variableDeclaration, final b
210210
jsonPath("$.content.[0].filename").value("%s.0.%s".formatted(prefix, extension)),
211211
jsonPath("$.content.[0].content").value(new Match(new String[]{
212212

213-
"%s div_000 = document.createElement('div');".formatted(keyword),
214-
"div_000.setAttribute(`contenteditable`, `true`);",
215-
"%s text_000 = document.createTextNode(`%s`);".formatted(keyword, content),
216-
"div_000.appendChild(text_000);"
213+
"%s div_001 = document.createElement('div');".formatted(keyword),
214+
"div_001.setAttribute(`contenteditable`, `true`);",
215+
"%s text_001 = document.createTextNode(`%s`);".formatted(keyword, content),
216+
"div_001.appendChild(text_001);"
217217

218218
})));
219219

@@ -253,16 +253,16 @@ void convertInlineContentWithComment(final VariableDeclaration variableDeclarati
253253
jsonPath("$.content.length()").value(1),
254254
jsonPath("$.content.[0].filename").value("%s.0.%s".formatted(prefix, extension)),
255255
jsonPath("$.content.[0].content").value(new Match(new String[]{
256-
"%s targetElement_000 = document.querySelector(`:root > body`);".formatted(keyword),
257-
"%s comment_000 = document.createComment(` ContentEditable `);".formatted(keyword),
258-
"targetElement_000.appendChild(comment_000);",
259-
"%s text_000 = document.createTextNode(` `);".formatted(keyword),
260-
"targetElement_000.appendChild(text_000);",
261-
"%s div_000 = document.createElement('div');".formatted(keyword),
262-
"div_000.setAttribute(`contenteditable`, `true`);",
263-
"%s text_001 = document.createTextNode(`%s`);".formatted(keyword, content),
264-
"div_000.appendChild(text_001);",
265-
"targetElement_000.appendChild(div_000);"
256+
"%s targetElement_001 = document.querySelector(`:root > body`);".formatted(keyword),
257+
"%s comment_001 = document.createComment(` ContentEditable `);".formatted(keyword),
258+
"targetElement_001.appendChild(comment_001);",
259+
"%s text_001 = document.createTextNode(` `);".formatted(keyword),
260+
"targetElement_001.appendChild(text_001);",
261+
"%s div_001 = document.createElement('div');".formatted(keyword),
262+
"div_001.setAttribute(`contenteditable`, `true`);",
263+
"%s text_002 = document.createTextNode(`%s`);".formatted(keyword, content),
264+
"div_001.appendChild(text_002);",
265+
"targetElement_001.appendChild(div_001);"
266266
})));
267267

268268

@@ -287,14 +287,14 @@ void convertInlineContentWithComment(final VariableDeclaration variableDeclarati
287287
jsonPath("$.content.length()").value(1),
288288
jsonPath("$.content.[0].filename").value("%s.0.%s".formatted(prefix, extension)),
289289
jsonPath("$.content.[0].content").value(new Match(new String[]{
290-
"%s targetElement_000 = document.querySelector(`:root > body`);".formatted(keyword),
291-
"%s text_000 = document.createTextNode(` `);".formatted(keyword),
292-
"targetElement_000.appendChild(text_000);",
293-
"%s div_000 = document.createElement('div');".formatted(keyword),
294-
"div_000.setAttribute(`contenteditable`, `true`);",
295-
"%s text_001 = document.createTextNode(`%s`);".formatted(keyword, content),
296-
"div_000.appendChild(text_001);",
297-
"targetElement_000.appendChild(div_000);"
290+
"%s targetElement_001 = document.querySelector(`:root > body`);".formatted(keyword),
291+
"%s text_001 = document.createTextNode(` `);".formatted(keyword),
292+
"targetElement_001.appendChild(text_001);",
293+
"%s div_001 = document.createElement('div');".formatted(keyword),
294+
"div_001.setAttribute(`contenteditable`, `true`);",
295+
"%s text_002 = document.createTextNode(`%s`);".formatted(keyword, content),
296+
"div_001.appendChild(text_002);",
297+
"targetElement_001.appendChild(div_001);"
298298
})));
299299

300300
}
@@ -321,12 +321,12 @@ void convertInlineContentWithComment(final VariableDeclaration variableDeclarati
321321
jsonPath("$.content.length()").value(1),
322322
jsonPath("$.content.[0].filename").value("%s.0.%s".formatted(prefix, extension)),
323323
jsonPath("$.content.[0].content").value(new Match(new String[]{
324-
"%s comment_000 = document.createComment(` ContentEditable `);".formatted(keyword),
325-
"%s text_000 = document.createTextNode(` `);".formatted(keyword),
326-
"%s div_000 = document.createElement('div');".formatted(keyword),
327-
"div_000.setAttribute(`contenteditable`, `true`);",
328-
"%s text_001 = document.createTextNode(`%s`);".formatted(keyword, content),
329-
"div_000.appendChild(text_001);"
324+
"%s comment_001 = document.createComment(` ContentEditable `);".formatted(keyword),
325+
"%s text_001 = document.createTextNode(` `);".formatted(keyword),
326+
"%s div_001 = document.createElement('div');".formatted(keyword),
327+
"div_001.setAttribute(`contenteditable`, `true`);",
328+
"%s text_002 = document.createTextNode(`%s`);".formatted(keyword, content),
329+
"div_001.appendChild(text_002);"
330330
})));
331331

332332

@@ -350,11 +350,11 @@ void convertInlineContentWithComment(final VariableDeclaration variableDeclarati
350350
jsonPath("$.content.length()").value(1),
351351
jsonPath("$.content.[0].filename").value("%s.0.%s".formatted(prefix, extension)),
352352
jsonPath("$.content.[0].content").value(new Match(new String[]{
353-
"%s text_000 = document.createTextNode(` `);".formatted(keyword),
354-
"%s div_000 = document.createElement('div');".formatted(keyword),
355-
"div_000.setAttribute(`contenteditable`, `true`);",
356-
"%s text_001 = document.createTextNode(`%s`);".formatted(keyword, content),
357-
"div_000.appendChild(text_001);"
353+
"%s text_001 = document.createTextNode(` `);".formatted(keyword),
354+
"%s div_001 = document.createElement('div');".formatted(keyword),
355+
"div_001.setAttribute(`contenteditable`, `true`);",
356+
"%s text_002 = document.createTextNode(`%s`);".formatted(keyword, content),
357+
"div_001.appendChild(text_002);"
358358
})));
359359

360360
}
Original file line numberDiff line numberDiff line change
@@ -1,104 +1,104 @@
1-
{{keyword}} targetElement_000 = document.querySelector(`:root > body`);
2-
{{keyword}} html_000 = document.createElement('html');
3-
{{keyword}} text_000 = document.createTextNode(` `);
4-
html_000.appendChild(text_000);
5-
{{keyword}} head_000 = document.createElement('head');
6-
{{keyword}} text_001 = document.createTextNode(` `);
7-
head_000.appendChild(text_001);
8-
{{keyword}} meta_000 = document.createElement('meta');
9-
meta_000.setAttribute(`charset`, `utf-8`);
10-
head_000.appendChild(meta_000);
1+
{{keyword}} targetElement_001 = document.querySelector(`:root > body`);
2+
{{keyword}} html_001 = document.createElement('html');
3+
{{keyword}} text_001 = document.createTextNode(` `);
4+
html_001.appendChild(text_001);
5+
{{keyword}} head_001 = document.createElement('head');
116
{{keyword}} text_002 = document.createTextNode(` `);
12-
head_000.appendChild(text_002);
13-
{{keyword}} title_000 = document.createElement('title');
14-
{{keyword}} text_003 = document.createTextNode(`Sample`);
15-
title_000.appendChild(text_003);
16-
head_000.appendChild(title_000);
17-
{{keyword}} text_004 = document.createTextNode(` `);
18-
head_000.appendChild(text_004);
19-
{{keyword}} link_000 = document.createElement('link');
20-
link_000.setAttribute(`rel`, `stylesheet`);
21-
link_000.setAttribute(`href`, ``);
22-
head_000.appendChild(link_000);
23-
{{keyword}} text_005 = document.createTextNode(` `);
24-
head_000.appendChild(text_005);
25-
html_000.appendChild(head_000);
7+
head_001.appendChild(text_002);
8+
{{keyword}} meta_001 = document.createElement('meta');
9+
meta_001.setAttribute(`charset`, `utf-8`);
10+
head_001.appendChild(meta_001);
11+
{{keyword}} text_003 = document.createTextNode(` `);
12+
head_001.appendChild(text_003);
13+
{{keyword}} title_001 = document.createElement('title');
14+
{{keyword}} text_004 = document.createTextNode(`Sample`);
15+
title_001.appendChild(text_004);
16+
head_001.appendChild(title_001);
17+
{{keyword}} text_005 = document.createTextNode(` `);
18+
head_001.appendChild(text_005);
19+
{{keyword}} link_001 = document.createElement('link');
20+
link_001.setAttribute(`rel`, `stylesheet`);
21+
link_001.setAttribute(`href`, ``);
22+
head_001.appendChild(link_001);
2623
{{keyword}} text_006 = document.createTextNode(` `);
27-
html_000.appendChild(text_006);
28-
{{keyword}} body_000 = document.createElement('body');
29-
{{keyword}} text_007 = document.createTextNode(` `);
30-
body_000.appendChild(text_007);
31-
{{keyword}} div_000 = document.createElement('div');
32-
div_000.setAttribute(`id`, `container`);
33-
{{keyword}} text_008 = document.createTextNode(` `);
34-
div_000.appendChild(text_008);
24+
head_001.appendChild(text_006);
25+
html_001.appendChild(head_001);
26+
{{keyword}} text_007 = document.createTextNode(` `);
27+
html_001.appendChild(text_007);
28+
{{keyword}} body_001 = document.createElement('body');
29+
{{keyword}} text_008 = document.createTextNode(` `);
30+
body_001.appendChild(text_008);
3531
{{keyword}} div_001 = document.createElement('div');
36-
div_001.setAttribute(`id`, `header`);
37-
{{keyword}} text_009 = document.createTextNode(` `);
32+
div_001.setAttribute(`id`, `container`);
33+
{{keyword}} text_009 = document.createTextNode(` `);
3834
div_001.appendChild(text_009);
39-
{{keyword}} comment_000 = document.createComment(` Sample H1 `);
40-
div_001.appendChild(comment_000);
41-
{{keyword}} text_010 = document.createTextNode(` `);
42-
div_001.appendChild(text_010);
43-
{{keyword}} h1_000 = document.createElement('h1');
44-
{{keyword}} text_011 = document.createTextNode(`Sample`);
45-
h1_000.appendChild(text_011);
46-
div_001.appendChild(h1_000);
47-
{{keyword}} text_012 = document.createTextNode(` `);
48-
div_001.appendChild(text_012);
49-
{{keyword}} img_000 = document.createElement('img');
50-
img_000.setAttribute(`src`, `kanye.jpg`);
51-
img_000.setAttribute(`alt`, `kanye`);
52-
div_001.appendChild(img_000);
53-
{{keyword}} text_013 = document.createTextNode(` `);
54-
div_001.appendChild(text_013);
55-
div_000.appendChild(div_001);
56-
{{keyword}} text_014 = document.createTextNode(` `);
57-
div_000.appendChild(text_014);
5835
{{keyword}} div_002 = document.createElement('div');
59-
div_002.setAttribute(`id`, `main`);
60-
{{keyword}} text_015 = document.createTextNode(` `);
61-
div_002.appendChild(text_015);
62-
{{keyword}} h2_000 = document.createElement('h2');
63-
{{keyword}} text_016 = document.createTextNode(`Main`);
64-
h2_000.appendChild(text_016);
65-
div_002.appendChild(h2_000);
66-
{{keyword}} text_017 = document.createTextNode(` `);
67-
div_002.appendChild(text_017);
68-
{{keyword}} p_000 = document.createElement('p');
69-
{{keyword}} text_018 = document.createTextNode(`This is the main content.`);
70-
p_000.appendChild(text_018);
71-
div_002.appendChild(p_000);
72-
{{keyword}} text_019 = document.createTextNode(` `);
73-
div_002.appendChild(text_019);
36+
div_002.setAttribute(`id`, `header`);
37+
{{keyword}} text_010 = document.createTextNode(` `);
38+
div_002.appendChild(text_010);
39+
{{keyword}} comment_001 = document.createComment(` Sample H1 `);
40+
div_002.appendChild(comment_001);
41+
{{keyword}} text_011 = document.createTextNode(` `);
42+
div_002.appendChild(text_011);
43+
{{keyword}} h1_001 = document.createElement('h1');
44+
{{keyword}} text_012 = document.createTextNode(`Sample`);
45+
h1_001.appendChild(text_012);
46+
div_002.appendChild(h1_001);
47+
{{keyword}} text_013 = document.createTextNode(` `);
48+
div_002.appendChild(text_013);
7449
{{keyword}} img_001 = document.createElement('img');
75-
img_001.setAttribute(`src`, ``);
76-
img_001.setAttribute(`alt`, ``);
50+
img_001.setAttribute(`src`, `kanye.jpg`);
51+
img_001.setAttribute(`alt`, `kanye`);
7752
div_002.appendChild(img_001);
78-
{{keyword}} text_020 = document.createTextNode(` `);
79-
div_002.appendChild(text_020);
80-
div_000.appendChild(div_002);
81-
{{keyword}} text_021 = document.createTextNode(` `);
82-
div_000.appendChild(text_021);
53+
{{keyword}} text_014 = document.createTextNode(` `);
54+
div_002.appendChild(text_014);
55+
div_001.appendChild(div_002);
56+
{{keyword}} text_015 = document.createTextNode(` `);
57+
div_001.appendChild(text_015);
8358
{{keyword}} div_003 = document.createElement('div');
84-
div_003.setAttribute(`id`, `footer`);
85-
{{keyword}} text_022 = document.createTextNode(` `);
86-
div_003.appendChild(text_022);
87-
{{keyword}} comment_001 = document.createComment(` Copyright `);
88-
div_003.appendChild(comment_001);
89-
{{keyword}} text_023 = document.createTextNode(` `);
90-
div_003.appendChild(text_023);
59+
div_003.setAttribute(`id`, `main`);
60+
{{keyword}} text_016 = document.createTextNode(` `);
61+
div_003.appendChild(text_016);
62+
{{keyword}} h2_001 = document.createElement('h2');
63+
{{keyword}} text_017 = document.createTextNode(`Main`);
64+
h2_001.appendChild(text_017);
65+
div_003.appendChild(h2_001);
66+
{{keyword}} text_018 = document.createTextNode(` `);
67+
div_003.appendChild(text_018);
9168
{{keyword}} p_001 = document.createElement('p');
92-
{{keyword}} text_024 = document.createTextNode(`Copyright © 2019`);
93-
p_001.appendChild(text_024);
69+
{{keyword}} text_019 = document.createTextNode(`This is the main content.`);
70+
p_001.appendChild(text_019);
9471
div_003.appendChild(p_001);
95-
{{keyword}} text_025 = document.createTextNode(` `);
96-
div_003.appendChild(text_025);
97-
div_000.appendChild(div_003);
98-
{{keyword}} text_026 = document.createTextNode(` `);
99-
div_000.appendChild(text_026);
100-
body_000.appendChild(div_000);
101-
{{keyword}} text_027 = document.createTextNode(` `);
102-
body_000.appendChild(text_027);
103-
html_000.appendChild(body_000);
104-
targetElement_000.appendChild(html_000);
72+
{{keyword}} text_020 = document.createTextNode(` `);
73+
div_003.appendChild(text_020);
74+
{{keyword}} img_002 = document.createElement('img');
75+
img_002.setAttribute(`src`, ``);
76+
img_002.setAttribute(`alt`, ``);
77+
div_003.appendChild(img_002);
78+
{{keyword}} text_021 = document.createTextNode(` `);
79+
div_003.appendChild(text_021);
80+
div_001.appendChild(div_003);
81+
{{keyword}} text_022 = document.createTextNode(` `);
82+
div_001.appendChild(text_022);
83+
{{keyword}} div_004 = document.createElement('div');
84+
div_004.setAttribute(`id`, `footer`);
85+
{{keyword}} text_023 = document.createTextNode(` `);
86+
div_004.appendChild(text_023);
87+
{{keyword}} comment_002 = document.createComment(` Copyright `);
88+
div_004.appendChild(comment_002);
89+
{{keyword}} text_024 = document.createTextNode(` `);
90+
div_004.appendChild(text_024);
91+
{{keyword}} p_002 = document.createElement('p');
92+
{{keyword}} text_025 = document.createTextNode(`Copyright © 2019`);
93+
p_002.appendChild(text_025);
94+
div_004.appendChild(p_002);
95+
{{keyword}} text_026 = document.createTextNode(` `);
96+
div_004.appendChild(text_026);
97+
div_001.appendChild(div_004);
98+
{{keyword}} text_027 = document.createTextNode(` `);
99+
div_001.appendChild(text_027);
100+
body_001.appendChild(div_001);
101+
{{keyword}} text_028 = document.createTextNode(` `);
102+
body_001.appendChild(text_028);
103+
html_001.appendChild(body_001);
104+
targetElement_001.appendChild(html_001);

0 commit comments

Comments
 (0)