@@ -852,6 +852,30 @@ describe('isInjectedServiceProp', () => {
852
852
expect ( emberUtils . isInjectedServiceProp ( node , undefined , importName ) ) . toBeTruthy ( ) ;
853
853
} ) ;
854
854
855
+ it ( "should check that it's not an injected service prop with foo.service" , ( ) => {
856
+ const context = new FauxContext ( `
857
+ import {inject as service} from '@ember/service';
858
+ export default Controller.extend({
859
+ currentUser: foo.service()
860
+ });
861
+ ` ) ;
862
+ const importName = context . ast . body [ 0 ] . specifiers [ 0 ] . local . name ;
863
+ const node = context . ast . body [ 1 ] . declaration . arguments [ 0 ] . properties [ 0 ] ;
864
+ expect ( emberUtils . isInjectedServiceProp ( node , undefined , importName ) ) . toBeFalsy ( ) ;
865
+ } ) ;
866
+
867
+ it ( "should check that it's not an injected service prop with foo.service.inject" , ( ) => {
868
+ const context = new FauxContext ( `
869
+ import {inject as service} from '@ember/service';
870
+ export default Controller.extend({
871
+ currentUser: foo.service.inject()
872
+ });
873
+ ` ) ;
874
+ const importName = context . ast . body [ 0 ] . specifiers [ 0 ] . local . name ;
875
+ const node = context . ast . body [ 1 ] . declaration . arguments [ 0 ] . properties [ 0 ] ;
876
+ expect ( emberUtils . isInjectedServiceProp ( node , undefined , importName ) ) . toBeFalsy ( ) ;
877
+ } ) ;
878
+
855
879
it ( "should check that it's not an injected service prop without the renamed import" , ( ) => {
856
880
const context = new FauxContext ( `
857
881
export default Controller.extend({
@@ -920,16 +944,6 @@ describe('isInjectedServiceProp', () => {
920
944
expect ( emberUtils . isInjectedServiceProp ( node , importName , undefined ) ) . toBeFalsy ( ) ;
921
945
} ) ;
922
946
923
- it ( "should check that it's not an injected service prop with foo.service.inject" , ( ) => {
924
- const context = new FauxContext ( `
925
- export default Controller.extend({
926
- currentUser: foo.service.inject()
927
- });
928
- ` ) ;
929
- const node = context . ast . body [ 0 ] . declaration . arguments [ 0 ] . properties [ 0 ] ;
930
- expect ( emberUtils . isInjectedServiceProp ( node ) ) . toBeFalsy ( ) ;
931
- } ) ;
932
-
933
947
it ( "should check that it's not an injected service prop" , ( ) => {
934
948
const context = new FauxContext ( `
935
949
export default Controller.extend({
@@ -1035,13 +1049,35 @@ describe('isInjectedControllerProp', () => {
1035
1049
} ) ;
1036
1050
1037
1051
it ( "should check if it's an injected controller prop with full import" , ( ) => {
1052
+ const context = new FauxContext ( `
1053
+ import Ember from 'ember';
1054
+ export default Controller.extend({
1055
+ application: Ember.inject.controller(),
1056
+ });
1057
+ ` ) ;
1058
+ const importName = context . ast . body [ 0 ] . specifiers [ 0 ] . local . name ;
1059
+ const node = context . ast . body [ 1 ] . declaration . arguments [ 0 ] . properties [ 0 ] ;
1060
+ expect ( emberUtils . isInjectedControllerProp ( node , importName ) ) . toBeTruthy ( ) ;
1061
+ } ) ;
1062
+
1063
+ it ( "should check if it's not an injected controller prop without full import" , ( ) => {
1038
1064
const context = new FauxContext ( `
1039
1065
export default Controller.extend({
1040
1066
application: Ember.inject.controller(),
1041
1067
});
1042
1068
` ) ;
1043
1069
const node = context . ast . body [ 0 ] . declaration . arguments [ 0 ] . properties [ 0 ] ;
1044
- expect ( emberUtils . isInjectedControllerProp ( node ) ) . toBeTruthy ( ) ;
1070
+ expect ( emberUtils . isInjectedControllerProp ( node ) ) . toBeFalsy ( ) ;
1071
+ } ) ;
1072
+
1073
+ it ( "should check if it's not an injected controller prop with foo.controller" , ( ) => {
1074
+ const context = new FauxContext ( `
1075
+ export default Controller.extend({
1076
+ application: foo.controller(),
1077
+ });
1078
+ ` ) ;
1079
+ const node = context . ast . body [ 0 ] . declaration . arguments [ 0 ] . properties [ 0 ] ;
1080
+ expect ( emberUtils . isInjectedControllerProp ( node ) ) . toBeFalsy ( ) ;
1045
1081
} ) ;
1046
1082
} ) ;
1047
1083
@@ -1194,13 +1230,25 @@ describe('isObserverProp', () => {
1194
1230
} ) ;
1195
1231
1196
1232
it ( "should check if it's an observer prop with full import" , ( ) => {
1233
+ const context = new FauxContext ( `
1234
+ import Ember from 'ember';
1235
+ export default Controller.extend({
1236
+ someObserver: Ember.observer(),
1237
+ });
1238
+ ` ) ;
1239
+ const importName = context . ast . body [ 0 ] . specifiers [ 0 ] . local . name ;
1240
+ const node = context . ast . body [ 1 ] . declaration . arguments [ 0 ] . properties [ 0 ] ;
1241
+ expect ( emberUtils . isObserverProp ( node , importName ) ) . toBeTruthy ( ) ;
1242
+ } ) ;
1243
+
1244
+ it ( "should check that it's not an observer prop without full import" , ( ) => {
1197
1245
const context = new FauxContext ( `
1198
1246
export default Controller.extend({
1199
1247
someObserver: Ember.observer(),
1200
1248
});
1201
1249
` ) ;
1202
1250
const node = context . ast . body [ 0 ] . declaration . arguments [ 0 ] . properties [ 0 ] ;
1203
- expect ( emberUtils . isObserverProp ( node ) ) . toBeTruthy ( ) ;
1251
+ expect ( emberUtils . isObserverProp ( node ) ) . toBeFalsy ( ) ;
1204
1252
} ) ;
1205
1253
1206
1254
it ( "should check if it's an observer prop with multi-line observer" , ( ) => {
0 commit comments