File tree Expand file tree Collapse file tree 2 files changed +19
-14
lines changed
Expand file tree Collapse file tree 2 files changed +19
-14
lines changed Original file line number Diff line number Diff line change @@ -13,21 +13,21 @@ QUnit.module('App Boot', function (hooks) {
1313 QUnit . test ( 'nested {{component}}' , function ( assert ) {
1414 this . template ( 'index' , '{{root-component}}' ) ;
1515
16- this . template (
17- 'components/root-component' ,
16+ this . component (
17+ 'root-component' ,
18+ {
19+ location : 'World' ,
20+ hasExistence : true ,
21+ } ,
1822 "\
19- <h1>Hello {{#if this.hasExistence}}{{this.location}}{{/if}}</h1>\
20- <div>{{component 'foo-bar'}}</div>\
21- "
23+ <h1>Hello {{#if this.hasExistence}}{{this.location}}{{/if}}</h1>\
24+ <div>{{component 'foo-bar'}}</div>\
25+ "
2226 ) ;
2327
24- this . component ( 'root-component' , {
25- location : 'World' ,
26- hasExistence : true ,
27- } ) ;
28-
29- this . template (
30- 'components/foo-bar' ,
28+ this . component (
29+ 'foo-bar' ,
30+ undefined ,
3131 '\
3232 <p>The files are *inside* the computer?!</p>\
3333 '
Original file line number Diff line number Diff line change @@ -61,6 +61,8 @@ module.exports = function (hooks) {
6161
6262 this . Ember = Ember ;
6363 this . compile = compile ;
64+ this . setComponentTemplate = Ember . _setComponentTemplate ;
65+ this . templateOnlyComponent = Ember . _templateOnlyComponent ;
6466
6567 Ember . testing = true ;
6668
@@ -166,8 +168,11 @@ function registerTemplate(name, template) {
166168 this . register ( 'template:' + name , this . compile ( template ) ) ;
167169}
168170
169- function registerComponent ( name , componentProps ) {
170- let component = this . Ember . Component . extend ( componentProps ) ;
171+ function registerComponent ( name , componentProps , templateContents ) {
172+ let component = this . setComponentTemplate (
173+ this . compile ( templateContents ) ,
174+ componentProps ? this . Ember . Component . extend ( componentProps ) : this . templateOnlyComponent ( )
175+ ) ;
171176 this . register ( 'component:' + name , component ) ;
172177}
173178
You can’t perform that action at this time.
0 commit comments