Skip to content

Commit

Permalink
chore: format
Browse files Browse the repository at this point in the history
formatted 99fd78e
  • Loading branch information
remix-run-bot committed Feb 28, 2022
1 parent 99fd78e commit 53a04c5
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 13 deletions.
2 changes: 1 addition & 1 deletion packages/react-router-dom/index.tsx
Expand Up @@ -103,7 +103,7 @@ export type {
RouterProps,
Pathname,
Search,
RoutesProps
RoutesProps,
} from "react-router";

///////////////////////////////////////////////////////////////////////////////
Expand Down
Expand Up @@ -108,7 +108,7 @@ describe("Descendant <Routes> splat matching", () => {

it("allows `-` to appear at the beginning", () => {
let renderer = renderNestedSplatRoute([
"/courses/react/-react-fundamentals"
"/courses/react/-react-fundamentals",
]);
expect(renderer.toJSON()).toMatchInlineSnapshot(`
<div>
Expand All @@ -134,7 +134,7 @@ describe("Descendant <Routes> splat matching", () => {
});
it("allows `.` to appear at the beginning", () => {
let renderer = renderNestedSplatRoute([
"/courses/react/.react-fundamentals"
"/courses/react/.react-fundamentals",
]);
expect(renderer.toJSON()).toMatchInlineSnapshot(`
<div>
Expand All @@ -160,7 +160,7 @@ describe("Descendant <Routes> splat matching", () => {
});
it("allows `~` to appear at the beginning", () => {
let renderer = renderNestedSplatRoute([
"/courses/react/~react-fundamentals"
"/courses/react/~react-fundamentals",
]);
expect(renderer.toJSON()).toMatchInlineSnapshot(`
<div>
Expand All @@ -186,7 +186,7 @@ describe("Descendant <Routes> splat matching", () => {
});
it("allows url-encoded entities to appear at the beginning", () => {
let renderer = renderNestedSplatRoute([
"/courses/react/%20react-fundamentals"
"/courses/react/%20react-fundamentals",
]);
expect(renderer.toJSON()).toMatchInlineSnapshot(`
<div>
Expand Down
12 changes: 7 additions & 5 deletions packages/react-router/__tests__/path-matching-test.tsx
Expand Up @@ -244,25 +244,27 @@ describe("path matching with splats", () => {
});

test("nested routes with partial matching", () => {
let routes = [{ path: '/', children: [{ path: 'courses', children: [{ path: '*' }] }] }];
let match = matchRoutes(routes, "/courses/abc")
let routes = [
{ path: "/", children: [{ path: "courses", children: [{ path: "*" }] }] },
];
let match = matchRoutes(routes, "/courses/abc");

expect(match).not.toBeNull();
expect(match).toHaveLength(3);
expect(match[0]).toMatchObject({
params: { "*": "abc" },
pathname: "/",
pathnameBase: "/"
pathnameBase: "/",
});
expect(match[1]).toMatchObject({
params: { "*": "abc" },
pathname: "/courses",
pathnameBase: "/courses"
pathnameBase: "/courses",
});
expect(match[2]).toMatchObject({
params: { "*": "abc" },
pathname: "/courses/abc",
pathnameBase: "/courses"
pathnameBase: "/courses",
});
});
});
8 changes: 5 additions & 3 deletions packages/react-router/index.tsx
Expand Up @@ -8,13 +8,13 @@ import type {
Path,
Pathname,
Search,
To
To,
} from "history";
import {
Action as NavigationType,
createMemoryHistory,
parsePath,
createPath
createPath,
} from "history";

export { parsePath, createPath, NavigationType };
Expand Down Expand Up @@ -1044,7 +1044,9 @@ function matchRouteBranch<ParamKey extends string = string>(
matches.push({
params: matchedParams,
pathname: joinPaths([matchedPathname, match.pathname]),
pathnameBase: normalizePathname(joinPaths([matchedPathname, match.pathnameBase])),
pathnameBase: normalizePathname(
joinPaths([matchedPathname, match.pathnameBase])
),
route,
});

Expand Down

0 comments on commit 53a04c5

Please sign in to comment.