11import { moduleFor , RenderingTestCase , styles , runTask } from 'internal-test-helpers' ;
22
3- import { set , computed } from '@ember/object' ;
3+ import { get , set , computed } from '@ember/object' ;
44
55import { Component , htmlSafe } from '../../utils/helpers' ;
66
@@ -47,15 +47,15 @@ moduleFor(
4747 firstAttr : 'first attr' ,
4848 } ) ;
4949
50- assert . equal ( instance . get ( 'first' ) , 'first attr' ) ;
50+ assert . equal ( get ( instance , 'first' ) , 'first attr' ) ;
5151
5252 runTask ( ( ) => this . rerender ( ) ) ;
5353
54- assert . equal ( instance . get ( 'first' ) , 'first attr' ) ;
54+ assert . equal ( get ( instance , 'first' ) , 'first attr' ) ;
5555
5656 runTask ( ( ) => set ( this . context , 'firstAttr' , 'second attr' ) ) ;
5757
58- assert . equal ( instance . get ( 'first' ) , 'second attr' ) ;
58+ assert . equal ( get ( instance , 'first' ) , 'second attr' ) ;
5959
6060 runTask ( ( ) => set ( this . context , 'firstAttr' , 'first attr' ) ) ;
6161
@@ -71,7 +71,7 @@ moduleFor(
7171 }
7272
7373 didReceiveAttrs ( ) {
74- this . set ( 'first' , this . get ( 'first' ) . toUpperCase ( ) ) ;
74+ set ( this , 'first' , get ( this , 'first' ) . toUpperCase ( ) ) ;
7575 }
7676 } ;
7777 this . registerComponent ( 'foo-bar' , {
@@ -81,13 +81,13 @@ moduleFor(
8181
8282 this . render ( `{{foo-bar first="first attr"}}` ) ;
8383
84- assert . equal ( instance . get ( 'first' ) , 'FIRST ATTR' , 'component lookup uses local state' ) ;
84+ assert . equal ( get ( instance , 'first' ) , 'FIRST ATTR' , 'component lookup uses local state' ) ;
8585 this . assertText ( 'FIRST ATTR' ) ;
8686
8787 runTask ( ( ) => this . rerender ( ) ) ;
8888
8989 assert . equal (
90- instance . get ( 'first' ) ,
90+ get ( instance , 'first' ) ,
9191 'FIRST ATTR' ,
9292 'component lookup uses local state during rerender'
9393 ) ;
@@ -108,7 +108,7 @@ moduleFor(
108108 }
109109
110110 didReceiveAttrs ( ) {
111- assert . equal ( this . get ( 'woot' ) , wootVal , 'found attr in didReceiveAttrs' ) ;
111+ assert . equal ( get ( this , 'woot' ) , wootVal , 'found attr in didReceiveAttrs' ) ;
112112 }
113113 } ;
114114 this . registerComponent ( 'foo-bar' , { ComponentClass : FooBarComponent } ) ;
@@ -117,25 +117,25 @@ moduleFor(
117117 woot : wootVal ,
118118 } ) ;
119119
120- assert . equal ( instance . get ( 'woot' ) , 'yes' , 'component found attr' ) ;
120+ assert . equal ( get ( instance , 'woot' ) , 'yes' , 'component found attr' ) ;
121121
122122 runTask ( ( ) => this . rerender ( ) ) ;
123123
124- assert . equal ( instance . get ( 'woot' ) , 'yes' , 'component found attr after rerender' ) ;
124+ assert . equal ( get ( instance , 'woot' ) , 'yes' , 'component found attr after rerender' ) ;
125125
126126 runTask ( ( ) => {
127127 wootVal = 'nope' ;
128128 set ( this . context , 'woot' , wootVal ) ;
129129 } ) ;
130130
131- assert . equal ( instance . get ( 'woot' ) , 'nope' , 'component found attr after attr change' ) ;
131+ assert . equal ( get ( instance , 'woot' ) , 'nope' , 'component found attr after attr change' ) ;
132132
133133 runTask ( ( ) => {
134134 wootVal = 'yes' ;
135135 set ( this . context , 'woot' , wootVal ) ;
136136 } ) ;
137137
138- assert . equal ( instance . get ( 'woot' ) , 'yes' , 'component found attr after reset' ) ;
138+ assert . equal ( get ( instance , 'woot' ) , 'yes' , 'component found attr after reset' ) ;
139139 }
140140
141141 [ '@test getAttr() should return the same value as get()' ] ( assert ) {
@@ -149,9 +149,9 @@ moduleFor(
149149 }
150150
151151 didReceiveAttrs ( ) {
152- let rootFirstPositional = this . get ( 'firstPositional' ) ;
153- let rootFirst = this . get ( 'first' ) ;
154- let rootSecond = this . get ( 'second' ) ;
152+ let rootFirstPositional = get ( this , 'firstPositional' ) ;
153+ let rootFirst = get ( this , 'first' ) ;
154+ let rootSecond = get ( this , 'second' ) ;
155155 let attrFirstPositional = this . getAttr ( 'firstPositional' ) ;
156156 let attrFirst = this . getAttr ( 'first' ) ;
157157 let attrSecond = this . getAttr ( 'second' ) ;
@@ -178,58 +178,58 @@ moduleFor(
178178 second : 'second' ,
179179 } ) ;
180180
181- assert . equal ( instance . get ( 'firstPositional' ) , 'firstPositional' , 'matches known value' ) ;
182- assert . equal ( instance . get ( 'first' ) , 'first' , 'matches known value' ) ;
183- assert . equal ( instance . get ( 'second' ) , 'second' , 'matches known value' ) ;
181+ assert . equal ( get ( instance , 'firstPositional' ) , 'firstPositional' , 'matches known value' ) ;
182+ assert . equal ( get ( instance , 'first' ) , 'first' , 'matches known value' ) ;
183+ assert . equal ( get ( instance , 'second' ) , 'second' , 'matches known value' ) ;
184184
185185 runTask ( ( ) => this . rerender ( ) ) ;
186186
187- assert . equal ( instance . get ( 'firstPositional' ) , 'firstPositional' , 'matches known value' ) ;
188- assert . equal ( instance . get ( 'first' ) , 'first' , 'matches known value' ) ;
189- assert . equal ( instance . get ( 'second' ) , 'second' , 'matches known value' ) ;
187+ assert . equal ( get ( instance , 'firstPositional' ) , 'firstPositional' , 'matches known value' ) ;
188+ assert . equal ( get ( instance , 'first' ) , 'first' , 'matches known value' ) ;
189+ assert . equal ( get ( instance , 'second' ) , 'second' , 'matches known value' ) ;
190190
191191 runTask ( ( ) => {
192192 set ( this . context , 'first' , 'third' ) ;
193193 } ) ;
194194
195- assert . equal ( instance . get ( 'firstPositional' ) , 'firstPositional' , 'matches known value' ) ;
196- assert . equal ( instance . get ( 'first' ) , 'third' , 'matches known value' ) ;
197- assert . equal ( instance . get ( 'second' ) , 'second' , 'matches known value' ) ;
195+ assert . equal ( get ( instance , 'firstPositional' ) , 'firstPositional' , 'matches known value' ) ;
196+ assert . equal ( get ( instance , 'first' ) , 'third' , 'matches known value' ) ;
197+ assert . equal ( get ( instance , 'second' ) , 'second' , 'matches known value' ) ;
198198
199199 runTask ( ( ) => {
200200 set ( this . context , 'second' , 'fourth' ) ;
201201 } ) ;
202202
203- assert . equal ( instance . get ( 'firstPositional' ) , 'firstPositional' , 'matches known value' ) ;
204- assert . equal ( instance . get ( 'first' ) , 'third' , 'matches known value' ) ;
205- assert . equal ( instance . get ( 'second' ) , 'fourth' , 'matches known value' ) ;
203+ assert . equal ( get ( instance , 'firstPositional' ) , 'firstPositional' , 'matches known value' ) ;
204+ assert . equal ( get ( instance , 'first' ) , 'third' , 'matches known value' ) ;
205+ assert . equal ( get ( instance , 'second' ) , 'fourth' , 'matches known value' ) ;
206206
207207 runTask ( ( ) => {
208208 set ( this . context , 'firstPositional' , 'fifth' ) ;
209209 } ) ;
210210
211- assert . equal ( instance . get ( 'firstPositional' ) , 'fifth' , 'matches known value' ) ;
212- assert . equal ( instance . get ( 'first' ) , 'third' , 'matches known value' ) ;
213- assert . equal ( instance . get ( 'second' ) , 'fourth' , 'matches known value' ) ;
211+ assert . equal ( get ( instance , 'firstPositional' ) , 'fifth' , 'matches known value' ) ;
212+ assert . equal ( get ( instance , 'first' ) , 'third' , 'matches known value' ) ;
213+ assert . equal ( get ( instance , 'second' ) , 'fourth' , 'matches known value' ) ;
214214
215215 runTask ( ( ) => {
216216 set ( this . context , 'firstPositional' , 'firstPositional' ) ;
217217 set ( this . context , 'first' , 'first' ) ;
218218 set ( this . context , 'second' , 'second' ) ;
219219 } ) ;
220220
221- assert . equal ( instance . get ( 'firstPositional' ) , 'firstPositional' , 'matches known value' ) ;
222- assert . equal ( instance . get ( 'first' ) , 'first' , 'matches known value' ) ;
223- assert . equal ( instance . get ( 'second' ) , 'second' , 'matches known value' ) ;
221+ assert . equal ( get ( instance , 'firstPositional' ) , 'firstPositional' , 'matches known value' ) ;
222+ assert . equal ( get ( instance , 'first' ) , 'first' , 'matches known value' ) ;
223+ assert . equal ( get ( instance , 'second' ) , 'second' , 'matches known value' ) ;
224224 }
225225
226226 [ '@test bound computed properties can be overridden in extensions, set during init, and passed in as attrs' ] ( ) {
227227 let FooClass = class extends Component {
228228 attributeBindings = [ 'style' ] ;
229229 @computed ( 'height' , 'color' )
230230 get style ( ) {
231- let height = this . get ( 'height' ) ;
232- let color = this . get ( 'color' ) ;
231+ let height = get ( this , 'height' ) ;
232+ let color = get ( this , 'color' ) ;
233233 return htmlSafe ( `height: ${ height } px; background-color: ${ color } ;` ) ;
234234 }
235235 color = 'red' ;
0 commit comments