Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@
"@eslint/js": "^9.30.1",
"@ianvs/prettier-plugin-sort-imports": "^4.4.2",
"@tailwindcss/postcss": "^4.1.12",
"@testing-library/react-native": "^13.2.0",
"@testing-library/react-native": "^13.3.3",
"@tsconfig/react-native": "^3.0.6",
"@types/babel__core": "^7",
"@types/connect": "^3.4.38",
Expand Down
42 changes: 42 additions & 0 deletions src/__tests__/vendor/tailwind/@apply.test.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
import { screen } from "@testing-library/react-native";
import { View } from "react-native-css/components";

import { render } from "./_tailwind";

const testID = "react-native-css-interop";

test("@apply", async () => {
await render(<View testID={testID} className="btn-primary" />, {
extraCss: `
.btn-primary {
@apply py-2 px-4 bg-blue-500 text-white font-semibold rounded-lg shadow-md;
}`,
});

const component = screen.getByTestId(testID);

expect(component).toHaveStyle({
backgroundColor: "#2b7fff",
borderRadius: 7,
color: "#fff",
fontWeight: 600,
paddingBlock: 7,
paddingInline: 14,
boxShadow: [
{
offsetX: 0,
offsetY: 4,
blurRadius: 6,
spreadDistance: -1,
color: "#0000001a",
},
{
offsetX: 0,
offsetY: 2,
blurRadius: 4,
spreadDistance: -2,
color: "#0000001a",
},
],
});
});
44 changes: 44 additions & 0 deletions src/__tests__/vendor/tailwind/accessibility.test.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
import { renderCurrentTest } from "./_tailwind";

describe("Accessibility - Screen Readers", () => {
test("sr-only", async () => {
const result = await renderCurrentTest();
expect(result).toStrictEqual({
props: {
style: {
borderWidth: 0,
height: 1,
margin: -1,
overflow: "hidden",
padding: 0,
position: "absolute",
width: 1,
},
},
warnings: {
properties: ["clip", "white-space"],
},
});
});

test("not-sr-only", async () => {
const result = await renderCurrentTest();
expect(result).toStrictEqual({
props: {
style: {
margin: 0,
overflow: "visible",
padding: 0,
},
},
warnings: {
properties: ["clip", "white-space"],
values: {
position: "static",
width: "auto",
height: "auto",
},
},
});
});
});
292 changes: 292 additions & 0 deletions src/__tests__/vendor/tailwind/effects.test.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,292 @@
import { renderCurrentTest } from "./_tailwind";

describe("Effects - Box Shadow", () => {
test("shadow-sm", async () => {
expect(await renderCurrentTest()).toStrictEqual({
props: {
style: {
boxShadow: [
{
blurRadius: 3,
color: "#0000001a",
offsetX: 0,
offsetY: 1,
spreadDistance: 0,
},
{
blurRadius: 2,
color: "#0000001a",
offsetX: 0,
offsetY: 1,
spreadDistance: -1,
},
],
},
},
warnings: {
values: {
"box-shadow": ["initial", "initial", "initial", "initial", "initial"],
},
},
});
});

test("shadow", async () => {
expect(await renderCurrentTest()).toStrictEqual({
props: {
style: {
boxShadow: [
{
blurRadius: 3,
color: "#0000001a",
offsetX: 0,
offsetY: 1,
spreadDistance: 0,
},
{
blurRadius: 2,
color: "#0000001a",
offsetX: 0,
offsetY: 1,
spreadDistance: -1,
},
],
},
},
warnings: {
values: {
"box-shadow": ["initial", "initial", "initial", "initial", "initial"],
},
},
});
});
test("shadow-none", async () => {
expect(await renderCurrentTest()).toStrictEqual({
props: {
style: {
boxShadow: [],
},
},
warnings: {
values: {
"box-shadow": ["initial", "initial", "initial", "initial", "initial"],
},
},
});
});
});

describe.skip("Effects - Box Shadow Color", () => {
// TODO
});

describe("Effects - Opacity", () => {
test("opacity-0", async () => {
expect(await renderCurrentTest()).toStrictEqual({
props: { style: { opacity: 0 } },
});
});
test("opacity-100", async () => {
expect(await renderCurrentTest()).toStrictEqual({
props: { style: { opacity: 1 } },
});
});
});

