File tree Expand file tree Collapse file tree 2 files changed +9
-10
lines changed Expand file tree Collapse file tree 2 files changed +9
-10
lines changed Original file line number Diff line number Diff line change 4
4
* @returns {string }
5
5
*/
6
6
export function makeExactMatcher ( matcher ) {
7
- const matcherWithBeginningOfInput = matcher . startsWith ( '^' )
8
- ? matcher
9
- : `^${ matcher } ` ;
7
+ const matcherWithBeginningOfInput =
8
+ matcher . slice ( 0 , 1 ) === '^' ? matcher : `^${ matcher } ` ;
10
9
11
10
const matcherWithBeginningAndEndOfInput =
12
- matcherWithBeginningOfInput . endsWith ( '$' )
11
+ matcherWithBeginningOfInput . slice ( - 1 ) === '$'
13
12
? matcherWithBeginningOfInput
14
13
: `${ matcherWithBeginningOfInput } $` ;
15
14
Original file line number Diff line number Diff line change 2
2
* Navigate to a specific route in the site
3
3
* @param {import('playwright-core').Page } page the playwright page instance from the test
4
4
* @param {string } route the route you want to navigate to
5
- * @param {Object } opts additional options (optional)
6
- * @param {'hash' | 'history' } opts.routerMode which router mode to use. Defaults to "hash"
7
5
*/
8
6
9
- async function navigateToRoute ( page , route , { routerMode = 'hash' } = { } ) {
10
- if ( routerMode === 'hash' ) {
11
- await page . evaluate ( r => ( window . location . hash = r ) , route ) ;
12
- } else {
7
+ async function navigateToRoute ( page , route ) {
8
+ const routerMode = await page . evaluate ( ( ) => window . $docsify . routerMode ) ;
9
+
10
+ if ( routerMode === 'history' ) {
13
11
await page . evaluate ( r => window . history . pushState ( { key : r } , '' , r ) ) ;
12
+ } else {
13
+ await page . evaluate ( r => ( window . location . hash = r ) , route ) ;
14
14
}
15
15
16
16
await page . waitForLoadState ( 'networkidle' ) ;
You can’t perform that action at this time.
0 commit comments