-
Notifications
You must be signed in to change notification settings - Fork 53
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'dev' into update-itin-body-and-focus-trap
- Loading branch information
Showing
2 changed files
with
24 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import '../../test-utils/mock-window-url' | ||
|
||
import { isSubpath } from '../../../lib/components/util/link' | ||
|
||
describe('components > util > Link > isSubpath', () => { | ||
it('should be true on a path that starts with the tracked path', () => { | ||
expect(isSubpath('/', '/')).toBeTruthy() | ||
expect(isSubpath('/trips', '/trips')).toBeTruthy() | ||
expect(isSubpath('/trips/trip123', '/trips')).toBeTruthy() | ||
}) | ||
it('should be false on a path that starts differently than the tracked path', () => { | ||
expect(isSubpath('/trips/trip123', '/route')).toBeFalsy() | ||
expect(isSubpath('/', '/route')).toBeFalsy() | ||
}) | ||
it('should be false if tracking home (/) and on a path that is not home.', () => { | ||
expect(isSubpath('/trips/trip123', '/')).toBeFalsy() | ||
}) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters