Skip to content

Commit 69bb6aa

Browse files
committed
NOT FOR LANDING: the medium-duration glide tests, no code change
The glide's tests at --duration-medium, on main's module.
1 parent 0cc5407 commit 69bb6aa

3 files changed

Lines changed: 30 additions & 32 deletions

File tree

‎packages/core/src/motion/__tests__/animatedLayout.interaction.browser.spec.ts‎

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -880,7 +880,7 @@ test.describe('spec:AST-105 Coverage', () => {
880880
page,
881881
`<div id="area" class="area"><div id="grow" class="grow"></div>
882882
<div id="second" class="grow"></div><div id="after" class="row"></div></div>`,
883-
'#area { --duration-medium-min: 1000ms; }',
883+
'#area { --duration-medium: 1000ms; }',
884884
);
885885
await change(page);
886886
await page.waitForTimeout(100);
@@ -1961,11 +1961,11 @@ test.describe('spec:AST-105 FR2–FR4', () => {
19611961
expect(grow[0].startTime).toBe(follower[0].startTime);
19621962
expect(grow[0].duration).toBeCloseTo(follower[0].duration, 3);
19631963
// With no stylesheet, the tokens read core's declared values.
1964-
expect(follower[0].duration).toBeCloseTo(310, 3);
1964+
expect(follower[0].duration).toBeCloseTo(410, 3);
19651965
expectOnCurve(
19661966
await page.evaluate(() => window.curveOf('#a')),
19671967
[0.24, 1, 0.4, 1],
1968-
310,
1968+
410,
19691969
);
19701970
});
19711971

@@ -2349,30 +2349,30 @@ test.describe('spec:AST-105 FR2–FR4', () => {
23492349
for (const theme of [
23502350
{
23512351
name: 'at tempo 0.75',
2352-
style: '--duration-medium-min: 232.5ms',
2353-
ms: 232.5,
2352+
style: '--duration-medium: 307.5ms',
2353+
ms: 307.5,
23542354
points: [0.24, 1, 0.4, 1],
23552355
},
23562356
{
23572357
name: 'at tempo 1.5',
2358-
style: '--duration-medium-min: 465ms',
2359-
ms: 465,
2358+
style: '--duration-medium: 615ms',
2359+
ms: 615,
23602360
points: [0.24, 1, 0.4, 1],
23612361
},
23622362
{
23632363
name: "at character 'crisp'",
23642364
style: '--ease-move: cubic-bezier(0, 0, 0.2, 1)',
2365-
ms: 310,
2365+
ms: 410,
23662366
points: [0, 0, 0.2, 1],
23672367
},
23682368
{
23692369
name: "at character 'expressive'",
23702370
style: '--ease-move: cubic-bezier(0.3, 1.2, 0.5, 1)',
2371-
ms: 310,
2371+
ms: 410,
23722372
points: [0.3, 1.2, 0.5, 1],
23732373
},
23742374
] as const) {
2375-
test(`a theme ${theme.name}: the glide plays its --ease-move over its --duration-medium-min (FR4)`, async ({
2375+
test(`a theme ${theme.name}: the glide plays its --ease-move over its --duration-medium (FR4)`, async ({
23762376
page,
23772377
}) => {
23782378
// The tokens a theme with that knob writes on its scope.
@@ -2407,11 +2407,11 @@ test.describe('spec:AST-105 FR2–FR4', () => {
24072407
await change(page);
24082408
const motions = await page.evaluate(() => window.motionOf('#a'));
24092409
expect(motions, 'the content after the change glides').toHaveLength(1);
2410-
expect(motions[0].duration).toBeCloseTo(310, 3);
2410+
expect(motions[0].duration).toBeCloseTo(410, 3);
24112411
expectOnEase(
24122412
await page.evaluate(() => window.curveOf('#a')),
24132413
theme.ease,
2414-
310,
2414+
410,
24152415
);
24162416
});
24172417
}
@@ -2423,8 +2423,8 @@ test.describe('spec:AST-105 FR2–FR4', () => {
24232423
await open(
24242424
page,
24252425
PAGE,
2426-
`#area { --duration-medium-min: 310ms; --ease-move: cubic-bezier(0.24, 1, 0.4, 1); }
2427-
#grow { --duration-medium-min: 620ms; --ease-move: cubic-bezier(0, 0, 0.2, 1); }`,
2426+
`#area { --duration-medium: 310ms; --ease-move: cubic-bezier(0.24, 1, 0.4, 1); }
2427+
#grow { --duration-medium: 620ms; --ease-move: cubic-bezier(0, 0, 0.2, 1); }`,
24282428
);
24292429
await change(page);
24302430
const [motion] = await page.evaluate(() => window.motionOf('#a'));

‎packages/core/src/motion/__tests__/themeTempo.interaction.browser.spec.ts‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -238,18 +238,18 @@ test('a duration scale nested in a tempo theme glides on its own duration token'
238238
page,
239239
}) => {
240240
await openStory(page, NESTED_STORY, 3);
241-
// Each row's `--duration-medium-min`, in ms, as its theme writes it.
241+
// Each row's `--duration-medium`, in ms, as its theme writes it.
242242
const tokenMs = async (row: string) =>
243243
page.evaluate(
244244
selector =>
245245
Number.parseFloat(
246246
getComputedStyle(
247247
document.querySelector(selector) as Element,
248-
).getPropertyValue('--duration-medium-min'),
248+
).getPropertyValue('--duration-medium'),
249249
),
250250
row,
251251
);
252-
// Each row glides on the `--duration-medium-min` of the theme it is in.
252+
// Each row glides on the `--duration-medium` of the theme it is in.
253253
for (const row of ['plain', 'outer', 'nested']) {
254254
const selector = `section[data-row="${row}"]`;
255255
expect(await glideMs(page, selector), row).toBeCloseTo(
@@ -260,6 +260,6 @@ test('a duration scale nested in a tempo theme glides on its own duration token'
260260
// The nested scale's own value: the outer tempo is not on it.
261261
const own = expandMotionScale({fast: 130, medium: 310, ratio: 0.75});
262262
expect(await tokenMs('section[data-row="nested"]')).toBe(
263-
Number.parseFloat(own['--duration-medium-min']),
263+
Number.parseFloat(own['--duration-medium']),
264264
);
265265
});

‎packages/core/src/motion/animatedLayout.test.ts‎

Lines changed: 12 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -361,24 +361,24 @@ describe('one shared motion (spec:AST-105 FR4)', () => {
361361
);
362362
}
363363

364-
it("plays the changed element and its followers on the theme's move curve over --duration-medium-min, with one duration", async () => {
364+
it("plays the changed element and its followers on the theme's move curve over --duration-medium, with one duration", async () => {
365365
// With no stylesheet, the tokens read core's declared values.
366366
await changeOnce();
367367
const follower = played.find(p => (p.element as HTMLElement).id === 'a');
368368
const own = played.find(p => (p.element as HTMLElement).id === 'changed');
369369
expect(follower).toBeDefined();
370370
expect(own).toBeDefined();
371371
expect(own?.options.duration).toBe(follower?.options.duration);
372-
expect(Number(follower?.options.duration)).toBeCloseTo(310, 6);
373-
const remaining = remainingOn([0.24, 1, 0.4, 1], 310);
372+
expect(Number(follower?.options.duration)).toBeCloseTo(410, 6);
373+
const remaining = remainingOn([0.24, 1, 0.4, 1], 410);
374374
for (const {t, y} of verticalCurveOf(follower as Played)) {
375375
expect(y).toBeCloseTo(-80 * remaining(t), 3);
376376
}
377377
});
378378

379-
it('plays the --duration-medium-min and --ease-move of the theme the area is in', async () => {
379+
it('plays the --duration-medium and --ease-move of the theme the area is in', async () => {
380380
await changeOnce(
381-
'--duration-medium-min: 200ms; --ease-move: cubic-bezier(0, 0, 1, 1)',
381+
'--duration-medium: 200ms; --ease-move: cubic-bezier(0, 0, 1, 1)',
382382
);
383383
const follower = played.find(p => (p.element as HTMLElement).id === 'a');
384384
expect(Number(follower?.options.duration)).toBeCloseTo(200, 6);
@@ -389,17 +389,15 @@ describe('one shared motion (spec:AST-105 FR4)', () => {
389389

390390
it("follows the theme's tempo through its duration token, never scaled twice (spec:AST-108 FR2)", async () => {
391391
// A theme at tempo 1.5 writes the scaled token beside its tempo.
392-
await changeOnce(
393-
'--duration-medium-min: 465ms; --_astryx-motion-tempo: 1.5',
394-
);
392+
await changeOnce('--duration-medium: 615ms; --_astryx-motion-tempo: 1.5');
395393
const follower = played.find(p => (p.element as HTMLElement).id === 'a');
396394
const own = played.find(p => (p.element as HTMLElement).id === 'changed');
397-
expect(Number(follower?.options.duration)).toBeCloseTo(465, 6);
395+
expect(Number(follower?.options.duration)).toBeCloseTo(615, 6);
398396
expect(own?.options.duration).toBe(follower?.options.duration);
399397
});
400398

401399
it('lands at once when the theme sets a zero duration', async () => {
402-
await changeOnce('--duration-medium-min: 0ms');
400+
await changeOnce('--duration-medium: 0ms');
403401
expect(played).toEqual([]);
404402
});
405403

@@ -424,7 +422,7 @@ describe('one shared motion (spec:AST-105 FR4)', () => {
424422
it('retargets an element already gliding: one glide, started from where it is on screen', async () => {
425423
// A long, even curve, so the first glide still moves fast 100 ms in.
426424
const {area, changed, phase} = setUp(
427-
'<div id="area" style="--duration-medium-min: 1000ms; --ease-move: cubic-bezier(0, 0, 1, 1)"><div id="changed"></div><div id="a"></div></div>',
425+
'<div id="area" style="--duration-medium: 1000ms; --ease-move: cubic-bezier(0, 0, 1, 1)"><div id="changed"></div><div id="a"></div></div>',
428426
);
429427
const a = document.getElementById('a') as HTMLElement;
430428
let top = 0;
@@ -759,14 +757,14 @@ describe('the indicator transition', () => {
759757
expect(chevron.style.getPropertyValue('transition-timing-function')).toBe(
760758
'cubic-bezier(0.24, 1, 0.4, 1)',
761759
);
762-
expect(chevron.style.getPropertyValue('transition-duration')).toBe('310ms');
760+
expect(chevron.style.getPropertyValue('transition-duration')).toBe('410ms');
763761
applyLayoutChangeTransition(null, chevron);
764762
expect(chevron.style.getPropertyValue('transition-duration')).toBe('');
765763
});
766764

767765
it('takes the timing read where the area is, whatever scope sits between them', () => {
768-
document.body.innerHTML = `<div id="area" style="--duration-medium-min: 465ms; --ease-move: cubic-bezier(0, 0, 0.2, 1)">
769-
<div style="--duration-medium-min: 620ms; --ease-move: cubic-bezier(0.3, 1.2, 0.5, 1)"><svg id="chevron"></svg></div></div>`;
766+
document.body.innerHTML = `<div id="area" style="--duration-medium: 465ms; --ease-move: cubic-bezier(0, 0, 0.2, 1)">
767+
<div style="--duration-medium: 620ms; --ease-move: cubic-bezier(0.3, 1.2, 0.5, 1)"><svg id="chevron"></svg></div></div>`;
770768
const area = document.getElementById('area') as HTMLElement;
771769
const chevron = document.getElementById(
772770
'chevron',

0 commit comments

Comments
 (0)