8
8
import { ENV } from '@ember/-internals/environment' ;
9
9
import { Component , setComponentManager } from '@ember/-internals/glimmer' ;
10
10
import type { InternalOwner } from '@ember/-internals/owner' ;
11
+ import { set } from '@ember/object' ;
11
12
import Route from '@ember/routing/route' ;
12
13
import Controller from '@ember/controller' ;
13
14
import { assert , captureRenderTree } from '@ember/debug' ;
@@ -313,7 +314,8 @@ if (ENV._DEBUG_RENDER_TREE) {
313
314
] ) ;
314
315
315
316
runTask ( ( ) => {
316
- this . controllerFor ( 'application' ) ! . set ( 'engineName' , 'bar' ) ;
317
+ const controller = this . controllerFor ( 'application' ) ! ;
318
+ set ( controller , 'engineName' , 'bar' ) ;
317
319
} ) ;
318
320
319
321
this . assertRenderTree ( [
@@ -362,7 +364,8 @@ if (ENV._DEBUG_RENDER_TREE) {
362
364
] ) ;
363
365
364
366
runTask ( ( ) => {
365
- this . controllerFor ( 'application' ) ! . set ( 'engineName' , undefined ) ;
367
+ const controller = this . controllerFor ( 'application' ) ! ;
368
+ set ( controller , 'engineName' , undefined ) ;
366
369
} ) ;
367
370
368
371
this . assertRenderTree ( [
@@ -396,10 +399,9 @@ if (ENV._DEBUG_RENDER_TREE) {
396
399
} ;
397
400
398
401
runTask ( ( ) => {
399
- this . controllerFor ( 'application' ) ! . setProperties ( {
400
- showMore : true ,
401
- engineModel : model ,
402
- } ) ;
402
+ const controller = this . controllerFor ( 'application' ) ! ;
403
+ set ( controller , 'showMore' , true ) ;
404
+ set ( controller , 'engineModel' , model ) ;
403
405
} ) ;
404
406
405
407
this . assertRenderTree ( [
@@ -458,7 +460,8 @@ if (ENV._DEBUG_RENDER_TREE) {
458
460
] ) ;
459
461
460
462
runTask ( ( ) => {
461
- this . controllerFor ( 'application' ) ! . set ( 'engineName' , 'bar' ) ;
463
+ const controller = this . controllerFor ( 'application' ) ! ;
464
+ set ( controller , 'engineName' , 'bar' ) ;
462
465
} ) ;
463
466
464
467
this . assertRenderTree ( [
@@ -569,10 +572,9 @@ if (ENV._DEBUG_RENDER_TREE) {
569
572
] ) ;
570
573
571
574
runTask ( ( ) => {
572
- this . controllerFor ( 'application' ) ! . setProperties ( {
573
- showMore : false ,
574
- engineName : undefined ,
575
- } ) ;
575
+ const controller = this . controllerFor ( 'application' ) ! ;
576
+ set ( controller , 'showMore' , false ) ;
577
+ set ( controller , 'engineName' , undefined ) ;
576
578
} ) ;
577
579
578
580
this . assertRenderTree ( [
@@ -720,7 +722,7 @@ if (ENV._DEBUG_RENDER_TREE) {
720
722
runTask ( ( ) => {
721
723
let controller = instance ! . lookup ( 'controller:application' ) ;
722
724
assert ( 'Expected an instance of controller' , controller instanceof Controller ) ;
723
- controller . set ( 'message' , 'World' ) ;
725
+ set ( controller , 'message' , 'World' ) ;
724
726
} ) ;
725
727
726
728
this . assertRenderTree ( [
@@ -776,7 +778,7 @@ if (ENV._DEBUG_RENDER_TREE) {
776
778
runTask ( ( ) => {
777
779
let controller = instance ! . lookup ( 'controller:application' ) ;
778
780
assert ( 'Expected an instance of controller' , controller instanceof Controller ) ;
779
- controller . set ( 'message' , undefined ) ;
781
+ set ( controller , 'message' , undefined ) ;
780
782
} ) ;
781
783
782
784
this . assertRenderTree ( [
@@ -870,7 +872,8 @@ if (ENV._DEBUG_RENDER_TREE) {
870
872
] ) ;
871
873
872
874
runTask ( ( ) => {
873
- this . controllerFor ( 'application' ) ! . set ( 'showSecond' , true ) ;
875
+ const controller = this . controllerFor ( 'application' ) ! ;
876
+ set ( controller , 'showSecond' , true ) ;
874
877
} ) ;
875
878
876
879
this . assertRenderTree ( [
@@ -895,7 +898,8 @@ if (ENV._DEBUG_RENDER_TREE) {
895
898
] ) ;
896
899
897
900
runTask ( ( ) => {
898
- this . controllerFor ( 'application' ) ! . set ( 'showSecond' , false ) ;
901
+ const controller = this . controllerFor ( 'application' ) ! ;
902
+ set ( controller , 'showSecond' , false ) ;
899
903
} ) ;
900
904
901
905
this . assertRenderTree ( [
@@ -943,7 +947,8 @@ if (ENV._DEBUG_RENDER_TREE) {
943
947
] ) ;
944
948
945
949
runTask ( ( ) => {
946
- this . controllerFor ( 'application' ) ! . set ( 'showSecond' , true ) ;
950
+ const controller = this . controllerFor ( 'application' ) ! ;
951
+ set ( controller , 'showSecond' , true ) ;
947
952
} ) ;
948
953
949
954
this . assertRenderTree ( [
@@ -968,7 +973,8 @@ if (ENV._DEBUG_RENDER_TREE) {
968
973
] ) ;
969
974
970
975
runTask ( ( ) => {
971
- this . controllerFor ( 'application' ) ! . set ( 'showSecond' , false ) ;
976
+ const controller = this . controllerFor ( 'application' ) ! ;
977
+ set ( controller , 'showSecond' , false ) ;
972
978
} ) ;
973
979
974
980
this . assertRenderTree ( [
@@ -1018,7 +1024,8 @@ if (ENV._DEBUG_RENDER_TREE) {
1018
1024
] ) ;
1019
1025
1020
1026
runTask ( ( ) => {
1021
- this . controllerFor ( 'application' ) ! . set ( 'showSecond' , true ) ;
1027
+ const controller = this . controllerFor ( 'application' ) ! ;
1028
+ set ( controller , 'showSecond' , true ) ;
1022
1029
} ) ;
1023
1030
1024
1031
this . assertRenderTree ( [
@@ -1043,7 +1050,8 @@ if (ENV._DEBUG_RENDER_TREE) {
1043
1050
] ) ;
1044
1051
1045
1052
runTask ( ( ) => {
1046
- this . controllerFor ( 'application' ) ! . set ( 'showSecond' , false ) ;
1053
+ const controller = this . controllerFor ( 'application' ) ! ;
1054
+ set ( controller , 'showSecond' , false ) ;
1047
1055
} ) ;
1048
1056
1049
1057
this . assertRenderTree ( [
@@ -1091,7 +1099,8 @@ if (ENV._DEBUG_RENDER_TREE) {
1091
1099
] ) ;
1092
1100
1093
1101
runTask ( ( ) => {
1094
- this . controllerFor ( 'application' ) ! . set ( 'showSecond' , true ) ;
1102
+ const controller = this . controllerFor ( 'application' ) ! ;
1103
+ set ( controller , 'showSecond' , true ) ;
1095
1104
} ) ;
1096
1105
1097
1106
this . assertRenderTree ( [
@@ -1116,7 +1125,8 @@ if (ENV._DEBUG_RENDER_TREE) {
1116
1125
] ) ;
1117
1126
1118
1127
runTask ( ( ) => {
1119
- this . controllerFor ( 'application' ) ! . set ( 'showSecond' , false ) ;
1128
+ const controller = this . controllerFor ( 'application' ) ! ;
1129
+ set ( controller , 'showSecond' , false ) ;
1120
1130
} ) ;
1121
1131
1122
1132
this . assertRenderTree ( [
@@ -1176,7 +1186,8 @@ if (ENV._DEBUG_RENDER_TREE) {
1176
1186
] ) ;
1177
1187
1178
1188
runTask ( ( ) => {
1179
- this . controllerFor ( 'application' ) ! . set ( 'showSecond' , true ) ;
1189
+ const controller = this . controllerFor ( 'application' ) ! ;
1190
+ set ( controller , 'showSecond' , true ) ;
1180
1191
} ) ;
1181
1192
1182
1193
this . assertRenderTree ( [
@@ -1201,7 +1212,8 @@ if (ENV._DEBUG_RENDER_TREE) {
1201
1212
] ) ;
1202
1213
1203
1214
runTask ( ( ) => {
1204
- this . controllerFor ( 'application' ) ! . set ( 'showSecond' , false ) ;
1215
+ const controller = this . controllerFor ( 'application' ) ! ;
1216
+ set ( controller , 'showSecond' , false ) ;
1205
1217
} ) ;
1206
1218
1207
1219
this . assertRenderTree ( [
@@ -1295,7 +1307,7 @@ if (ENV._DEBUG_RENDER_TREE) {
1295
1307
} ,
1296
1308
] ) ;
1297
1309
1298
- runTask ( ( ) => target . set ( 'showSecond' , true ) ) ;
1310
+ runTask ( ( ) => set ( target , 'showSecond' , true ) ) ;
1299
1311
1300
1312
const secondModifiers : ExpectedRenderNode [ 'children' ] = [
1301
1313
{
@@ -1366,7 +1378,7 @@ if (ENV._DEBUG_RENDER_TREE) {
1366
1378
} ,
1367
1379
] ) ;
1368
1380
1369
- runTask ( ( ) => target . set ( 'showSecond' , false ) ) ;
1381
+ runTask ( ( ) => set ( target , 'showSecond' , false ) ) ;
1370
1382
1371
1383
this . assertRenderTree ( [
1372
1384
{
@@ -1462,7 +1474,8 @@ if (ENV._DEBUG_RENDER_TREE) {
1462
1474
this . assertRenderTree ( [ textareaNode ( 'first' , this . element ! . firstChild , firstModifiers ) ] ) ;
1463
1475
1464
1476
runTask ( ( ) => {
1465
- this . controllerFor ( 'application' ) ! . set ( 'showSecond' , true ) ;
1477
+ const controller = this . controllerFor ( 'application' ) ! ;
1478
+ set ( controller , 'showSecond' , true ) ;
1466
1479
} ) ;
1467
1480
1468
1481
const secondModifiers : ExpectedRenderNode [ 'children' ] = [
@@ -1519,7 +1532,8 @@ if (ENV._DEBUG_RENDER_TREE) {
1519
1532
] ) ;
1520
1533
1521
1534
runTask ( ( ) => {
1522
- this . controllerFor ( 'application' ) ! . set ( 'showSecond' , false ) ;
1535
+ const controller = this . controllerFor ( 'application' ) ! ;
1536
+ set ( controller , 'showSecond' , false ) ;
1523
1537
} ) ;
1524
1538
1525
1539
this . assertRenderTree ( [ textareaNode ( 'first' , this . element ! . firstChild , firstModifiers ) ] ) ;
@@ -1571,7 +1585,8 @@ if (ENV._DEBUG_RENDER_TREE) {
1571
1585
] ) ;
1572
1586
1573
1587
runTask ( ( ) => {
1574
- this . controllerFor ( 'application' ) ! . set ( 'showSecond' , true ) ;
1588
+ const controller = this . controllerFor ( 'application' ) ! ;
1589
+ set ( controller , 'showSecond' , true ) ;
1575
1590
} ) ;
1576
1591
1577
1592
const secondModifiers : ExpectedRenderNode [ 'children' ] = [
@@ -1608,7 +1623,8 @@ if (ENV._DEBUG_RENDER_TREE) {
1608
1623
] ) ;
1609
1624
1610
1625
runTask ( ( ) => {
1611
- this . controllerFor ( 'application' ) ! . set ( 'showSecond' , false ) ;
1626
+ const controller = this . controllerFor ( 'application' ) ! ;
1627
+ set ( controller , 'showSecond' , false ) ;
1612
1628
} ) ;
1613
1629
1614
1630
this . assertRenderTree ( [
0 commit comments