Skip to content

Commit 07a2913

Browse files
committed
Merge branch 'route-relative' into markdown-links
2 parents c098bd8 + d1cdd80 commit 07a2913

File tree

3 files changed

+19
-16
lines changed

3 files changed

+19
-16
lines changed

commitlint.config.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ const packages = getSubDirectories(path.resolve(__dirname, 'packages'))
1111
export default {
1212
extends: ['@commitlint/config-conventional'],
1313
rules: {
14-
'scope-enum': [2, 'always', packages],
14+
'scope-enum': [2, 'always', [...packages, 'e2e']],
1515
'footer-max-line-length': [0],
1616
},
1717
} satisfies UserConfig

e2e/tests/components/route-link.cy.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ it('RouteLink', () => {
7878
cy.wrap(el).within(() => {
7979
cy.get('a')
8080
.children()
81-
.should('have.lengthOf', (index + 1) % 2)
81+
.should('have.lengthOf', (index % 2) + 1)
8282
.each((el) => {
8383
cy.wrap(el).contains('span', 'text')
8484
})

packages/shared/tests/normalizeRoutePath.spec.ts

Lines changed: 17 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { describe, expect, it } from 'vitest'
22
import { normalizeRoutePath } from '../src/index.js'
33

44
const testCases = [
5-
// index
5+
// absolute index
66
['/', '/'],
77
['/README.md', '/'],
88
['/readme.md', '/'],
@@ -15,37 +15,37 @@ const testCases = [
1515
['/foo/index.md', '/foo/'],
1616
['/foo/index.html', '/foo/'],
1717
['/foo/index', '/foo/'],
18-
['', ''],
1918
['README.md', 'index.html'],
2019
['readme.md', 'index.html'],
2120
['index.md', 'index.html'],
2221
['index.html', 'index.html'],
2322
['index', 'index.html'],
24-
['foo/', 'foo/'],
25-
['foo/README.md', 'foo/'],
26-
['foo/readme.md', 'foo/'],
27-
['foo/index.md', 'foo/'],
28-
['foo/index.html', 'foo/'],
29-
['foo/index', 'foo/'],
3023

31-
// non-index
24+
// absolute non-index
3225
['/foo', '/foo.html'],
3326
['/foo.md', '/foo.html'],
3427
['/foo.html', '/foo.html'],
3528
['/foo/bar', '/foo/bar.html'],
3629
['/foo/bar.md', '/foo/bar.html'],
3730
['/foo/bar.html', '/foo/bar.html'],
31+
32+
// relative index without current
33+
['foo/', 'foo/'],
34+
['foo/README.md', 'foo/'],
35+
['foo/readme.md', 'foo/'],
36+
['foo/index.md', 'foo/'],
37+
['foo/index.html', 'foo/'],
38+
['foo/index', 'foo/'],
39+
40+
// relative non index without current
3841
['foo', 'foo.html'],
3942
['foo.md', 'foo.html'],
4043
['foo.html', 'foo.html'],
4144
['foo/bar', 'foo/bar.html'],
4245
['foo/bar.md', 'foo/bar.html'],
4346
['foo/bar.html', 'foo/bar.html'],
4447

45-
// only hash and query
46-
['', ''],
47-
48-
// relative non index
48+
// relative non index with current
4949
['foo', '/foo.html', '/'],
5050
['foo', '/foo.html', '/a.html'],
5151
['foo', '/foo.html', '/index.html'],
@@ -137,7 +137,7 @@ const testCases = [
137137
['../foo/bar.html', '/foo/bar.html', '/a/index.html'],
138138
['../foo/bar.html', '/foo/bar.html', '/a/b.html'],
139139

140-
// absolute non index
140+
// absolute non index with current
141141
['/foo', '/foo.html', '/'],
142142
['/foo', '/foo.html', '/a.html'],
143143
['/foo', '/foo.html', '/index.html'],
@@ -175,6 +175,9 @@ const testCases = [
175175
['/foo/bar.html', '/foo/bar.html', '/a/index.html'],
176176
['/foo/bar.html', '/foo/bar.html', '/a/b.html'],
177177

178+
// only hash and query
179+
['', ''],
180+
178181
// unexpected corner cases
179182
['.md', '.html'],
180183
['foo/.md', 'foo/.html'],

0 commit comments

Comments
 (0)