@@ -23,6 +23,7 @@ import {
23
23
RenderTest ,
24
24
suite ,
25
25
test ,
26
+ tracked ,
26
27
} from '..' ;
27
28
28
29
interface CapturedBounds {
@@ -135,33 +136,62 @@ class DebugRenderTreeTest extends RenderTest {
135
136
136
137
@test 'emberish curly components' ( ) {
137
138
this . registerComponent ( 'Curly' , 'HelloWorld' , 'Hello World' ) ;
139
+ let error : Error | null = null ;
140
+ class State {
141
+ @tracked doFail = false ;
142
+ get getterWithError ( ) {
143
+ if ( ! this . doFail ) return ;
144
+ error = new Error ( 'error' ) ;
145
+ throw error ;
146
+ }
147
+ }
148
+ const obj = new State ( ) ;
138
149
139
150
this . render (
140
- `<HelloWorld @arg="first"/>{{#if this.showSecond}}<HelloWorld @arg="second"/>{{/if}}` ,
151
+ `<HelloWorld @arg="first" @arg2={{this.obj.getterWithError}} />{{#if this.showSecond}}<HelloWorld @arg="second"/>{{/if}}` ,
141
152
{
142
153
showSecond : false ,
154
+ obj,
143
155
}
144
156
) ;
145
157
158
+ obj . doFail = true ;
159
+
160
+ this . delegate . getCapturedRenderTree ( ) ;
161
+
162
+ this . assert . ok ( error !== null , 'expecting an Error' ) ;
163
+
146
164
this . assertRenderTree ( [
147
165
{
148
166
type : 'component' ,
149
167
name : 'HelloWorld' ,
150
- args : { positional : [ ] , named : { arg : 'first' } } ,
168
+ args : ( actual ) => {
169
+ const args = { positional : [ ] , named : { arg : 'first' , arg2 : { error } } } ;
170
+ this . assert . deepEqual ( actual , args ) ;
171
+ this . assert . ok (
172
+ ! this . delegate . context . runtime . env . isArgumentCaptureError ! ( actual . named [ 'arg' ] )
173
+ ) ;
174
+ this . assert . ok (
175
+ this . delegate . context . runtime . env . isArgumentCaptureError ! ( actual . named [ 'arg2' ] )
176
+ ) ;
177
+ return true ;
178
+ } ,
151
179
instance : ( instance : EmberishCurlyComponent ) => ( instance as any ) . arg === 'first' ,
152
180
template : '(unknown template module)' ,
153
181
bounds : this . nodeBounds ( this . delegate . getInitialElement ( ) . firstChild ) ,
154
182
children : [ ] ,
155
183
} ,
156
184
] ) ;
157
185
186
+ obj . doFail = false ;
187
+
158
188
this . rerender ( { showSecond : true } ) ;
159
189
160
190
this . assertRenderTree ( [
161
191
{
162
192
type : 'component' ,
163
193
name : 'HelloWorld' ,
164
- args : { positional : [ ] , named : { arg : 'first' } } ,
194
+ args : { positional : [ ] , named : { arg : 'first' , arg2 : undefined } } ,
165
195
instance : ( instance : EmberishCurlyComponent ) => ( instance as any ) . arg === 'first' ,
166
196
template : '(unknown template module)' ,
167
197
bounds : this . nodeBounds ( this . element . firstChild ) ,
@@ -184,7 +214,7 @@ class DebugRenderTreeTest extends RenderTest {
184
214
{
185
215
type : 'component' ,
186
216
name : 'HelloWorld' ,
187
- args : { positional : [ ] , named : { arg : 'first' } } ,
217
+ args : { positional : [ ] , named : { arg : 'first' , arg2 : undefined } } ,
188
218
instance : ( instance : EmberishCurlyComponent ) => ( instance as any ) . arg === 'first' ,
189
219
template : '(unknown template module)' ,
190
220
bounds : this . nodeBounds ( this . element . firstChild ) ,
0 commit comments