@@ -44,6 +44,26 @@ ruleTester.run('template-no-passed-in-event-handlers', rule, {
4444 '<template>{{foo random=true}}</template>' ,
4545 '<template>{{input click=this.handleClick}}</template>' ,
4646 '<template>{{textarea click=this.handleClick}}</template>' ,
47+
48+ // ignore option — angle bracket invocation
49+ {
50+ code : '<template><Foo @click={{this.handleClick}} /></template>' ,
51+ options : [ { ignore : { Foo : [ '@click' ] } } ] ,
52+ } ,
53+ {
54+ code : '<template><Foo @click={{this.handleClick}} @submit={{this.handleSubmit}} /></template>' ,
55+ options : [ { ignore : { Foo : [ '@click' , '@submit' ] } } ] ,
56+ } ,
57+
58+ // ignore option — curly invocation
59+ {
60+ code : '<template>{{foo click=this.handleClick}}</template>' ,
61+ options : [ { ignore : { foo : [ 'click' ] } } ] ,
62+ } ,
63+ {
64+ code : '<template>{{foo click=this.handleClick submit=this.handleSubmit}}</template>' ,
65+ options : [ { ignore : { foo : [ 'click' , 'submit' ] } } ] ,
66+ } ,
4767 ] ,
4868
4969 invalid : [
@@ -99,6 +119,35 @@ ruleTester.run('template-no-passed-in-event-handlers', rule, {
99119 output : null ,
100120 errors : [ { messageId : 'unexpected' } ] ,
101121 } ,
122+
123+ // ignore option — only ignores specified component (angle bracket)
124+ {
125+ code : '<template><Bar @click={{this.handleClick}} /></template>' ,
126+ options : [ { ignore : { Foo : [ '@click' ] } } ] ,
127+ output : null ,
128+ errors : [ { messageId : 'unexpected' } ] ,
129+ } ,
130+ // ignore option — only ignores specified attrs (angle bracket)
131+ {
132+ code : '<template><Foo @submit={{this.handleSubmit}} /></template>' ,
133+ options : [ { ignore : { Foo : [ '@click' ] } } ] ,
134+ output : null ,
135+ errors : [ { messageId : 'unexpected' } ] ,
136+ } ,
137+ // ignore option — only ignores specified component (curly)
138+ {
139+ code : '<template>{{bar click=this.handleClick}}</template>' ,
140+ options : [ { ignore : { foo : [ 'click' ] } } ] ,
141+ output : null ,
142+ errors : [ { messageId : 'unexpected' } ] ,
143+ } ,
144+ // ignore option — only ignores specified attrs (curly)
145+ {
146+ code : '<template>{{foo submit=this.handleSubmit}}</template>' ,
147+ options : [ { ignore : { foo : [ 'click' ] } } ] ,
148+ output : null ,
149+ errors : [ { messageId : 'unexpected' } ] ,
150+ } ,
102151 ] ,
103152} ) ;
104153
@@ -130,6 +179,26 @@ hbsRuleTester.run('template-no-passed-in-event-handlers', rule, {
130179 '{{foo random=true}}' ,
131180 '{{input click=this.handleClick}}' ,
132181 '{{textarea click=this.handleClick}}' ,
182+
183+ // ignore option — angle bracket invocation
184+ {
185+ code : '<Foo @click={{this.handleClick}} />' ,
186+ options : [ { ignore : { Foo : [ '@click' ] } } ] ,
187+ } ,
188+ {
189+ code : '<Foo @click={{this.handleClick}} @submit={{this.handleSubmit}} />' ,
190+ options : [ { ignore : { Foo : [ '@click' , '@submit' ] } } ] ,
191+ } ,
192+
193+ // ignore option — curly invocation
194+ {
195+ code : '{{foo click=this.handleClick}}' ,
196+ options : [ { ignore : { foo : [ 'click' ] } } ] ,
197+ } ,
198+ {
199+ code : '{{foo click=this.handleClick submit=this.handleSubmit}}' ,
200+ options : [ { ignore : { foo : [ 'click' , 'submit' ] } } ] ,
201+ } ,
133202 ] ,
134203 invalid : [
135204 {
@@ -192,5 +261,34 @@ hbsRuleTester.run('template-no-passed-in-event-handlers', rule, {
192261 } ,
193262 ] ,
194263 } ,
264+
265+ // ignore option — only ignores specified component (angle bracket)
266+ {
267+ code : '<Bar @click={{this.handleClick}} />' ,
268+ options : [ { ignore : { Foo : [ '@click' ] } } ] ,
269+ output : null ,
270+ errors : [ { messageId : 'unexpected' } ] ,
271+ } ,
272+ // ignore option — only ignores specified attrs (angle bracket)
273+ {
274+ code : '<Foo @submit={{this.handleSubmit}} />' ,
275+ options : [ { ignore : { Foo : [ '@click' ] } } ] ,
276+ output : null ,
277+ errors : [ { messageId : 'unexpected' } ] ,
278+ } ,
279+ // ignore option — only ignores specified component (curly)
280+ {
281+ code : '{{bar click=this.handleClick}}' ,
282+ options : [ { ignore : { foo : [ 'click' ] } } ] ,
283+ output : null ,
284+ errors : [ { messageId : 'unexpected' } ] ,
285+ } ,
286+ // ignore option — only ignores specified attrs (curly)
287+ {
288+ code : '{{foo submit=this.handleSubmit}}' ,
289+ options : [ { ignore : { foo : [ 'click' ] } } ] ,
290+ output : null ,
291+ errors : [ { messageId : 'unexpected' } ] ,
292+ } ,
195293 ] ,
196294} ) ;
0 commit comments