0
Fork 0
mirror of https://github.com/withastro/astro.git synced 2025-01-27 22:19:04 -05:00

[ci] format

This commit is contained in:
matthewp 2023-11-08 17:48:24 +00:00 committed by astrobot-houston
parent fda3a0213b
commit b09379428d
3 changed files with 7 additions and 13 deletions

View file

@ -25,12 +25,9 @@ const { fallback = 'animate', handleForms } = Astro.props;
</style>
<meta name="astro-view-transitions-enabled" content="true" />
<meta name="astro-view-transitions-fallback" content={fallback} />
{ handleForms ?
<meta name="astro-view-transitions-forms" content="true" /> :
''
}
{handleForms ? <meta name="astro-view-transitions-forms" content="true" /> : ''}
<script>
import type { Options } from 'astro:transitions/client';
import type { Options } from 'astro:transitions/client';
import { supportsViewTransitions, navigate } from 'astro:transitions/client';
// NOTE: import from `astro/prefetch` as `astro:prefetch` requires the `prefetch` config to be enabled
import { init } from 'astro/prefetch';
@ -83,13 +80,10 @@ import type { Options } from 'astro:transitions/client';
});
});
if(document.querySelector('[name="astro-view-transitions-forms"]')) {
if (document.querySelector('[name="astro-view-transitions-forms"]')) {
document.addEventListener('submit', (ev) => {
let el = ev.target as HTMLElement;
if (
el.tagName !== 'FORM' ||
isReloadEl(el)
) {
if (el.tagName !== 'FORM' || isReloadEl(el)) {
return;
}
@ -97,7 +91,7 @@ import type { Options } from 'astro:transitions/client';
const formData = new FormData(form);
let action = form.action;
const options: Options = {};
if(form.method === 'get') {
if (form.method === 'get') {
const params = new URLSearchParams(formData as any);
const url = new URL(action);
url.search = params.toString();

View file

@ -953,7 +953,7 @@ test.describe('View Transitions', () => {
'There should be only 1 page load. No additional loads for the form submission'
).toEqual(1);
});
test('Route announcer is invisible on page transition', async ({ page, astro }) => {
await page.goto(astro.resolveUrl('/no-directive-one'));

View file

@ -383,7 +383,7 @@ async function transition(
let finished: Promise<void>;
const href = toLocation.href;
const init: RequestInit = {};
if(options.formData) {
if (options.formData) {
init.method = 'POST';
init.body = options.formData;
}