@@ -47,6 +47,31 @@ ruleTester.run('template-no-array-prototype-extensions', rule, {
4747 output : '<template>{{get @model "items.0.name"}}</template>' ,
4848 errors : [ { messageId : 'firstObject' } ] ,
4949 } ,
50+ // firstObject — in hash argument context
51+ {
52+ code : '<template>{{foo bar=this.list.firstObject}}</template>' ,
53+ output : '<template>{{foo bar=(get this.list "0")}}</template>' ,
54+ errors : [ { messageId : 'firstObject' } ] ,
55+ } ,
56+ // firstObject — @arg prefix path
57+ {
58+ code : '<template><Foo @bar={{@list.firstObject}} /></template>' ,
59+ output : '<template><Foo @bar={{get @list "0"}} /></template>' ,
60+ errors : [ { messageId : 'firstObject' } ] ,
61+ } ,
62+ // firstObject — deeper path with trailing properties
63+ {
64+ code : '<template><Foo @bar={{this.list.firstObject.name.foo}} /></template>' ,
65+ output : '<template><Foo @bar={{get this.list "0.name.foo"}} /></template>' ,
66+ errors : [ { messageId : 'firstObject' } ] ,
67+ } ,
68+ // firstObject — subexpression param context
69+ {
70+ code : '<template><div data-test={{eq this.list.firstObject.abc "def"}}>Hello</div></template>' ,
71+ output :
72+ '<template><div data-test={{eq (get this.list "0.abc") "def"}}>Hello</div></template>' ,
73+ errors : [ { messageId : 'firstObject' } ] ,
74+ } ,
5075 // lastObject — no fix available
5176 {
5277 code : '<template>{{this.users.lastObject}}</template>' ,
0 commit comments