Skip to content

Commit 5658543

Browse files
authored
fixes #195 use angle bracket component names (#1016)
* use angle bracket names * fix tests * fix node tests * reverse comparison members
1 parent e24f311 commit 5658543

File tree

4 files changed

+27
-23
lines changed

4 files changed

+27
-23
lines changed

lib/broccoli/docs-compiler/navigation-index-generator.js

+5-1
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,11 @@ module.exports = class NavigationIndexGenerator {
115115
let path = segments.join('/');
116116
let name;
117117

118-
if (['components', 'helpers'].includes(type)) {
118+
if (type === 'components') {
119+
let parts = segments.map((s) => _.upperFirst(_.camelCase(s)));
120+
let angleBracketName = parts.join('::');
121+
name = `<${angleBracketName}/>`;
122+
} else if (type === 'helpers') {
119123
name = `{{${path}}}`;
120124
} else {
121125
let fileName = segments.pop();

tests-node/unit/navigation-index-generator/test.js

+19-19
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ describe('Unit | NavigationIndexGenerator', function (hooks) {
1717
{
1818
id: 'ember-cli-addon-docs/components/docs-demo/component',
1919
path: 'components/docs-demo',
20-
name: '{{docs-demo}}',
20+
name: '<DocsDemo/>',
2121
},
2222
],
2323
},
@@ -35,12 +35,12 @@ describe('Unit | NavigationIndexGenerator', function (hooks) {
3535
{
3636
id: 'ember-cli-addon-docs/components/docs-demo/component',
3737
path: 'components/docs-demo',
38-
name: '{{docs-demo}}',
38+
name: '<DocsDemo/>',
3939
},
4040
{
4141
id: 'ember-cli-addon-docs/components/docs-header/component',
4242
path: 'components/docs-header',
43-
name: '{{docs-header}}',
43+
name: '<DocsHeader/>',
4444
},
4545
],
4646
},
@@ -94,47 +94,47 @@ describe('Unit | NavigationIndexGenerator', function (hooks) {
9494
{
9595
id: 'ember-cli-addon-docs/components/docs-demo/component',
9696
path: 'components/docs-demo',
97-
name: '{{docs-demo}}',
97+
name: '<DocsDemo/>',
9898
},
9999
{
100100
id: 'ember-cli-addon-docs/components/docs-header/component',
101101
path: 'components/docs-header',
102-
name: '{{docs-header}}',
102+
name: '<DocsHeader/>',
103103
},
104104
{
105105
id: 'ember-cli-addon-docs/components/docs-hero/component',
106106
path: 'components/docs-hero',
107-
name: '{{docs-hero}}',
107+
name: '<DocsHero/>',
108108
},
109109
{
110110
id: 'ember-cli-addon-docs/components/docs-keyboard-shortcuts/component',
111111
path: 'components/docs-keyboard-shortcuts',
112-
name: '{{docs-keyboard-shortcuts}}',
112+
name: '<DocsKeyboardShortcuts/>',
113113
},
114114
{
115115
id: 'ember-cli-addon-docs/components/docs-link/component',
116116
path: 'components/docs-link',
117-
name: '{{docs-link}}',
117+
name: '<DocsLink/>',
118118
},
119119
{
120120
id: 'ember-cli-addon-docs/components/docs-logo/component',
121121
path: 'components/docs-logo',
122-
name: '{{docs-logo}}',
122+
name: '<DocsLogo/>',
123123
},
124124
{
125125
id: 'ember-cli-addon-docs/components/docs-snippet/component',
126126
path: 'components/docs-snippet',
127-
name: '{{docs-snippet}}',
127+
name: '<DocsSnippet/>',
128128
},
129129
{
130130
id: 'ember-cli-addon-docs/components/docs-svg-icon/component',
131131
path: 'components/docs-svg-icon',
132-
name: '{{docs-svg-icon}}',
132+
name: '<DocsSvgIcon/>',
133133
},
134134
{
135135
id: 'ember-cli-addon-docs/components/docs-viewer/component',
136136
path: 'components/docs-viewer',
137-
name: '{{docs-viewer}}',
137+
name: '<DocsViewer/>',
138138
},
139139
],
140140
},
@@ -164,20 +164,20 @@ describe('Unit | NavigationIndexGenerator', function (hooks) {
164164
{
165165
type: 'components',
166166
items: [
167-
{
168-
id: 'sandbox/components/simple-list/item/component',
169-
path: 'components/simple-list/item',
170-
name: '{{simple-list/item}}',
171-
},
172167
{
173168
id: 'sandbox/components/simple-list/component',
174169
path: 'components/simple-list',
175-
name: '{{simple-list}}',
170+
name: '<SimpleList/>',
171+
},
172+
{
173+
id: 'sandbox/components/simple-list/item/component',
174+
path: 'components/simple-list/item',
175+
name: '<SimpleList::Item/>',
176176
},
177177
{
178178
id: 'sandbox/components/yuidoc-component',
179179
path: 'components/yuidoc-component',
180-
name: '{{yuidoc-component}}',
180+
name: '<YuidocComponent/>',
181181
},
182182
],
183183
},

tests/acceptance/docs-route-test.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ module('Acceptance | Docs route test', function (hooks) {
1515

1616
test('I can visit an autogenerated docs route', async function (assert) {
1717
await visit('/docs');
18-
await click('[data-test-label="{{docs-hero}}"]');
18+
await click('[data-test-label="<DocsHero/\u200B>"]');
1919

2020
assert.dom('h1').hasText('DocsHero');
2121
});

tests/acceptance/sandbox/api/components-test.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ module('Acceptance | Sandbox | API | components', function (hooks) {
1212

1313
test('nested components work', async function (assert) {
1414
await visit('/sandbox');
15-
await modulePage.navItems.findOne({ text: '{{simple-list}}' }).click();
15+
await modulePage.navItems.findOne({ text: '<SimpleList/\u200B>' }).click();
1616

1717
assert.equal(
1818
currentURL(),
@@ -21,7 +21,7 @@ module('Acceptance | Sandbox | API | components', function (hooks) {
2121
);
2222

2323
await modulePage.navItems
24-
.findOne({ text: '{{simple-list/\u200Bitem}}' })
24+
.findOne({ text: '<SimpleList::Item/\u200B>' })
2525
.click();
2626

2727
assert.equal(

0 commit comments

Comments
 (0)