@@ -4,6 +4,8 @@ import { setupRenderingTest } from 'ember-qunit';
4
4
import { render , settled } from '@ember/test-helpers' ;
5
5
import hbs from 'htmlbars-inline-precompile' ;
6
6
7
+ import { macroCondition , dependencySatisfies } from '@embroider/macros' ;
8
+
7
9
module ( 'Integration | Modifier | did-update' , function ( hooks ) {
8
10
setupRenderingTest ( hooks ) ;
9
11
@@ -26,27 +28,30 @@ module('Integration | Modifier | did-update', function (hooks) {
26
28
this . set ( 'boundValue' , 'update' ) ;
27
29
} ) ;
28
30
29
- test ( 'it consumes tracked properties without re-invoking' , async function ( assert ) {
30
- assert . expect ( 1 ) ;
31
+ // only run the next test where @tracked is present
32
+ if ( macroCondition ( dependencySatisfies ( 'ember-source' , '>= 3.12.0' ) ) ) {
33
+ test ( 'it consumes tracked properties without re-invoking' , async function ( assert ) {
34
+ assert . expect ( 1 ) ;
31
35
32
- class Context {
33
- @tracked boundValue = 'initial' ;
34
- @tracked secondaryValue = 'initial' ;
35
- }
36
+ class Context {
37
+ @tracked boundValue = 'initial' ;
38
+ @tracked secondaryValue = 'initial' ;
39
+ }
36
40
37
- this . context = new Context ( ) ;
41
+ this . context = new Context ( ) ;
38
42
39
- this . someMethod = ( ) => {
40
- // This assertion works as an assurance that we render before `secondaryValue` changes,
41
- // and consumes its tag to ensure reading tracked properties won't re-trigger the modifier
42
- assert . equal ( this . context . secondaryValue , 'initial' ) ;
43
- } ;
43
+ this . someMethod = ( ) => {
44
+ // This assertion works as an assurance that we render before `secondaryValue` changes,
45
+ // and consumes its tag to ensure reading tracked properties won't re-trigger the modifier
46
+ assert . equal ( this . context . secondaryValue , 'initial' ) ;
47
+ } ;
44
48
45
- await render ( hbs `<div {{did-update this.someMethod this.context.boundValue}}></div>` ) ;
49
+ await render ( hbs `<div {{did-update this.someMethod this.context.boundValue}}></div>` ) ;
46
50
47
- this . context . boundValue = 'update' ;
48
- await settled ( ) ;
49
- this . context . secondaryValue = 'update' ;
50
- await settled ( ) ;
51
- } ) ;
51
+ this . context . boundValue = 'update' ;
52
+ await settled ( ) ;
53
+ this . context . secondaryValue = 'update' ;
54
+ await settled ( ) ;
55
+ } ) ;
56
+ }
52
57
} ) ;
0 commit comments