Skip to content

Commit

Permalink
[ci] format
Browse files Browse the repository at this point in the history
  • Loading branch information
natemoo-re authored and astrobot-houston committed Dec 6, 2023
1 parent 3878a91 commit 6404d26
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 8 deletions.
6 changes: 3 additions & 3 deletions packages/astro/components/ViewTransitions.astro
Original file line number Diff line number Diff line change
Expand Up @@ -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 };
Expand All @@ -119,7 +119,7 @@ const { fallback = 'animate' } = Astro.props;
} else {
options.formData = formData;
}

ev.preventDefault();
navigate(action, options);
});
Expand Down
13 changes: 8 additions & 5 deletions packages/astro/e2e/view-transitions.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
});
});

0 comments on commit 6404d26

Please sign in to comment.