1- import { TrackedArray } from '@glimmer/validator' ;
1+ import { trackedArray } from '@glimmer/validator' ;
2+ import type { Dict , Owner } from '@glimmer/interfaces' ;
23import {
34 GlimmerishComponent as Component ,
45 jitSuite ,
@@ -42,13 +43,13 @@ const ARRAY_SETTER_METHODS = [
4243] ;
4344
4445class TrackedArrayTest extends RenderTest {
45- static suiteName = `TrackedArray (rendering)` ;
46+ static suiteName = `trackedArray() (rendering)` ;
4647
4748 @test
4849 'getting and setting an index' ( ) {
4950 this . assertReactivity (
5051 class extends Component {
51- arr = new TrackedArray ( [ 'foo' ] ) ;
52+ arr = trackedArray ( [ 'foo' ] ) ;
5253
5354 get value ( ) {
5455 return this . arr [ 0 ] ;
@@ -65,10 +66,10 @@ class TrackedArrayTest extends RenderTest {
6566 'Can push into a newly created TrackedArray during construction' ( ) {
6667 this . assertReactivity (
6768 class extends Component {
68- arr = new TrackedArray < string > ( ) ;
69+ arr = trackedArray ( ) ;
6970
70- constructor ( ... args : unknown [ ] ) {
71- super ( ... args ) ;
71+ constructor ( owner : Owner , args : Dict ) {
72+ super ( owner , args ) ;
7273 this . arr . push ( 'hello' ) ;
7374 }
7475
@@ -87,10 +88,10 @@ class TrackedArrayTest extends RenderTest {
8788 'Can unshift into a newly created TrackedArray during construction' ( ) {
8889 this . assertReactivity (
8990 class extends Component {
90- arr = new TrackedArray < string > ( ) ;
91+ arr = trackedArray ( ) ;
9192
92- constructor ( ... args : unknown [ ] ) {
93- super ( ... args ) ;
93+ constructor ( owner : Owner , args : Dict ) {
94+ super ( owner , args ) ;
9495 this . arr . unshift ( 'hello' ) ;
9596 }
9697
@@ -109,7 +110,7 @@ class TrackedArrayTest extends RenderTest {
109110 '{{each}} works with new items' ( ) {
110111 this . assertEachReactivity (
111112 class extends Component {
112- collection = new TrackedArray ( [ 1 , 2 , 3 ] ) ;
113+ collection = trackedArray ( [ 1 , 2 , 3 ] ) ;
113114
114115 update ( ) {
115116 this . collection . push ( 4 ) ;
@@ -122,7 +123,7 @@ class TrackedArrayTest extends RenderTest {
122123 '{{each}} works when updating old items' ( ) {
123124 this . assertEachReactivity (
124125 class extends Component {
125- collection = new TrackedArray ( [ 1 , 2 , 3 ] ) ;
126+ collection = trackedArray ( [ 1 , 2 , 3 ] ) ;
126127
127128 update ( ) {
128129 this . collection [ 2 ] = 5 ;
@@ -135,7 +136,7 @@ class TrackedArrayTest extends RenderTest {
135136 '{{each-in}} works with new items' ( ) {
136137 this . assertEachInReactivity (
137138 class extends Component {
138- collection = new TrackedArray ( [ 1 , 2 , 3 ] ) ;
139+ collection = trackedArray ( [ 1 , 2 , 3 ] ) ;
139140
140141 update ( ) {
141142 this . collection . push ( 4 ) ;
@@ -148,7 +149,7 @@ class TrackedArrayTest extends RenderTest {
148149 '{{each-in}} works when updating old items' ( ) {
149150 this . assertEachInReactivity (
150151 class extends Component {
151- collection = new TrackedArray ( [ 1 , 2 , 3 ] ) ;
152+ collection = trackedArray ( [ 1 , 2 , 3 ] ) ;
152153
153154 update ( ) {
154155 this . collection [ 2 ] = 5 ;
@@ -162,7 +163,7 @@ class TrackedArrayTest extends RenderTest {
162163 ARRAY_GETTER_METHODS . forEach ( ( method ) => {
163164 this . assertReactivity (
164165 class extends Component {
165- arr = new TrackedArray ( [ 'foo' , 'bar' ] ) ;
166+ arr = trackedArray ( [ 'foo' , 'bar' ] ) ;
166167
167168 get value ( ) {
168169 // @ts -expect-error -- this can't be represented easily in TS, and we
@@ -182,7 +183,7 @@ class TrackedArrayTest extends RenderTest {
182183
183184 this . assertReactivity (
184185 class extends Component {
185- arr = new TrackedArray ( [ 'foo' , 'bar' ] ) ;
186+ arr = trackedArray ( [ 'foo' , 'bar' ] ) ;
186187
187188 get value ( ) {
188189 // @ts -expect-error -- this can't be represented easily in TS, and we
@@ -207,7 +208,7 @@ class TrackedArrayTest extends RenderTest {
207208 ARRAY_SETTER_METHODS . forEach ( ( method ) => {
208209 this . assertReactivity (
209210 class extends Component {
210- arr = new TrackedArray ( [ 'foo' , 'bar' ] ) ;
211+ arr = trackedArray ( [ 'foo' , 'bar' ] ) ;
211212
212213 get value ( ) {
213214 return this . arr [ 0 ] ;
@@ -225,7 +226,7 @@ class TrackedArrayTest extends RenderTest {
225226
226227 this . assertReactivity (
227228 class extends Component {
228- arr = new TrackedArray ( [ 'foo' , 'bar' ] ) ;
229+ arr = trackedArray ( [ 'foo' , 'bar' ] ) ;
229230
230231 get value ( ) {
231232 return void this . arr . forEach ( ( ) => {
0 commit comments