Skip to content

Commit c6ad4f7

Browse files
committed
minor #3048 [React][Svelte][Vue] Add E2E tests (Kocal)
This PR was merged into the 2.x branch. Discussion ---------- [React][Svelte][Vue] Add E2E tests | Q | A | ------------- | --- | Bug fix? | no | New feature? | no <!-- please update src/**/CHANGELOG.md files --> | Docs? | no <!-- required for new features --> | Issues | Fix #3029, fix #3024, fix #3025 <!-- prefix each issue number with "Fix #", no need to create an issue if none exist, explain below instead --> | License | MIT <!-- Replace this notice by a description of your feature/bugfix. This will help reviewers and should be a good start for the documentation. Additionally (see https://symfony.com/releases): - Always add tests and ensure they pass. - For new features, provide some code snippets to help understand usage. - Features and deprecations must be submitted against branch main. - Update/add documentation as required (we can help!) - Changelog entry should follow https://symfony.com/doc/current/contributing/code/conventions.html#writing-a-changelog-entry - Never break backward compatibility (see https://symfony.com/bc). --> The strict minimum to see that we can render a React/Vue/Svelte component, compiled by Babel, and loaded through AssetMapper/importmap Commits ------- 444254f [React][Vue][Svelte] Add E2E tests
2 parents 813b328 + 444254f commit c6ad4f7

File tree

29 files changed

+2212
-41
lines changed

29 files changed

+2212
-41
lines changed

apps/e2e/assets/react/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
node_modules
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
import React from 'react';
2+
export default function (props) {
3+
return /*#__PURE__*/React.createElement("div", null, "Hello ", props.name, " from React");
4+
}

apps/e2e/assets/react/package-lock.json

Lines changed: 1082 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

apps/e2e/assets/react/package.json

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
{
2+
"private": true,
3+
"license": "MIT",
4+
"devDependencies": {
5+
"@babel/cli": "^7.25.6",
6+
"@babel/core": "^7.25.2",
7+
"@babel/preset-react": "^7.24.7"
8+
},
9+
"scripts": {
10+
"build": "babel ./src/ --out-dir ./build/ --presets=@babel/preset-react --no-babelrc"
11+
}
12+
}
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import React from 'react';
22

33
export default function (props) {
4-
return <div>Hello {props.fullName}</div>;
4+
return <div>Hello {props.name} from React</div>;
55
}

apps/e2e/assets/svelte/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
node_modules

apps/e2e/assets/svelte/build.mjs

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
import * as fs from 'node:fs';
2+
import * as path from 'node:path';
3+
import {globSync} from 'tinyglobby'
4+
import {compile} from 'svelte/compiler';
5+
6+
globSync('src/**/*.svelte')
7+
.forEach((file) => {
8+
const builtFile = file.replace('src/', 'build/').replace('.svelte', '.js')
9+
console.log(`Building ${file} to ${builtFile}...`)
10+
11+
const result = compile(fs.readFileSync(file, 'utf8'), {
12+
format: 'esm',
13+
});
14+
15+
fs.mkdirSync(path.dirname(builtFile), { recursive: true })
16+
fs.writeFileSync(builtFile, result.js.code);
17+
});
Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
/* generated by Svelte v3.59.2 */
2+
import {
3+
SvelteComponent,
4+
append,
5+
detach,
6+
element,
7+
init,
8+
insert,
9+
noop,
10+
safe_not_equal,
11+
set_data,
12+
text
13+
} from "svelte/internal";
14+
15+
function create_fragment(ctx) {
16+
let div;
17+
let t0;
18+
let t1;
19+
let t2;
20+
21+
return {
22+
c() {
23+
div = element("div");
24+
t0 = text("Hello ");
25+
t1 = text(/*name*/ ctx[0]);
26+
t2 = text(" from Svelte");
27+
},
28+
m(target, anchor) {
29+
insert(target, div, anchor);
30+
append(div, t0);
31+
append(div, t1);
32+
append(div, t2);
33+
},
34+
p(ctx, [dirty]) {
35+
if (dirty & /*name*/ 1) set_data(t1, /*name*/ ctx[0]);
36+
},
37+
i: noop,
38+
o: noop,
39+
d(detaching) {
40+
if (detaching) detach(div);
41+
}
42+
};
43+
}
44+
45+
function instance($$self, $$props, $$invalidate) {
46+
let { name = "Svelte" } = $$props;
47+
48+
$$self.$$set = $$props => {
49+
if ('name' in $$props) $$invalidate(0, name = $$props.name);
50+
};
51+
52+
return [name];
53+
}
54+
55+
class Component extends SvelteComponent {
56+
constructor(options) {
57+
super();
58+
init(this, options, instance, create_fragment, safe_not_equal, { name: 0 });
59+
}
60+
}
61+
62+
export default Component;

0 commit comments

Comments
 (0)