Skip to content

Commit 161e9fa

Browse files
committed
Added test example for migrating to nested component structure
1 parent a4d81f4 commit 161e9fa

File tree

2 files changed

+158
-0
lines changed

2 files changed

+158
-0
lines changed
Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
module.exports = {
2+
app: {
3+
'app.js': '// app',
4+
5+
components: {
6+
// A standalone component
7+
'top-level-component.js': '// top-level-component.js',
8+
9+
// A nested component
10+
'parent-component.js': '// parent-component.js',
11+
'parent-component': {
12+
'child-component.js': '// parent-component/child-component.js',
13+
'child-component': {
14+
'grandchild-component.js': '// parent-component/child-component/grandchild-component.js'
15+
}
16+
},
17+
18+
// Another nested component
19+
nested1: {
20+
'nested-component.js': '// nested1/nested-component.js',
21+
nested2: {
22+
'super-nested-component.js': '// nested1/nested2/super-nested-component.js'
23+
}
24+
},
25+
26+
// A component with layoutName
27+
'layout-name': {
28+
'has-layout-name.js': [
29+
'// top-level-component.js',
30+
'Component.extend({ layoutName: "components/layout-name/layout-name-template" });'
31+
].join('\n')
32+
}
33+
},
34+
35+
templates: {
36+
'application.hbs': '{{outlet}}',
37+
38+
components: {
39+
// A standalone component
40+
'top-level-component.hbs': '{{!-- top-level-component.hbs --}}',
41+
42+
// A template-only component
43+
'template-only-component.hbs': '{{!-- template-only-component.hbs --}}',
44+
45+
// A nested component
46+
'parent-component.hbs': '{{!-- parent-component.hbs --}}',
47+
'parent-component': {
48+
'child-component.hbs': '{{!-- parent-component/child-component.hbs --}}',
49+
'child-component': {
50+
'grandchild-component.hbs': '{{!-- parent-component/child-component/grandchild-component.hbs --}}'
51+
}
52+
},
53+
54+
// Another nested component
55+
nested1: {
56+
'nested-component.hbs': '{{!-- nested1/nested-component.hbs --}}',
57+
nested2: {
58+
'super-nested-component.hbs': '{{!-- nested1/nested2/super-nested-component.hbs --}}'
59+
}
60+
},
61+
62+
// A component with layoutName
63+
'layout-name': {
64+
'layout-name-template.hbs': '{{!-- layout-name-template.hbs --}}'
65+
},
66+
67+
// A partial template
68+
'partials': {
69+
'partials-template.hbs': '{{!-- partials-template.hbs --}}',
70+
'with-partial.hbs': [
71+
'{{!-- with-partial.hbs --}}',
72+
'{{partial "components/partials/partials-template"}}'
73+
].join('\n')
74+
}
75+
}
76+
}
77+
}
78+
};
Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
module.exports = {
2+
app: {
3+
'app.js': '// app',
4+
5+
components: {
6+
// A standalone component
7+
'top-level-component': {
8+
'index.hbs': '{{!-- top-level-component.hbs --}}',
9+
'index.js': '// top-level-component.js',
10+
},
11+
12+
// A template-only component
13+
'template-only-component': {
14+
'index.hbs': '{{!-- template-only-component.hbs --}}'
15+
},
16+
17+
// A nested component
18+
'parent-component': {
19+
'index.hbs': '{{!-- parent-component.hbs --}}',
20+
'index.js': '// parent-component.js',
21+
'child-component': {
22+
'index.hbs': '{{!-- parent-component/child-component.hbs --}}',
23+
'index.js': '// parent-component/child-component.js',
24+
'grandchild-component': {
25+
'index.hbs': '{{!-- parent-component/child-component/grandchild-component.hbs --}}',
26+
'index.js': '// parent-component/child-component/grandchild-component.js'
27+
}
28+
}
29+
},
30+
31+
// Another nested component
32+
nested1: {
33+
'nested-component': {
34+
'index.hbs': '{{!-- nested1/nested-component.hbs --}}',
35+
'index.js': '// nested1/nested-component.js',
36+
},
37+
nested2: {
38+
'super-nested-component': {
39+
'index.hbs': '{{!-- nested1/nested2/super-nested-component.hbs --}}',
40+
'index.js': '// nested1/nested2/super-nested-component.js'
41+
}
42+
}
43+
},
44+
45+
// A component with layoutName
46+
'layout-name': {
47+
'has-layout-name.js': [
48+
'// top-level-component.js',
49+
'Component.extend({ layoutName: "components/layout-name/layout-name-template" });'
50+
].join('\n')
51+
},
52+
53+
// A component with partial
54+
'partials': {
55+
'with-partial': {
56+
'index.hbs': [
57+
'{{!-- with-partial.hbs --}}',
58+
'{{partial "components/partials/partials-template"}}'
59+
].join('\n')
60+
}
61+
}
62+
},
63+
64+
templates: {
65+
'application.hbs': '{{outlet}}',
66+
67+
components: {
68+
// A component with layoutName
69+
'layout-name': {
70+
'layout-name-template.hbs': '{{!-- layout-name-template.hbs --}}'
71+
},
72+
73+
// A partial template
74+
'partials': {
75+
'partials-template.hbs': '{{!-- partials-template.hbs --}}',
76+
}
77+
}
78+
}
79+
},
80+
};

0 commit comments

Comments
 (0)