UNPKG

react-native-web-internals

Version:

React Native for Web

110 lines (109 loc) 3.32 kB
import { preprocess } from "../preprocess.native.js"; describe("StyleSheet/preprocess", function () { describe("preprocesses multiple shadow styles into a single declaration", function () { test("shadowColor only", function () { expect(preprocess({ shadowColor: "red" })).toEqual({ boxShadow: "0px 0px 0px rgba(255,0,0,1.00)" }); }), test("shadowColor and shadowOpacity only", function () { expect(preprocess({ shadowColor: "red", shadowOpacity: 0.5 })).toEqual({ boxShadow: "0px 0px 0px rgba(255,0,0,0.50)" }); }), test("shadowOffset only", function () { expect(preprocess({ shadowOffset: { width: 1, height: 2 } })).toEqual({ boxShadow: "1px 2px 0px rgba(0,0,0,1.00)" }); }), test("shadowRadius only", function () { expect(preprocess({ shadowRadius: 5 })).toEqual({ boxShadow: "0px 0px 5px rgba(0,0,0,1.00)" }); }), test("shadowOffset, shadowRadius, shadowColor", function () { expect(preprocess({ shadowColor: "rgba(50,60,70,0.5)", shadowOffset: { width: 1, height: 2 }, shadowOpacity: 0.5, shadowRadius: 3 })).toEqual({ boxShadow: "1px 2px 3px rgba(50,60,70,0.25)" }); }); }), describe("preprocesses multiple textShadow styles into a single declaration", function () { test("textShadowColor only", function () { expect(preprocess({ textShadowColor: "red" })).toEqual({}); }), test("textShadowOffset only", function () { expect(preprocess({ textShadowOffset: { width: 1, height: 2 } })).toEqual({}); }), test("textShadowRadius only", function () { expect(preprocess({ textShadowRadius: 5 })).toEqual({}); }), test("textShadowColor and textShadowOffset only", function () { expect(preprocess({ textShadowColor: "red", textShadowOffset: { width: 0, height: 0 } })).toEqual({}), expect(preprocess({ textShadowColor: "red", textShadowOffset: { width: -1, height: 0 } })).toEqual({ textShadow: "-1px 0px 0px rgba(255,0,0,1.00)" }), expect(preprocess({ textShadowColor: "red", textShadowOffset: { width: 1, height: 2 } })).toEqual({ textShadow: "1px 2px 0px rgba(255,0,0,1.00)" }); }), test("textShadowColor and textShadowRadius only", function () { expect(preprocess({ textShadowColor: "red", textShadowRadius: 0 })).toEqual({}), expect(preprocess({ textShadowColor: "red", textShadowRadius: 5 })).toEqual({ textShadow: "0px 0px 5px rgba(255,0,0,1.00)" }); }), test("textShadowColor, textShadowOffset, textShadowRadius", function () { expect(preprocess({ textShadowColor: "rgba(50,60,70,0.50)", textShadowOffset: { width: 5, height: 10 }, textShadowRadius: 15 })).toEqual({ textShadow: "5px 10px 15px rgba(50,60,70,0.50)" }); }); }); }); //# sourceMappingURL=preprocess-test.native.js.map