@@ -3,9 +3,9 @@ import { test, expect } from "@playwright/test";
3
3
import { createFixture , js } from "./helpers/create-fixture" ;
4
4
import type { Fixture } from "./helpers/create-fixture" ;
5
5
6
- test . describe ( "rendering" , ( ) => {
7
- let fixture : Fixture ;
6
+ let fixture : Fixture ;
8
7
8
+ test . describe ( "rendering" , ( ) => {
9
9
let ROOT_$ = "FLAT" ;
10
10
let ROOT_INDEX = "ROOT_INDEX" ;
11
11
let FLAT_$ = "FLAT" ;
@@ -128,3 +128,105 @@ test.describe("rendering", () => {
128
128
expect ( await res . text ( ) ) . toMatch ( PARENTLESS_$ ) ;
129
129
} ) ;
130
130
} ) ;
131
+
132
+ test . describe ( "root splat route without index" , ( ) => {
133
+ test ( "matches routes correctly (v1)" , async ( { page } ) => {
134
+ fixture = await createFixture ( {
135
+ future : { v2_routeConvention : false } ,
136
+ files : {
137
+ "app/routes/$.jsx" : js `
138
+ export default function Component() {
139
+ return <h1>Hello Splat</h1>
140
+ }
141
+ ` ,
142
+ } ,
143
+ } ) ;
144
+
145
+ let res = await fixture . requestDocument ( "/" ) ;
146
+ expect ( await res . text ( ) ) . toMatch ( "Hello Splat" ) ;
147
+
148
+ res = await fixture . requestDocument ( "/splat" ) ;
149
+ expect ( await res . text ( ) ) . toMatch ( "Hello Splat" ) ;
150
+
151
+ res = await fixture . requestDocument ( "/splat/deep/path" ) ;
152
+ expect ( await res . text ( ) ) . toMatch ( "Hello Splat" ) ;
153
+ } ) ;
154
+
155
+ test ( "matches routes correctly (v2)" , async ( { page } ) => {
156
+ fixture = await createFixture ( {
157
+ future : { v2_routeConvention : true } ,
158
+ files : {
159
+ "app/routes/$.jsx" : js `
160
+ export default function Component() {
161
+ return <h1>Hello Splat</h1>
162
+ }
163
+ ` ,
164
+ } ,
165
+ } ) ;
166
+
167
+ let res = await fixture . requestDocument ( "/" ) ;
168
+ expect ( await res . text ( ) ) . toMatch ( "Hello Splat" ) ;
169
+
170
+ res = await fixture . requestDocument ( "/splat" ) ;
171
+ expect ( await res . text ( ) ) . toMatch ( "Hello Splat" ) ;
172
+
173
+ res = await fixture . requestDocument ( "/splat/deep/path" ) ;
174
+ expect ( await res . text ( ) ) . toMatch ( "Hello Splat" ) ;
175
+ } ) ;
176
+ } ) ;
177
+
178
+ test . describe ( "root splat route with index" , ( ) => {
179
+ test ( "matches routes correctly (v1)" , async ( { page } ) => {
180
+ fixture = await createFixture ( {
181
+ future : { v2_routeConvention : false } ,
182
+ files : {
183
+ "app/routes/index.jsx" : js `
184
+ export default function Component() {
185
+ return <h1>Hello Index</h1>
186
+ }
187
+ ` ,
188
+ "app/routes/$.jsx" : js `
189
+ export default function Component() {
190
+ return <h1>Hello Splat</h1>
191
+ }
192
+ ` ,
193
+ } ,
194
+ } ) ;
195
+
196
+ let res = await fixture . requestDocument ( "/" ) ;
197
+ expect ( await res . text ( ) ) . toMatch ( "Hello Index" ) ;
198
+
199
+ res = await fixture . requestDocument ( "/splat" ) ;
200
+ expect ( await res . text ( ) ) . toMatch ( "Hello Splat" ) ;
201
+
202
+ res = await fixture . requestDocument ( "/splat/deep/path" ) ;
203
+ expect ( await res . text ( ) ) . toMatch ( "Hello Splat" ) ;
204
+ } ) ;
205
+
206
+ test ( "matches routes correctly (v2)" , async ( { page } ) => {
207
+ fixture = await createFixture ( {
208
+ future : { v2_routeConvention : true } ,
209
+ files : {
210
+ "app/routes/_index.jsx" : js `
211
+ export default function Component() {
212
+ return <h1>Hello Index</h1>
213
+ }
214
+ ` ,
215
+ "app/routes/$.jsx" : js `
216
+ export default function Component() {
217
+ return <h1>Hello Splat</h1>
218
+ }
219
+ ` ,
220
+ } ,
221
+ } ) ;
222
+
223
+ let res = await fixture . requestDocument ( "/" ) ;
224
+ expect ( await res . text ( ) ) . toMatch ( "Hello Index" ) ;
225
+
226
+ res = await fixture . requestDocument ( "/splat" ) ;
227
+ expect ( await res . text ( ) ) . toMatch ( "Hello Splat" ) ;
228
+
229
+ res = await fixture . requestDocument ( "/splat/deep/path" ) ;
230
+ expect ( await res . text ( ) ) . toMatch ( "Hello Splat" ) ;
231
+ } ) ;
232
+ } ) ;
0 commit comments