0
Fork 0
mirror of https://github.com/withastro/astro.git synced 2024-12-16 21:46:22 -05:00

[ci] format

This commit is contained in:
Ted Klingenberg 2023-12-06 00:43:56 +00:00 committed by astrobot-houston
parent 3878a91be4
commit 6404d26a22
2 changed files with 11 additions and 8 deletions

View file

@ -106,8 +106,8 @@ const { fallback = 'animate' } = Astro.props;
// the "dialog" method is a special keyword used within <dialog> elements
// https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#attr-fs-method
if (method === "dialog") {
return
if (method === 'dialog') {
return;
}
const options: Options = { sourceElement: submitter ?? form };
@ -119,7 +119,7 @@ const { fallback = 'animate' } = Astro.props;
} else {
options.formData = formData;
}
ev.preventDefault();
navigate(action, options);
});

View file

@ -1075,17 +1075,20 @@ test.describe('View Transitions', () => {
await expect(page).toHaveURL(expected);
});
test('Dialog using form with method of "dialog" should not trigger navigation', async ({ page, astro }) => {
test('Dialog using form with method of "dialog" should not trigger navigation', async ({
page,
astro,
}) => {
await page.goto(astro.resolveUrl('/dialog'));
let requests = [];
page.on('request', request => requests.push(`${request.method()} ${request.url()}`));
page.on('request', (request) => requests.push(`${request.method()} ${request.url()}`));
await page.click('#open');
await expect(page.locator("dialog")).toHaveAttribute("open")
await expect(page.locator('dialog')).toHaveAttribute('open');
await page.click('#close');
await expect(page.locator("dialog")).not.toHaveAttribute("open")
await expect(page.locator('dialog')).not.toHaveAttribute('open');
expect(requests).toHaveLength(0)
expect(requests).toHaveLength(0);
});
});