@@ -168,4 +168,82 @@ test.group('SuperCharged', (group) => {
168168 } ,
169169 } )
170170 } )
171+
172+ test ( 'register nested .index files with the parent name' , async ( assert ) => {
173+ await fs . add ( 'components/form/input.edge' , '' )
174+ await fs . add ( 'components/form/label.edge' , '' )
175+ await fs . add ( 'components/form/button.edge' , '' )
176+ await fs . add ( 'components/form/index.edge' , '' )
177+
178+ const charged = new Supercharged ( )
179+ charged . discoverComponents ( fs . basePath )
180+
181+ assert . deepEqual ( charged . components , {
182+ 'form' : {
183+ path : 'components/form/index.edge' ,
184+ } ,
185+ 'form.button' : {
186+ path : 'components/form/button.edge' ,
187+ } ,
188+ 'form.index' : {
189+ path : 'components/form/index.edge' ,
190+ } ,
191+ 'form.label' : {
192+ path : 'components/form/label.edge' ,
193+ } ,
194+ 'form.input' : {
195+ path : 'components/form/input.edge' ,
196+ } ,
197+ } )
198+ } )
199+
200+ test ( 'register index files as index when there is no parent' , async ( assert ) => {
201+ await fs . add ( 'components/form/input.edge' , '' )
202+ await fs . add ( 'components/form/label.edge' , '' )
203+ await fs . add ( 'components/form/button.edge' , '' )
204+ await fs . add ( 'components/index.edge' , '' )
205+
206+ const charged = new Supercharged ( )
207+ charged . discoverComponents ( fs . basePath )
208+
209+ assert . deepEqual ( charged . components , {
210+ 'form.button' : {
211+ path : 'components/form/button.edge' ,
212+ } ,
213+ 'form.label' : {
214+ path : 'components/form/label.edge' ,
215+ } ,
216+ 'form.input' : {
217+ path : 'components/form/input.edge' ,
218+ } ,
219+ 'index' : {
220+ path : 'components/index.edge' ,
221+ } ,
222+ } )
223+ } )
224+
225+ test ( 'register index files as index when there is no parent with a prefix' , async ( assert ) => {
226+ await fs . add ( 'components/form/input.edge' , '' )
227+ await fs . add ( 'components/form/label.edge' , '' )
228+ await fs . add ( 'components/form/button.edge' , '' )
229+ await fs . add ( 'components/index.edge' , '' )
230+
231+ const charged = new Supercharged ( )
232+ charged . discoverComponents ( fs . basePath , { prefix : 'hl' } )
233+
234+ assert . deepEqual ( charged . components , {
235+ 'hl.form.button' : {
236+ path : 'components/form/button.edge' ,
237+ } ,
238+ 'hl.form.label' : {
239+ path : 'components/form/label.edge' ,
240+ } ,
241+ 'hl.form.input' : {
242+ path : 'components/form/input.edge' ,
243+ } ,
244+ 'hl.index' : {
245+ path : 'components/index.edge' ,
246+ } ,
247+ } )
248+ } )
171249} )
0 commit comments