describe("Effects - Mix Blend Mode", () => {
test("mix-blend-normal", async () => {
expect(await renderCurrentTest()).toStrictEqual({
props: {},
warnings: { properties: ["mix-blend-mode"] },
});
});
test("mix-blend-multiply", async () => {
expect(await renderCurrentTest()).toStrictEqual({
props: {},
warnings: { properties: ["mix-blend-mode"] },
});
});
test("mix-blend-screen", async () => {
expect(await renderCurrentTest()).toStrictEqual({
props: {},
warnings: { properties: ["mix-blend-mode"] },
});
});
test("mix-blend-overlay", async () => {
expect(await renderCurrentTest()).toStrictEqual({
props: {},
warnings: { properties: ["mix-blend-mode"] },
});
});
test("mix-blend-darken", async () => {
expect(await renderCurrentTest()).toStrictEqual({
props: {},
warnings: { properties: ["mix-blend-mode"] },
});
});
test("mix-blend-lighten", async () => {
expect(await renderCurrentTest()).toStrictEqual({
props: {},
warnings: { properties: ["mix-blend-mode"] },
});
});
test("mix-blend-color-dodge", async () => {
expect(await renderCurrentTest()).toStrictEqual({
props: {},
warnings: { properties: ["mix-blend-mode"] },
});
});
test("mix-blend-color-burn", async () => {
expect(await renderCurrentTest()).toStrictEqual({
props: {},
warnings: { properties: ["mix-blend-mode"] },
});
});
test("mix-blend-hard-light", async () => {
expect(await renderCurrentTest()).toStrictEqual({
props: {},
warnings: { properties: ["mix-blend-mode"] },
});
});
test("mix-blend-soft-light", async () => {
expect(await renderCurrentTest()).toStrictEqual({
props: {},
warnings: { properties: ["mix-blend-mode"] },
});
});
test("mix-blend-difference", async () => {
expect(await renderCurrentTest()).toStrictEqual({
props: {},
warnings: { properties: ["mix-blend-mode"] },
});
});
test("mix-blend-exclusion", async () => {
expect(await renderCurrentTest()).toStrictEqual({
props: {},
warnings: { properties: ["mix-blend-mode"] },
});
});
test("mix-blend-hue", async () => {
expect(await renderCurrentTest()).toStrictEqual({
props: {},
warnings: { properties: ["mix-blend-mode"] },
});
});
test("mix-blend-saturation", async () => {
expect(await renderCurrentTest()).toStrictEqual({
props: {},
warnings: { properties: ["mix-blend-mode"] },
});
});
test("mix-blend-color", async () => {
expect(await renderCurrentTest()).toStrictEqual({
props: {},
warnings: { properties: ["mix-blend-mode"] },
});
});
test("mix-blend-luminosity", async () => {
expect(await renderCurrentTest()).toStrictEqual({
props: {},
warnings: { properties: ["mix-blend-mode"] },
});
});
});

describe("Effects - Background Blend Mode", () => {
test("bg-blend-normal", async () => {
expect(await renderCurrentTest()).toStrictEqual({
props: {},
warnings: { properties: ["background-blend-mode"] },
});
});
test("bg-blend-multiply", async () => {
expect(await renderCurrentTest()).toStrictEqual({
props: {},
warnings: { properties: ["background-blend-mode"] },
});
});
test("bg-blend-screen", async () => {
expect(await renderCurrentTest()).toStrictEqual({
props: {},
warnings: { properties: ["background-blend-mode"] },
});
});
test("bg-blend-overlay", async () => {
expect(await renderCurrentTest()).toStrictEqual({
props: {},
warnings: { properties: ["background-blend-mode"] },
});
});
test("bg-blend-darken", async () => {
expect(await renderCurrentTest()).toStrictEqual({
props: {},
warnings: { properties: ["background-blend-mode"] },
});
});
test("bg-blend-lighten", async () => {
expect(await renderCurrentTest()).toStrictEqual({
props: {},
warnings: { properties: ["background-blend-mode"] },
});
});
test("bg-blend-color-dodge", async () => {
expect(await renderCurrentTest()).toStrictEqual({
props: {},
warnings: { properties: ["background-blend-mode"] },
});
});
test("bg-blend-color-burn", async () => {
expect(await renderCurrentTest()).toStrictEqual({
props: {},
warnings: { properties: ["background-blend-mode"] },
});
});
test("bg-blend-hard-light", async () => {
expect(await renderCurrentTest()).toStrictEqual({
props: {},
warnings: { properties: ["background-blend-mode"] },
});
});
test("bg-blend-soft-light", async () => {
expect(await renderCurrentTest()).toStrictEqual({
props: {},
warnings: { properties: ["background-blend-mode"] },
});
});
test("bg-blend-difference", async () => {
expect(await renderCurrentTest()).toStrictEqual({
props: {},
warnings: { properties: ["background-blend-mode"] },
});
});
test("bg-blend-exclusion", async () => {
expect(await renderCurrentTest()).toStrictEqual({
props: {},
warnings: { properties: ["background-blend-mode"] },
});
});
test("bg-blend-hue", async () => {
expect(await renderCurrentTest()).toStrictEqual({
props: {},
warnings: { properties: ["background-blend-mode"] },
});
});
test("bg-blend-saturation", async () => {
expect(await renderCurrentTest()).toStrictEqual({
props: {},
warnings: { properties: ["background-blend-mode"] },
});
});
test("bg-blend-color", async () => {
expect(await renderCurrentTest()).toStrictEqual({
props: {},
warnings: { properties: ["background-blend-mode"] },
});
});
test("bg-blend-luminosity", async () => {
expect(await renderCurrentTest()).toStrictEqual({
props: {},
warnings: { properties: ["background-blend-mode"] },
});
});
});
Loading
Loading