diff --git a/src/compiler/__tests__/@prop.test.tsx b/src/__tests__/compiler/@prop.test.tsx similarity index 98% rename from src/compiler/__tests__/@prop.test.tsx rename to src/__tests__/compiler/@prop.test.tsx index eb25ca51..1424058e 100644 --- a/src/compiler/__tests__/@prop.test.tsx +++ b/src/__tests__/compiler/@prop.test.tsx @@ -1,9 +1,8 @@ import { render, screen } from "@testing-library/react-native"; +import { compile } from "react-native-css/compiler"; import { View } from "react-native-css/components"; import { registerCSS, testID } from "react-native-css/jest"; -import { compile } from "../compiler"; - test("@prop target (nested @media)", () => { const compiled = registerCSS(` .my-class { diff --git a/src/compiler/__tests__/compiler.test.tsx b/src/__tests__/compiler/compiler.test.tsx similarity index 99% rename from src/compiler/__tests__/compiler.test.tsx rename to src/__tests__/compiler/compiler.test.tsx index f64355b3..88e439bd 100644 --- a/src/compiler/__tests__/compiler.test.tsx +++ b/src/__tests__/compiler/compiler.test.tsx @@ -1,4 +1,4 @@ -import { compile } from "../compiler"; +import { compile } from "react-native-css/compiler"; test("hello world", () => { const compiled = compile(` diff --git a/src/compiler/__tests__/declarations.test.tsx b/src/__tests__/compiler/declarations.test.tsx similarity index 100% rename from src/compiler/__tests__/declarations.test.tsx rename to src/__tests__/compiler/declarations.test.tsx diff --git a/src/compiler/__tests__/media-query.test.ts b/src/__tests__/compiler/media-query.test.ts similarity index 96% rename from src/compiler/__tests__/media-query.test.ts rename to src/__tests__/compiler/media-query.test.ts index 0a1a80a7..760ede29 100644 --- a/src/compiler/__tests__/media-query.test.ts +++ b/src/__tests__/compiler/media-query.test.ts @@ -1,4 +1,4 @@ -import { compile } from "../compiler"; +import { compile } from "react-native-css/compiler"; describe.skip("platform media queries", () => { test("android", () => { diff --git a/src/compiler/__tests__/selectors.test.tsx b/src/__tests__/compiler/selectors.test.tsx similarity index 97% rename from src/compiler/__tests__/selectors.test.tsx rename to src/__tests__/compiler/selectors.test.tsx index 48e8e66f..1df75cf0 100644 --- a/src/compiler/__tests__/selectors.test.tsx +++ b/src/__tests__/compiler/selectors.test.tsx @@ -1,4 +1,4 @@ -import { getClassNameSelectors } from "../selector-builder"; +import { getClassNameSelectors } from "../../compiler/selector-builder"; test("empty", () => { expect(getClassNameSelectors([])).toStrictEqual([]); diff --git a/src/__tests__/compiler/unstable_animations.test.ts b/src/__tests__/compiler/unstable_animations.test.ts new file mode 100644 index 00000000..a2ad992c --- /dev/null +++ b/src/__tests__/compiler/unstable_animations.test.ts @@ -0,0 +1,70 @@ +import { compile } from "react-native-css/compiler"; + +test("test compiler", () => { + const compiled = compile( + ` + .test { + animation: slide-in 1s; + } + + @keyframes slide-in { + from { + margin-left: 100%; + } + + to { + margin-left: 0%; + } + } + `, + ); + + expect(compiled.stylesheet()).toStrictEqual({ + k: [ + [ + "slide-in", + [ + [ + "from", + [ + { + marginLeft: "100%", + }, + ], + ], + [ + "to", + [ + { + marginLeft: "0%", + }, + ], + ], + ], + ], + ], + s: [ + [ + "test", + [ + { + a: true, + d: [ + [[[{}, "animationName", ["slide-in"], 1]], "animationName"], + { + animationDelay: [0], + animationDirection: ["normal"], + animationDuration: [1000], + animationFillMode: ["none"], + animationIterationCount: [1], + animationPlayState: ["running"], + animationTimingFunction: "ease", + }, + ], + s: [1, 1], + }, + ], + ], + ], + }); +}); diff --git a/src/compiler/__tests__/unstable_animations.test.ts b/src/compiler/__tests__/unstable_animations.test.ts deleted file mode 100644 index 7b7e0a94..00000000 --- a/src/compiler/__tests__/unstable_animations.test.ts +++ /dev/null @@ -1,57 +0,0 @@ -import { compile } from "../compiler"; - -test.skip("test compiler", () => { - const compiled = compile( - ` - .test { - animation: slide-in 1s; - } - - @keyframes slide-in { - from { - margin-left: 100%; - } - - to { - margin-left: 0%; - } - } - `, - ); - - expect(compiled.stylesheet()).toStrictEqual({ - k: [ - [ - "slide-in", - [ - ["from", [{ marginLeft: "100%" }]], - ["to", [{ marginLeft: "0%" }]], - ], - ], - ], - s: [ - [ - "test", - [ - [ - { - s: [1, 1], - d: [ - { - animationName: [[{}, "animation", ["slide-in"], 1]], - animationDuration: [1000], - animationTimingFunction: ["ease"], - animationIterationCount: [1], - animationDirection: ["normal"], - animationPlayState: ["running"], - animationDelay: [0], - animationFillMode: ["none"], - }, - ], - }, - ], - ], - ], - ], - }); -});