mirror of
https://github.com/webstudio-is/webstudio.git
synced 2026-11-04 02:58:23 +09:00
- fixed default duration - fixed repeating logic when view, add or delete transitions - prevent showing transition-behavior property when use transitions UI
40 lines
747 B
TypeScript
40 lines
747 B
TypeScript
import { expect, test } from "@jest/globals";
|
|
import { removeByMutable, repeatUntil } from "./array-utils";
|
|
|
|
test("removeByMutable", () => {
|
|
const array = [
|
|
{ param: 1 },
|
|
{ param: 2 },
|
|
{ param: 3 },
|
|
{ param: 4 },
|
|
{ param: 5 },
|
|
{ param: 6 },
|
|
];
|
|
removeByMutable(array, (item) => item.param % 2 === 1);
|
|
expect(array).toMatchInlineSnapshot(`
|
|
[
|
|
{
|
|
"param": 2,
|
|
},
|
|
{
|
|
"param": 4,
|
|
},
|
|
{
|
|
"param": 6,
|
|
},
|
|
]
|
|
`);
|
|
removeByMutable(array, (item) => item.param !== 4);
|
|
expect(array).toMatchInlineSnapshot(`
|
|
[
|
|
{
|
|
"param": 4,
|
|
},
|
|
]
|
|
`);
|
|
});
|
|
|
|
test("repeatUntil", () => {
|
|
expect(repeatUntil([1, 2, 3], 5)).toEqual([1, 2, 3, 1, 2]);
|
|
});
|