@@ -7,8 +7,10 @@ import {
7
7
equalsElement ,
8
8
runTask ,
9
9
runLoopSettled ,
10
+ testUnless ,
10
11
} from 'internal-test-helpers' ;
11
12
13
+ import { action } from '@ember/object' ;
12
14
import { run } from '@ember/runloop' ;
13
15
import { DEBUG } from '@glimmer/env' ;
14
16
import { tracked } from '@ember/-internals/metal' ;
@@ -20,6 +22,7 @@ import { A as emberA } from '@ember/array';
20
22
21
23
import { Component , compile , htmlSafe } from '../../utils/helpers' ;
22
24
import { backtrackingMessageFor } from '../../utils/debug-stack' ;
25
+ import { DEPRECATIONS } from '../../../../deprecations' ;
23
26
24
27
moduleFor (
25
28
'Components test: curly components' ,
@@ -1441,25 +1444,23 @@ moduleFor(
1441
1444
componentInstance = this ;
1442
1445
} ,
1443
1446
1444
- actions : {
1445
- click ( ) {
1446
- let currentCounter = this . get ( 'counter' ) ;
1447
+ myClick : action ( function ( ) {
1448
+ let currentCounter = this . get ( 'counter' ) ;
1447
1449
1448
- assert . equal ( currentCounter , 0 , 'the current `counter` value is correct' ) ;
1450
+ assert . equal ( currentCounter , 0 , 'the current `counter` value is correct' ) ;
1449
1451
1450
- let newCounter = currentCounter + 1 ;
1451
- this . set ( 'counter' , newCounter ) ;
1452
+ let newCounter = currentCounter + 1 ;
1453
+ this . set ( 'counter' , newCounter ) ;
1452
1454
1453
- assert . equal (
1454
- this . get ( 'counter' ) ,
1455
- newCounter ,
1456
- "getting the newly set `counter` property works; it's equal to the value we just set and not `undefined`"
1457
- ) ;
1458
- } ,
1459
- } ,
1455
+ assert . equal (
1456
+ this . get ( 'counter' ) ,
1457
+ newCounter ,
1458
+ "getting the newly set `counter` property works; it's equal to the value we just set and not `undefined`"
1459
+ ) ;
1460
+ } ) ,
1460
1461
} ) ,
1461
1462
template : `
1462
- <button {{action "click"}}>foobar</button>
1463
+ <button {{on "click" this.myClick }}>foobar</button>
1463
1464
` ,
1464
1465
} ) ;
1465
1466
@@ -3146,9 +3147,16 @@ moduleFor(
3146
3147
runTask ( ( ) => set ( this . context , 'foo' , 5 ) ) ;
3147
3148
}
3148
3149
3149
- [ '@test returning `true` from an action does not bubble if `target` is not specified (GH#14275)' ] (
3150
+ [ `${ testUnless (
3151
+ DEPRECATIONS . DEPRECATE_TEMPLATE_ACTION . isRemoved
3152
+ ) } returning \`true\` from an action does not bubble if \`target\` is not specified (GH#14275)`] (
3150
3153
assert
3151
3154
) {
3155
+ expectDeprecation (
3156
+ / U s a g e o f t h e ` \{ \{ a c t i o n \} \} ` m o d i f i e r i s d e p r e c a t e d ./ ,
3157
+ DEPRECATIONS . DEPRECATE_TEMPLATE_ACTION . isEnabled
3158
+ ) ;
3159
+
3152
3160
this . registerComponent ( 'display-toggle' , {
3153
3161
ComponentClass : Component . extend ( {
3154
3162
actions : {
@@ -3173,8 +3181,15 @@ moduleFor(
3173
3181
runTask ( ( ) => this . $ ( 'button' ) . click ( ) ) ;
3174
3182
}
3175
3183
3176
- [ '@test returning `true` from an action bubbles to the `target` if specified' ] ( assert ) {
3177
- assert . expect ( 4 ) ;
3184
+ [ `${ testUnless (
3185
+ DEPRECATIONS . DEPRECATE_TEMPLATE_ACTION . isRemoved
3186
+ ) } returning \`true\` from an action bubbles to the \`target\` if specified`] ( assert ) {
3187
+ assert . expect ( 5 ) ;
3188
+
3189
+ expectDeprecation (
3190
+ / U s a g e o f t h e ` \{ \{ a c t i o n \} \} ` m o d i f i e r i s d e p r e c a t e d ./ ,
3191
+ DEPRECATIONS . DEPRECATE_TEMPLATE_ACTION . isEnabled
3192
+ ) ;
3178
3193
3179
3194
this . registerComponent ( 'display-toggle' , {
3180
3195
ComponentClass : Component . extend ( {
0 commit comments