@@ -35,6 +35,10 @@ ruleTester.run('template-no-passed-in-event-handlers', rule, {
3535 '<template><Foo @random={{true}} /></template>' ,
3636 '<template><Input @click={{this.handleClick}} /></template>' ,
3737 '<template><Textarea @click={{this.handleClick}} /></template>' ,
38+
39+ // HTML elements are not checked (in GTS <my-button> is HTML, not a component)
40+ '<template><my-button @click={{this.handleClick}} /></template>' ,
41+ '<template><custom-el @submit={{this.handleSubmit}} /></template>' ,
3842 '<template>{{foo}}</template>' ,
3943 '<template>{{foo onClick=this.handleClick}}</template>' ,
4044 '<template>{{foo onclick=this.handleClick}}</template>' ,
@@ -48,11 +52,11 @@ ruleTester.run('template-no-passed-in-event-handlers', rule, {
4852 // ignore option — angle bracket invocation
4953 {
5054 code : '<template><Foo @click={{this.handleClick}} /></template>' ,
51- options : [ { ignore : { Foo : [ '@ click' ] } } ] ,
55+ options : [ { ignore : { Foo : [ 'click' ] } } ] ,
5256 } ,
5357 {
5458 code : '<template><Foo @click={{this.handleClick}} @submit={{this.handleSubmit}} /></template>' ,
55- options : [ { ignore : { Foo : [ '@ click' , '@ submit' ] } } ] ,
59+ options : [ { ignore : { Foo : [ 'click' , 'submit' ] } } ] ,
5660 } ,
5761
5862 // ignore option — curly invocation
@@ -81,26 +85,41 @@ ruleTester.run('template-no-passed-in-event-handlers', rule, {
8185 output : null ,
8286 errors : [ { messageId : 'unexpected' } ] ,
8387 } ,
88+ {
89+ code : '<template><Foo @click={{this.handleClick}} /></template>' ,
90+ output : null ,
91+ errors : [ { messageId : 'unexpected' } ] ,
92+ } ,
93+ {
94+ code : '<template><Foo @keyPress={{this.handleClick}} /></template>' ,
95+ output : null ,
96+ errors : [ { messageId : 'unexpected' } ] ,
97+ } ,
8498 {
8599 code : `<template>
86100 <CustomButton @mouseEnter={{this.handleHover}} />
87101 </template>` ,
88102 output : null ,
89103 errors : [ { messageId : 'unexpected' } ] ,
90104 } ,
91-
92105 {
93- code : '<template><Foo @click ={{this.handleClick}} /></template>' ,
106+ code : '<template><Foo @submit ={{this.handleClick}} /></template>' ,
94107 output : null ,
95108 errors : [ { messageId : 'unexpected' } ] ,
96109 } ,
110+ // Non-PascalCase component forms: this.-prefixed, @-prefixed, dot-path
97111 {
98- code : '<template><Foo @keyPress ={{this.handleClick}} /></template>' ,
112+ code : '<template><this.MyComponent @click ={{this.handleClick}} /></template>' ,
99113 output : null ,
100114 errors : [ { messageId : 'unexpected' } ] ,
101115 } ,
102116 {
103- code : '<template><Foo @submit={{this.handleClick}} /></template>' ,
117+ code : '<template><@someComponent @click={{this.handleClick}} /></template>' ,
118+ output : null ,
119+ errors : [ { messageId : 'unexpected' } ] ,
120+ } ,
121+ {
122+ code : '<template><ns.Widget @submit={{this.handleSubmit}} /></template>' ,
104123 output : null ,
105124 errors : [ { messageId : 'unexpected' } ] ,
106125 } ,
@@ -124,14 +143,14 @@ ruleTester.run('template-no-passed-in-event-handlers', rule, {
124143 {
125144 code : '<template><Bar @click={{this.handleClick}} /></template>' ,
126145 output : null ,
127- options : [ { ignore : { Foo : [ '@ click' ] } } ] ,
146+ options : [ { ignore : { Foo : [ 'click' ] } } ] ,
128147 errors : [ { messageId : 'unexpected' } ] ,
129148 } ,
130149 // ignore option — only ignores specified attrs (angle bracket)
131150 {
132151 code : '<template><Foo @submit={{this.handleSubmit}} /></template>' ,
133152 output : null ,
134- options : [ { ignore : { Foo : [ '@ click' ] } } ] ,
153+ options : [ { ignore : { Foo : [ 'click' ] } } ] ,
135154 errors : [ { messageId : 'unexpected' } ] ,
136155 } ,
137156 // ignore option — only ignores specified component (curly)
@@ -183,11 +202,11 @@ hbsRuleTester.run('template-no-passed-in-event-handlers', rule, {
183202 // ignore option — angle bracket invocation
184203 {
185204 code : '<Foo @click={{this.handleClick}} />' ,
186- options : [ { ignore : { Foo : [ '@ click' ] } } ] ,
205+ options : [ { ignore : { Foo : [ 'click' ] } } ] ,
187206 } ,
188207 {
189208 code : '<Foo @click={{this.handleClick}} @submit={{this.handleSubmit}} />' ,
190- options : [ { ignore : { Foo : [ '@ click' , '@ submit' ] } } ] ,
209+ options : [ { ignore : { Foo : [ 'click' , 'submit' ] } } ] ,
191210 } ,
192211
193212 // ignore option — curly invocation
@@ -266,14 +285,14 @@ hbsRuleTester.run('template-no-passed-in-event-handlers', rule, {
266285 {
267286 code : '<Bar @click={{this.handleClick}} />' ,
268287 output : null ,
269- options : [ { ignore : { Foo : [ '@ click' ] } } ] ,
288+ options : [ { ignore : { Foo : [ 'click' ] } } ] ,
270289 errors : [ { messageId : 'unexpected' } ] ,
271290 } ,
272291 // ignore option — only ignores specified attrs (angle bracket)
273292 {
274293 code : '<Foo @submit={{this.handleSubmit}} />' ,
275294 output : null ,
276- options : [ { ignore : { Foo : [ '@ click' ] } } ] ,
295+ options : [ { ignore : { Foo : [ 'click' ] } } ] ,
277296 errors : [ { messageId : 'unexpected' } ] ,
278297 } ,
279298 // ignore option — only ignores specified component (curly)
0 commit comments