Skip to content

Commit ba261cc

Browse files
committed
Merge branch 'release-next'
2 parents 1d3cbad + 6fd7437 commit ba261cc

File tree

108 files changed

+2965
-6471
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

108 files changed

+2965
-6471
lines changed

.eslintignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
**/build/
22
**/tests/__snapshots/
33
**/node_modules/
4-
!.eslintrc.js
54
.tmp
65
/playground
76
**/__tests__/fixtures
87
**/__tests__/**/*/fixtures
8+
/packages/*/dist/
99

1010
# Deno
1111
integration/helpers/deno-template

.eslintrc.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,4 +24,8 @@ module.exports = {
2424
},
2525
},
2626
],
27+
// Report unused `eslint-disable` comments.
28+
reportUnusedDisableDirectives: true,
29+
// Tell ESLint not to ignore dot-files, which are ignored by default.
30+
ignorePatterns: ["!.*.js"],
2731
};

contributors.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -159,6 +159,7 @@
159159
- guatedude2
160160
- guerra08
161161
- gunners6518
162+
- gyx1000
162163
- hadizz
163164
- hardingmatt
164165
- helderburato

integration/action-test.ts

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,32 @@ test.describe("actions", () => {
4343
}
4444
`,
4545

46+
"app/routes/request-text.jsx": js`
47+
import { Form, useActionData } from "@remix-run/react";
48+
49+
export let action = async ({ request }) => {
50+
let text = await request.text();
51+
return text;
52+
};
53+
54+
export default function Actions() {
55+
let data = useActionData()
56+
57+
return (
58+
<Form method="post" id="form">
59+
<p id="text">
60+
{data ? <span id="action-text">{data}</span> : "${WAITING_VALUE}"}
61+
</p>
62+
<p>
63+
<input name="a" defaultValue="1" />
64+
<input name="b" defaultValue="2" />
65+
<button type="submit" id="submit">Go</button>
66+
</p>
67+
</Form>
68+
);
69+
}
70+
`,
71+
4672
[`app/routes/${THROWS_REDIRECT}.jsx`]: js`
4773
import { redirect } from "@remix-run/node";
4874
import { Form } from "@remix-run/react";
@@ -115,6 +141,20 @@ test.describe("actions", () => {
115141
await page.waitForSelector(`#text:has-text("${SUBMITTED_VALUE}")`);
116142
});
117143

144+
test("properly encodes form data for request.text() usage", async ({
145+
page,
146+
}) => {
147+
let app = new PlaywrightFixture(appFixture, page);
148+
await app.goto(`/request-text`);
149+
await page.waitForSelector(`#text:has-text("${WAITING_VALUE}")`);
150+
151+
await page.click("button[type=submit]");
152+
await page.waitForSelector("#action-text");
153+
expect(await app.getHtml("#action-text")).toBe(
154+
'<span id="action-text">a=1&amp;b=2</span>'
155+
);
156+
});
157+
118158
test("redirects a thrown response on document requests", async () => {
119159
let params = new URLSearchParams();
120160
let res = await fixture.postDocument(`/${THROWS_REDIRECT}`, params);

integration/catch-boundary-test.ts

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,12 @@ test.describe("CatchBoundary", () => {
2222
fixture = await createFixture({
2323
files: {
2424
"app/root.jsx": js`
25-
import { Links, Meta, Outlet, Scripts } from "@remix-run/react";
25+
import { json } from "@remix-run/node";
26+
import { Links, Meta, Outlet, Scripts, useMatches } from "@remix-run/react";
27+
28+
export function loader() {
29+
return json({ data: "ROOT LOADER" });
30+
}
2631
2732
export default function Root() {
2833
return (
@@ -40,11 +45,13 @@ test.describe("CatchBoundary", () => {
4045
}
4146
4247
export function CatchBoundary() {
48+
let matches = useMatches()
4349
return (
4450
<html>
4551
<head />
4652
<body>
4753
<div id="root-boundary">${ROOT_BOUNDARY_TEXT}</div>
54+
<pre id="matches">{JSON.stringify(matches)}</pre>
4855
<Scripts />
4956
</body>
5057
</html>
@@ -209,14 +216,27 @@ test.describe("CatchBoundary", () => {
209216
test("non-matching urls on document requests", async () => {
210217
let res = await fixture.requestDocument(NOT_FOUND_HREF);
211218
expect(res.status).toBe(404);
212-
expect(await res.text()).toMatch(ROOT_BOUNDARY_TEXT);
219+
let html = await res.text();
220+
expect(html).toMatch(ROOT_BOUNDARY_TEXT);
221+
222+
// There should be no loader data on the root route
223+
let expected = JSON.stringify([
224+
{ id: "root", pathname: "", params: {} },
225+
]).replace(/"/g, "&quot;");
226+
expect(html).toContain(`<pre id="matches">${expected}</pre>`);
213227
});
214228

215229
test("non-matching urls on client transitions", async ({ page }) => {
216230
let app = new PlaywrightFixture(appFixture, page);
217231
await app.goto("/");
218232
await app.clickLink(NOT_FOUND_HREF, { wait: false });
219233
await page.waitForSelector("#root-boundary");
234+
235+
// Root loader data sticks around from previous load
236+
let expected = JSON.stringify([
237+
{ id: "root", pathname: "", params: {}, data: { data: "ROOT LOADER" } },
238+
]);
239+
expect(await app.getHtml("#matches")).toContain(expected);
220240
});
221241

222242
test("own boundary, action, document request", async () => {

0 commit comments

Comments
 (0)