Files
webstudio/apps/builder/app/shared/shim.test.ts
T
Bogdan Chadkin dfc216723a refactor: upgrade mdn-data (#3578)
Ref https://github.com/webstudio-is/webstudio/issues/2647

Here upgraded to the latest mdn data and improved properties detection.
Excluded experimental and undocumented css properties.

- font-synthesis got longhands in mdn data
- background-position-x/y got excluded as experimental (though support
is good) but we anyway write as shorthand
- excluded white-space-collapse, text-wrap and text-wrap-* until decide
how to maintain them in the future
- field-sizing and zoom are new additions
2024-06-17 14:35:38 +03:00

29 lines
740 B
TypeScript

import { expect, test } from "@jest/globals";
import { mapGroupBy, setDifference, setUnion } from "./shim";
test("Set.prototype.difference", () => {
// this set is bigger than other
expect(setDifference(new Set([1, 2, 3, 4]), new Set([3, 4, 5]))).toEqual(
new Set([1, 2])
);
// this set is smaller than other
expect(setDifference(new Set([1, 2, 3]), new Set([2, 3, 4, 5]))).toEqual(
new Set([1])
);
});
test("Set.prototype.union", () => {
expect(setUnion(new Set([2, 4, 6, 8]), new Set([1, 4, 9]))).toEqual(
new Set([2, 4, 6, 8, 1, 9])
);
});
test("Map.groupBy", () => {
expect(mapGroupBy([1, 2, 3, 4, 5], (item) => item % 2)).toEqual(
new Map([
[0, [2, 4]],
[1, [1, 3, 5]],
])
);
});