mirror of
https://github.com/withastro/astro.git
synced 2024-12-23 21:53:55 -05:00
[ci] format
This commit is contained in:
parent
35c0984230
commit
a020d0028d
4 changed files with 7 additions and 15 deletions
|
@ -1444,7 +1444,6 @@ test.describe('View Transitions', () => {
|
|||
expect(text).toBe('true true');
|
||||
});
|
||||
|
||||
|
||||
test('it should be easy to define a data-theme preserving swap function', async ({
|
||||
page,
|
||||
astro,
|
||||
|
@ -1498,7 +1497,7 @@ test.describe('View Transitions', () => {
|
|||
// link outside <main> should still be there
|
||||
const link = await page.$('#click');
|
||||
expect(link).toBeTruthy();
|
||||
});
|
||||
});
|
||||
|
||||
test('chaining should execute in the expected order', async ({ page, astro }) => {
|
||||
let lines = [];
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import { swap } from './swap-functions.js';
|
||||
import { updateScrollPosition } from './router.js';
|
||||
import { swap } from './swap-functions.js';
|
||||
import type { Direction, NavigationTypeString } from './types.js';
|
||||
|
||||
export const TRANSITION_BEFORE_PREPARATION = 'astro:before-preparation';
|
||||
|
@ -117,10 +117,7 @@ export class TransitionBeforeSwapEvent extends BeforeEvent {
|
|||
readonly viewTransition: ViewTransition;
|
||||
swap: () => void;
|
||||
|
||||
constructor(
|
||||
afterPreparation: BeforeEvent,
|
||||
viewTransition: ViewTransition
|
||||
) {
|
||||
constructor(afterPreparation: BeforeEvent, viewTransition: ViewTransition) {
|
||||
super(
|
||||
TRANSITION_BEFORE_SWAP,
|
||||
undefined,
|
||||
|
@ -181,10 +178,7 @@ export async function doPreparation(
|
|||
return event;
|
||||
}
|
||||
|
||||
export function doSwap(
|
||||
afterPreparation: BeforeEvent,
|
||||
viewTransition: ViewTransition,
|
||||
) {
|
||||
export function doSwap(afterPreparation: BeforeEvent, viewTransition: ViewTransition) {
|
||||
const event = new TransitionBeforeSwapEvent(afterPreparation, viewTransition);
|
||||
document.dispatchEvent(event);
|
||||
event.swap();
|
||||
|
|
|
@ -272,7 +272,6 @@ async function updateDOM(
|
|||
historyState?: State,
|
||||
fallback?: Fallback
|
||||
) {
|
||||
|
||||
async function animate(phase: string) {
|
||||
function isInfinite(animation: Animation) {
|
||||
const effect = animation.effect;
|
||||
|
|
|
@ -133,11 +133,11 @@ const shouldCopyProps = (el: HTMLElement): boolean => {
|
|||
return persistProps == null || persistProps === 'false';
|
||||
};
|
||||
|
||||
export const swap = (doc:Document) => {
|
||||
export const swap = (doc: Document) => {
|
||||
deselectScripts(doc);
|
||||
swapRootAttributes(doc);
|
||||
swapHeadElements(doc);
|
||||
const restoreFocusFunction = saveFocus();
|
||||
swapBodyElement(doc.body, document.body)
|
||||
swapBodyElement(doc.body, document.body);
|
||||
restoreFocusFunction();
|
||||
}
|
||||
};
|
||||
|
|
Loading…
Reference in a new issue