Skip to content

Open source website builder and Webflow alternative. Webstudio is an advanced visual builder that connects to any headless CMS, supports all CSS properties, and can be hosted anywhere, including with us.

chore: Update snapshots for transitions to inline (#3312)

Jaya Krishna Namburu703b6994444a
diff --git a/packages/css-data/src/property-parsers/__snapshots__/transition-property-extractor.test.ts.snap b/packages/css-data/src/property-parsers/__snapshots__/transition-property-extractor.test.ts.snap
deleted file mode 100644
index f7a48e63c6..0000000000
--- a/packages/css-data/src/property-parsers/__snapshots__/transition-property-extractor.test.ts.snap
+++ /dev/null
@@ -1,299 +0,0 @@
-// Jest Snapshot v1, https://goo.gl/fbAQLP
-
-exports[`extractTransitionProperties parses and extracts values from custom-property ease:
- {
- "property": {
- "type": "keyword",
- "value": "custom-property"
- },
- "duration": null,
- "timing": {
- "type": "keyword",
- "value": "ease"
- },
- "delay": null
- }
- 1`] = `
-{
- "delay": null,
- "duration": null,
- "property": {
- "type": "keyword",
- "value": "custom-property",
- },
- "timing": {
- "type": "keyword",
- "value": "ease",
- },
-}
-`;
-
-exports[`extractTransitionProperties parses and extracts values from custom-property ease:
- {
- "property": null,
- "duration": null,
- "timing": {
- "type": "keyword",
- "value": "ease"
- },
- "delay": null
- }
- 1`] = `
-{
- "delay": null,
- "duration": null,
- "property": null,
- "timing": {
- "type": "keyword",
- "value": "ease",
- },
-}
-`;
-
-exports[`extractTransitionProperties parses and extracts values from opacity 200ms 10ms:
- {
- "property": {
- "type": "keyword",
- "value": "opacity"
- },
- "duration": {
- "type": "unit",
- "value": 200,
- "unit": "ms"
- },
- "timing": null,
- "delay": {
- "type": "unit",
- "value": 10,
- "unit": "ms"
- }
- }
- 1`] = `
-{
- "delay": {
- "type": "unit",
- "unit": "ms",
- "value": 10,
- },
- "duration": {
- "type": "unit",
- "unit": "ms",
- "value": 200,
- },
- "property": {
- "type": "keyword",
- "value": "opacity",
- },
- "timing": null,
-}
-`;
-
-exports[`extractTransitionProperties parses and extracts values from opacity 200ms ease 50ms:
- {
- "property": {
- "type": "keyword",
- "value": "opacity"
- },
- "duration": {
- "type": "unit",
- "value": 200,
- "unit": "ms"
- },
- "timing": {
- "type": "keyword",
- "value": "ease"
- },
- "delay": {
- "type": "unit",
- "value": 50,
- "unit": "ms"
- }
- }
- 1`] = `
-{
- "delay": {
- "type": "unit",
- "unit": "ms",
- "value": 50,
- },
- "duration": {
- "type": "unit",
- "unit": "ms",
- "value": 200,
- },
- "property": {
- "type": "keyword",
- "value": "opacity",
- },
- "timing": {
- "type": "keyword",
- "value": "ease",
- },
-}
-`;
-
-exports[`extractTransitionProperties parses and extracts values from opacity 200ms ease:
- {
- "property": {
- "type": "keyword",
- "value": "opacity"
- },
- "duration": {
- "type": "unit",
- "value": 200,
- "unit": "ms"
- },
- "timing": {
- "type": "keyword",
- "value": "ease"
- },
- "delay": null
- }
- 1`] = `
-{
- "delay": null,
- "duration": {
- "type": "unit",
- "unit": "ms",
- "value": 200,
- },
- "property": {
- "type": "keyword",
- "value": "opacity",
- },
- "timing": {
- "type": "keyword",
- "value": "ease",
- },
-}
-`;
-
-exports[`extractTransitionProperties parses and extracts values from opacity 200ms:
- {
- "property": {
- "type": "keyword",
- "value": "opacity"
- },
- "duration": {
- "type": "unit",
- "value": 200,
- "unit": "ms"
- },
- "timing": null,
- "delay": null
- }
- 1`] = `
-{
- "delay": null,
- "duration": {
- "type": "unit",
- "unit": "ms",
- "value": 200,
- },
- "property": {
- "type": "keyword",
- "value": "opacity",
- },
- "timing": null,
-}
-`;
-
-exports[`extractTransitionProperties parses and extracts values from opacity ease 50ms:
- {
- "property": {
- "type": "keyword",
- "value": "opacity"
- },
- "duration": {
- "type": "unit",
- "value": 50,
- "unit": "ms"
- },
- "timing": {
- "type": "keyword",
- "value": "ease"
- },
- "delay": null
- }
- 1`] = `
-{
- "delay": null,
- "duration": {
- "type": "unit",
- "unit": "ms",
- "value": 50,
- },
- "property": {
- "type": "keyword",
- "value": "opacity",
- },
- "timing": {
- "type": "keyword",
- "value": "ease",
- },
-}
-`;
-
-exports[`extractTransitionProperties parses and extracts values from opacity ease:
- {
- "property": {
- "type": "keyword",
- "value": "opacity"
- },
- "duration": null,
- "timing": {
- "type": "keyword",
- "value": "ease"
- },
- "delay": null
- }
- 1`] = `
-{
- "delay": null,
- "duration": null,
- "property": {
- "type": "keyword",
- "value": "opacity",
- },
- "timing": {
- "type": "keyword",
- "value": "ease",
- },
-}
-`;
-
-exports[`extractTransitionProperties parses and extracts values from transform 0.6s cubic-bezier(0.36, 0, 0.66, -0.56):
- {
- "property": {
- "type": "keyword",
- "value": "transform"
- },
- "duration": {
- "type": "unit",
- "value": 0.6,
- "unit": "s"
- },
- "timing": {
- "type": "keyword",
- "value": "cubic-bezier(0.36, 0, 0.66, -0.56)"
- },
- "delay": null
- }
- 1`] = `
-{
- "delay": null,
- "duration": {
- "type": "unit",
- "unit": "s",
- "value": 0.6,
- },
- "property": {
- "type": "keyword",
- "value": "transform",
- },
- "timing": {
- "type": "keyword",
- "value": "cubic-bezier(0.36, 0, 0.66, -0.56)",
- },
-}
-`;
diff --git a/packages/css-data/src/property-parsers/__snapshots__/transition.test.ts.snap b/packages/css-data/src/property-parsers/__snapshots__/transition.test.ts.snap
deleted file mode 100644
index 295c7f49fd..0000000000
--- a/packages/css-data/src/property-parsers/__snapshots__/transition.test.ts.snap
+++ /dev/null
@@ -1,151 +0,0 @@
-// Jest Snapshot v1, https://goo.gl/fbAQLP
-
-exports[`parseTransition parse value and returns multiple valid layers:
- {
- "type": "layers",
- "value": [
- {
- "type": "tuple",
- "value": [
- {
- "type": "keyword",
- "value": "color"
- },
- {
- "type": "unit",
- "value": 0.2,
- "unit": "s"
- }
- ]
- },
- {
- "type": "tuple",
- "value": [
- {
- "type": "keyword",
- "value": "text-shadow"
- },
- {
- "type": "unit",
- "value": 0.2,
- "unit": "s"
- }
- ]
- }
- ]
- } 1`] = `
-{
- "type": "layers",
- "value": [
- {
- "type": "tuple",
- "value": [
- {
- "type": "keyword",
- "value": "color",
- },
- {
- "type": "unit",
- "unit": "s",
- "value": 0.2,
- },
- ],
- },
- {
- "type": "tuple",
- "value": [
- {
- "type": "keyword",
- "value": "text-shadow",
- },
- {
- "type": "unit",
- "unit": "s",
- "value": 0.2,
- },
- ],
- },
- ],
-}
-`;
-
-exports[`parseTransition parse value and returns valid layer:
- {
- "type": "layers",
- "value": [
- {
- "type": "tuple",
- "value": [
- {
- "type": "keyword",
- "value": "opacity"
- },
- {
- "type": "unit",
- "value": 200,
- "unit": "ms"
- },
- {
- "type": "keyword",
- "value": "ease"
- },
- {
- "type": "unit",
- "value": 0,
- "unit": "s"
- }
- ]
- }
- ]
- } 1`] = `
-{
- "type": "layers",
- "value": [
- {
- "type": "tuple",
- "value": [
- {
- "type": "keyword",
- "value": "opacity",
- },
- {
- "type": "unit",
- "unit": "ms",
- "value": 200,
- },
- {
- "type": "keyword",
- "value": "ease",
- },
- {
- "type": "unit",
- "unit": "s",
- "value": 0,
- },
- ],
- },
- ],
-}
-`;
-
-exports[`parseTransition throws error if any custom transition proeprty is used:
- {
- "type": "invalid",
- "value": "all 200ms ease 0s, --foo 200ms ease 0s"
- } 1`] = `
-{
- "type": "invalid",
- "value": "all 200ms ease 0s, --foo 200ms ease 0s",
-}
-`;
-
-exports[`parseTransition throws error if any custom transition timing function is used:
- {
- "type": "invalid",
- "value": "all 200ms custom-function 0s"
- } 1`] = `
-{
- "type": "invalid",
- "value": "all 200ms custom-function 0s",
-}
-`;
diff --git a/packages/css-data/src/property-parsers/transition-property-extractor.test.ts b/packages/css-data/src/property-parsers/transition-property-extractor.test.ts
index 6958aed6a2..f99e591871 100644
--- a/packages/css-data/src/property-parsers/transition-property-extractor.test.ts
+++ b/packages/css-data/src/property-parsers/transition-property-extractor.test.ts
@@ -33,28 +33,28 @@ describe("extractTransitionProperties", () => {
timing: { type: "keyword", value: "ease" },
delay: { type: "unit", value: 50, unit: "ms" },
});
- expect(result).toMatchSnapshot(`
- {
- "property": {
- "type": "keyword",
- "value": "opacity"
- },
- "duration": {
- "type": "unit",
- "value": 200,
- "unit": "ms"
- },
- "timing": {
- "type": "keyword",
- "value": "ease"
- },
- "delay": {
- "type": "unit",
- "value": 50,
- "unit": "ms"
- }
- }
- `);
+ expect(result).toMatchInlineSnapshot(`
+{
+ "delay": {
+ "type": "unit",
+ "unit": "ms",
+ "value": 50,
+ },
+ "duration": {
+ "type": "unit",
+ "unit": "ms",
+ "value": 200,
+ },
+ "property": {
+ "type": "keyword",
+ "value": "opacity",
+ },
+ "timing": {
+ "type": "keyword",
+ "value": "ease",
+ },
+}
+`);
});
test("parses and extracts values from opacity 200ms ease", () => {
@@ -83,24 +83,24 @@ describe("extractTransitionProperties", () => {
timing: { type: "keyword", value: "ease" },
delay: null,
});
- expect(result).toMatchSnapshot(`
- {
- "property": {
- "type": "keyword",
- "value": "opacity"
- },
- "duration": {
- "type": "unit",
- "value": 200,
- "unit": "ms"
- },
- "timing": {
- "type": "keyword",
- "value": "ease"
- },
- "delay": null
- }
- `);
+ expect(result).toMatchInlineSnapshot(`
+{
+ "delay": null,
+ "duration": {
+ "type": "unit",
+ "unit": "ms",
+ "value": 200,
+ },
+ "property": {
+ "type": "keyword",
+ "value": "opacity",
+ },
+ "timing": {
+ "type": "keyword",
+ "value": "ease",
+ },
+}
+`);
});
test("parses and extracts values from opacity 200ms 10ms", () => {
@@ -130,25 +130,25 @@ describe("extractTransitionProperties", () => {
timing: null,
delay: { type: "unit", value: 10, unit: "ms" },
});
- expect(result).toMatchSnapshot(`
- {
- "property": {
- "type": "keyword",
- "value": "opacity"
- },
- "duration": {
- "type": "unit",
- "value": 200,
- "unit": "ms"
- },
- "timing": null,
- "delay": {
- "type": "unit",
- "value": 10,
- "unit": "ms"
- }
- }
- `);
+ expect(result).toMatchInlineSnapshot(`
+{
+ "delay": {
+ "type": "unit",
+ "unit": "ms",
+ "value": 10,
+ },
+ "duration": {
+ "type": "unit",
+ "unit": "ms",
+ "value": 200,
+ },
+ "property": {
+ "type": "keyword",
+ "value": "opacity",
+ },
+ "timing": null,
+}
+`);
});
test("parses and extracts values from opacity 200ms", () => {
@@ -173,21 +173,21 @@ describe("extractTransitionProperties", () => {
timing: null,
delay: null,
});
- expect(result).toMatchSnapshot(`
- {
- "property": {
- "type": "keyword",
- "value": "opacity"
- },
- "duration": {
- "type": "unit",
- "value": 200,
- "unit": "ms"
- },
- "timing": null,
- "delay": null
- }
- `);
+ expect(result).toMatchInlineSnapshot(`
+{
+ "delay": null,
+ "duration": {
+ "type": "unit",
+ "unit": "ms",
+ "value": 200,
+ },
+ "property": {
+ "type": "keyword",
+ "value": "opacity",
+ },
+ "timing": null,
+}
+`);
});
test("parses and extracts values from ease 10ms", () => {
@@ -234,20 +234,7 @@ describe("extractTransitionProperties", () => {
timing: { type: "keyword", value: "ease" },
delay: null,
});
- expect(result).toMatchSnapshot(`
- {
- "property": {
- "type": "keyword",
- "value": "opacity"
- },
- "duration": null,
- "timing": {
- "type": "keyword",
- "value": "ease"
- },
- "delay": null
- }
- `);
+ expect(result).toMatchInlineSnapshot;
});
test("parses and extracts values from opacity ease 50ms", () => {
@@ -276,24 +263,24 @@ describe("extractTransitionProperties", () => {
timing: { type: "keyword", value: "ease" },
delay: null,
});
- expect(result).toMatchSnapshot(`
- {
- "property": {
- "type": "keyword",
- "value": "opacity"
- },
- "duration": {
- "type": "unit",
- "value": 50,
- "unit": "ms"
- },
- "timing": {
- "type": "keyword",
- "value": "ease"
- },
- "delay": null
- }
- `);
+ expect(result).toMatchInlineSnapshot(`
+{
+ "delay": null,
+ "duration": {
+ "type": "unit",
+ "unit": "ms",
+ "value": 50,
+ },
+ "property": {
+ "type": "keyword",
+ "value": "opacity",
+ },
+ "timing": {
+ "type": "keyword",
+ "value": "ease",
+ },
+}
+`);
});
test("parses and extracts values from transform 0.6s cubic-bezier(0.36, 0, 0.66, -0.56)", () => {
@@ -322,24 +309,24 @@ describe("extractTransitionProperties", () => {
timing: { type: "keyword", value: "cubic-bezier(0.36, 0, 0.66, -0.56)" },
delay: null,
});
- expect(result).toMatchSnapshot(`
- {
- "property": {
- "type": "keyword",
- "value": "transform"
- },
- "duration": {
- "type": "unit",
- "value": 0.6,
- "unit": "s"
- },
- "timing": {
- "type": "keyword",
- "value": "cubic-bezier(0.36, 0, 0.66, -0.56)"
- },
- "delay": null
- }
- `);
+ expect(result).toMatchInlineSnapshot(`
+{
+ "delay": null,
+ "duration": {
+ "type": "unit",
+ "unit": "s",
+ "value": 0.6,
+ },
+ "property": {
+ "type": "keyword",
+ "value": "transform",
+ },
+ "timing": {
+ "type": "keyword",
+ "value": "cubic-bezier(0.36, 0, 0.66, -0.56)",
+ },
+}
+`);
});
test("parses and extracts values from custom-property ease", () => {
@@ -364,20 +351,20 @@ describe("extractTransitionProperties", () => {
delay: null,
});
- expect(result).toMatchSnapshot(`
- {
- "property": {
- "type": "keyword",
- "value": "custom-property"
- },
- "duration": null,
- "timing": {
- "type": "keyword",
- "value": "ease"
- },
- "delay": null
- }
- `);
+ expect(result).toMatchInlineSnapshot(`
+{
+ "delay": null,
+ "duration": null,
+ "property": {
+ "type": "keyword",
+ "value": "custom-property",
+ },
+ "timing": {
+ "type": "keyword",
+ "value": "ease",
+ },
+}
+`);
});
test("parses and extracts values from custom-property ease", () => {
@@ -398,16 +385,16 @@ describe("extractTransitionProperties", () => {
delay: null,
});
- expect(result).toMatchSnapshot(`
- {
- "property": null,
- "duration": null,
- "timing": {
- "type": "keyword",
- "value": "ease"
- },
- "delay": null
- }
- `);
+ expect(result).toMatchInlineSnapshot(`
+{
+ "delay": null,
+ "duration": null,
+ "property": null,
+ "timing": {
+ "type": "keyword",
+ "value": "ease",
+ },
+}
+`);
});
});
diff --git a/packages/css-data/src/property-parsers/transition.test.ts b/packages/css-data/src/property-parsers/transition.test.ts
index c9b0cb924b..0b8af3dd45 100644
--- a/packages/css-data/src/property-parsers/transition.test.ts
+++ b/packages/css-data/src/property-parsers/transition.test.ts
@@ -13,91 +13,96 @@ describe("parseTransition", () => {
});
test("parse value and returns multiple valid layers", () => {
- expect(parseTransition("color .2s, text-shadow .2s")).toMatchSnapshot(`
- {
- "type": "layers",
- "value": [
- {
- "type": "tuple",
- "value": [
- {
- "type": "keyword",
- "value": "color"
- },
- {
- "type": "unit",
- "value": 0.2,
- "unit": "s"
- }
- ]
- },
- {
- "type": "tuple",
- "value": [
- {
- "type": "keyword",
- "value": "text-shadow"
- },
- {
- "type": "unit",
- "value": 0.2,
- "unit": "s"
- }
- ]
- }
- ]
- }`);
+ expect(parseTransition("color .2s, text-shadow .2s"))
+ .toMatchInlineSnapshot(`
+{
+ "type": "layers",
+ "value": [
+ {
+ "type": "tuple",
+ "value": [
+ {
+ "type": "keyword",
+ "value": "color",
+ },
+ {
+ "type": "unit",
+ "unit": "s",
+ "value": 0.2,
+ },
+ ],
+ },
+ {
+ "type": "tuple",
+ "value": [
+ {
+ "type": "keyword",
+ "value": "text-shadow",
+ },
+ {
+ "type": "unit",
+ "unit": "s",
+ "value": 0.2,
+ },
+ ],
+ },
+ ],
+}
+`);
});
test("parse value and returns valid layer", () => {
- expect(parseTransition("opacity 200ms ease 0s")).toMatchSnapshot(`
- {
- "type": "layers",
- "value": [
- {
- "type": "tuple",
- "value": [
- {
- "type": "keyword",
- "value": "opacity"
- },
- {
- "type": "unit",
- "value": 200,
- "unit": "ms"
- },
- {
- "type": "keyword",
- "value": "ease"
- },
- {
- "type": "unit",
- "value": 0,
- "unit": "s"
- }
- ]
- }
- ]
- }`);
+ expect(parseTransition("opacity 200ms ease 0s")).toMatchInlineSnapshot(`
+{
+ "type": "layers",
+ "value": [
+ {
+ "type": "tuple",
+ "value": [
+ {
+ "type": "keyword",
+ "value": "opacity",
+ },
+ {
+ "type": "unit",
+ "unit": "ms",
+ "value": 200,
+ },
+ {
+ "type": "keyword",
+ "value": "ease",
+ },
+ {
+ "type": "unit",
+ "unit": "s",
+ "value": 0,
+ },
+ ],
+ },
+ ],
+}
+`);
});
test("throws error if any custom transition proeprty is used", () => {
const transition = parseTransition(
"all 200ms ease 0s, --foo 200ms ease 0s"
);
- expect(transition).toMatchSnapshot(`
- {
- "type": "invalid",
- "value": "all 200ms ease 0s, --foo 200ms ease 0s"
- }`);
+ expect(transition).toMatchInlineSnapshot(`
+{
+ "type": "invalid",
+ "value": "all 200ms ease 0s, --foo 200ms ease 0s",
+}
+`);
});
test("throws error if any custom transition timing function is used", () => {
const transition = parseTransition("all 200ms custom-function 0s");
- expect(transition).toMatchSnapshot(`
- {
- "type": "invalid",
- "value": "all 200ms custom-function 0s"
- }`);
+ expect(transition).toMatchInlineSnapshot(`
+{
+ "type": "invalid",
+ "value": "all 200ms custom-function 0s",
+}
+`);
});
});