11import { expect , fixture , html } from '@open-wc/testing'
2- import { attr , Attrable } from '../src/attr.js'
3- import { use } from '../src/use .js'
2+ import { attr } from '../src/attr.js'
3+ import { controller } from '../src/controller .js'
44
55describe ( 'Attrable' , ( ) => {
6- @use ( Attrable )
6+ @controller
7+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
78 class InitializeAttrTest extends HTMLElement {
89 @attr foo = 'hello'
910 bar = 1
@@ -20,7 +21,6 @@ describe('Attrable', () => {
2021 this . #baz = value
2122 }
2223 }
23- window . customElements . define ( 'initialize-attr-test' , InitializeAttrTest )
2424
2525 let instance
2626 beforeEach ( async ( ) => {
@@ -100,11 +100,11 @@ describe('Attrable', () => {
100100
101101 describe ( 'types' , ( ) => {
102102 it ( 'infers number types from property and casts as number always' , async ( ) => {
103- @use ( Attrable )
103+ @controller
104+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
104105 class NumberAttrTest extends HTMLElement {
105106 @attr foo = 1
106107 }
107- window . customElements . define ( 'number-attr-test' , NumberAttrTest )
108108 instance = await fixture ( html `< number-attr-test /> ` )
109109
110110 expect ( instance ) . to . have . property ( 'foo' , 1 )
@@ -126,11 +126,11 @@ describe('Attrable', () => {
126126 } )
127127
128128 it ( 'infers boolean types from property and uses has/toggleAttribute' , async ( ) => {
129- @use ( Attrable )
129+ @controller
130+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
130131 class BooleanAttrTest extends HTMLElement {
131132 @attr foo = false
132133 }
133- window . customElements . define ( 'boolean-attr-test' , BooleanAttrTest )
134134
135135 instance = await fixture ( html `< boolean-attr-test /> ` )
136136
@@ -159,11 +159,11 @@ describe('Attrable', () => {
159159
160160 it ( 'defaults to inferring string type for non-boolean non-number types' , async ( ) => {
161161 const regexp = / ^ a r e g e x p $ /
162- @use ( Attrable )
162+ @controller
163+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
163164 class RegExpAttrTest extends HTMLElement {
164165 @attr foo = regexp
165166 }
166- window . customElements . define ( 'reg-exp-attr-test' , RegExpAttrTest )
167167 instance = await fixture ( html `< reg-exp-attr-test /> ` )
168168
169169 expect ( instance ) . to . have . property ( 'foo' , '/^a regexp$/' )
@@ -178,7 +178,8 @@ describe('Attrable', () => {
178178
179179 it ( 'defers to custom set logic if present' , async ( ) => {
180180 const regexp = / ^ a r e g e x p $ /
181- @use ( Attrable )
181+ @controller
182+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
182183 class RegExpCastAttrTest extends HTMLElement {
183184 #reg = regexp
184185 @attr
@@ -189,7 +190,6 @@ describe('Attrable', () => {
189190 this . #reg = value instanceof RegExp ? value : new RegExp ( String ( value ) . replace ( / ^ \/ | \/ $ / g, '' ) )
190191 }
191192 }
192- window . customElements . define ( 'reg-exp-cast-attr-test' , RegExpCastAttrTest )
193193 instance = await fixture ( html `< reg-exp-cast-attr-test /> ` )
194194
195195 expect ( instance ) . to . have . property ( 'foo' , regexp )
@@ -200,7 +200,8 @@ describe('Attrable', () => {
200200 } )
201201
202202 it ( 'avoids infinite loops' , async ( ) => {
203- @use ( Attrable )
203+ @controller
204+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
204205 class LoopAttrTest extends HTMLElement {
205206 count = 0
206207 @attr
@@ -211,7 +212,6 @@ describe('Attrable', () => {
211212 this . count += 1
212213 }
213214 }
214- window . customElements . define ( 'loop-attr-test' , LoopAttrTest )
215215 instance = await fixture ( html `< loop-attr-test /> ` )
216216
217217 expect ( instance ) . to . have . property ( 'foo' )
@@ -223,13 +223,13 @@ describe('Attrable', () => {
223223 } )
224224
225225 describe ( 'naming' , ( ) => {
226- @use ( Attrable )
226+ @controller
227+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
227228 class NamingAttrTest extends HTMLElement {
228229 @attr fooBarBazBing = 'a'
229230 @attr URLBar = 'b'
230231 @attr ClipX = 'c'
231232 }
232- window . customElements . define ( 'naming-attr-test' , NamingAttrTest )
233233
234234 beforeEach ( async ( ) => {
235235 instance = await fixture ( html `< naming-attr-test /> ` )
0 commit comments