@@ -2,8 +2,7 @@ import { RenderingTestCase, moduleFor, runTask } from 'internal-test-helpers';
2
2
3
3
import { Component } from '../../utils/helpers' ;
4
4
5
- import { set , computed } from '@ember/-internals/metal' ;
6
- import { HAS_NATIVE_PROXY } from '@ember/-internals/utils' ;
5
+ import { set } from '@ember/-internals/metal' ;
7
6
8
7
moduleFor (
9
8
'Helpers test: {{hash}}' ,
@@ -187,132 +186,5 @@ moduleFor(
187
186
188
187
this . assertText ( 'Chad Hietala' ) ;
189
188
}
190
-
191
- [ '@test works with computeds' ] ( ) {
192
- let FooBarComponent = Component . extend ( {
193
- fullName : computed ( 'hash.firstName' , 'hash.lastName' , function ( ) {
194
- return `${ this . hash . firstName } ${ this . hash . lastName } ` ;
195
- } ) ,
196
- } ) ;
197
-
198
- this . registerComponent ( 'foo-bar' , {
199
- ComponentClass : FooBarComponent ,
200
- template : `{{this.fullName}}` ,
201
- } ) ;
202
-
203
- this . render ( `{{foo-bar hash=(hash firstName=this.firstName lastName=this.lastName)}}` , {
204
- firstName : 'Chad' ,
205
- lastName : 'Hietala' ,
206
- } ) ;
207
-
208
- this . assertText ( 'Chad Hietala' ) ;
209
-
210
- runTask ( ( ) => this . rerender ( ) ) ;
211
-
212
- this . assertText ( 'Chad Hietala' ) ;
213
-
214
- runTask ( ( ) => {
215
- set ( this . context , 'firstName' , 'Godfrey' ) ;
216
- set ( this . context , 'lastName' , 'Chan' ) ;
217
- } ) ;
218
-
219
- this . assertText ( 'Godfrey Chan' ) ;
220
- }
221
-
222
- [ '@test works with computeds on non-defined properties' ] ( ) {
223
- let instance ;
224
-
225
- let FooBarComponent = Component . extend ( {
226
- init ( ) {
227
- this . _super ( ...arguments ) ;
228
-
229
- if ( HAS_NATIVE_PROXY ) {
230
- expectDeprecation ( ( ) => {
231
- set ( this . hash , 'lastName' , 'Hietala' ) ;
232
- } , / Y o u s e t t h e ' .* ' p r o p e r t y o n a { { h a s h } } o b j e c t / ) ;
233
- } else {
234
- set ( this . hash , 'lastName' , 'Hietala' ) ;
235
- }
236
-
237
- instance = this ;
238
- } ,
239
-
240
- fullName : computed ( 'hash.firstName' , 'hash.lastName' , function ( ) {
241
- return `${ this . hash . firstName } ${ this . hash . lastName } ` ;
242
- } ) ,
243
- } ) ;
244
-
245
- this . registerComponent ( 'foo-bar' , {
246
- ComponentClass : FooBarComponent ,
247
- template : `{{this.fullName}}` ,
248
- } ) ;
249
-
250
- this . render ( `{{foo-bar hash=(hash firstName=this.firstName)}}` , {
251
- firstName : 'Chad' ,
252
- lastName : 'Hietala' ,
253
- } ) ;
254
-
255
- this . assertText ( 'Chad Hietala' ) ;
256
-
257
- runTask ( ( ) => this . rerender ( ) ) ;
258
-
259
- this . assertText ( 'Chad Hietala' ) ;
260
-
261
- runTask ( ( ) => {
262
- set ( this . context , 'firstName' , 'Godfrey' ) ;
263
-
264
- if ( HAS_NATIVE_PROXY ) {
265
- expectDeprecation ( ( ) => {
266
- set ( instance . hash , 'lastName' , 'Chan' ) ;
267
- } , / Y o u s e t t h e ' .* ' p r o p e r t y o n a { { h a s h } } o b j e c t / ) ;
268
- } else {
269
- set ( instance . hash , 'lastName' , 'Chan' ) ;
270
- }
271
- } ) ;
272
-
273
- this . assertText ( 'Godfrey Chan' ) ;
274
- }
275
-
276
- [ '@test works when properties are set dynamically' ] ( ) {
277
- let fooBarInstance ;
278
- let FooBarComponent = Component . extend ( {
279
- init ( ) {
280
- this . _super ( ) ;
281
- fooBarInstance = this ;
282
- } ,
283
- } ) ;
284
-
285
- this . registerComponent ( 'foo-bar' , {
286
- ComponentClass : FooBarComponent ,
287
- template : `{{this.hash.firstName}} {{this.hash.lastName}}` ,
288
- } ) ;
289
-
290
- this . render ( `{{foo-bar hash=(hash firstName=this.firstName)}}` , {
291
- firstName : 'Chad' ,
292
- } ) ;
293
-
294
- this . assertText ( 'Chad ' ) ;
295
-
296
- runTask ( ( ) => {
297
- if ( HAS_NATIVE_PROXY ) {
298
- expectDeprecation ( ( ) => {
299
- set ( fooBarInstance . hash , 'lastName' , 'Hietala' ) ;
300
- } , / Y o u s e t t h e ' .* ' p r o p e r t y o n a { { h a s h } } o b j e c t / ) ;
301
- } else {
302
- set ( fooBarInstance . hash , 'lastName' , 'Hietala' ) ;
303
- }
304
- } ) ;
305
-
306
- this . assertText ( 'Chad Hietala' ) ;
307
-
308
- runTask ( ( ) => {
309
- expectDeprecation ( ( ) => {
310
- set ( fooBarInstance . hash , 'firstName' , 'Godfrey' ) ;
311
- set ( fooBarInstance . hash , 'lastName' , 'Chan' ) ;
312
- } , / Y o u s e t t h e ' .* ' p r o p e r t y o n a { { h a s h } } o b j e c t / ) ;
313
- } ) ;
314
-
315
- this . assertText ( 'Godfrey Chan' ) ;
316
- }
317
189
}
318
190
) ;
0 commit comments