Skip to content

Commit fedb497

Browse files
Merge pull request #21532 from johanrd/passing-test-gh18608
Passing test for #18608
2 parents aa1b0e7 + 0f413a4 commit fedb497

1 file changed

Lines changed: 37 additions & 0 deletions

File tree

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
import { moduleFor, ApplicationTestCase } from 'internal-test-helpers';
2+
3+
moduleFor(
4+
'Router: explicitly declared index routes (GH#18608)',
5+
class extends ApplicationTestCase {
6+
async ['@test an explicitly declared index route defaults to path "/index", so the parent URL does not match'](
7+
assert
8+
) {
9+
this.router.map(function () {
10+
this.route('secure', function () {
11+
this.route('cluster', { path: '/clusters/:cluster_id' }, function () {
12+
this.route('index');
13+
this.route('details');
14+
});
15+
});
16+
});
17+
18+
await assert.rejects(this.visit('/secure/clusters/100'), /\/secure\/clusters\/100/);
19+
}
20+
21+
async ['@test an explicitly declared index route with path "/" matches the parent URL'](
22+
assert
23+
) {
24+
this.router.map(function () {
25+
this.route('secure', function () {
26+
this.route('cluster', { path: '/clusters/:cluster_id' }, function () {
27+
this.route('index', { path: '/' });
28+
this.route('details');
29+
});
30+
});
31+
});
32+
33+
await this.visit('/secure/clusters/100');
34+
assert.equal(this.appRouter.currentURL, '/secure/clusters/100');
35+
}
36+
}
37+
);

0 commit comments

Comments
 (0)