react-native-web-internals
Version:
React Native for Web
111 lines (110 loc) • 3.63 kB
JavaScript
"use strict";
var import_preprocess = require("../preprocess");
describe("StyleSheet/preprocess", function() {
describe("preprocesses multiple shadow styles into a single declaration", function() {
test("shadowColor only", function() {
expect((0, import_preprocess.preprocess)({
shadowColor: "red"
})).toEqual({
boxShadow: "0px 0px 0px rgba(255,0,0,1.00)"
});
}), test("shadowColor and shadowOpacity only", function() {
expect((0, import_preprocess.preprocess)({
shadowColor: "red",
shadowOpacity: 0.5
})).toEqual({
boxShadow: "0px 0px 0px rgba(255,0,0,0.50)"
});
}), test("shadowOffset only", function() {
expect((0, import_preprocess.preprocess)({
shadowOffset: {
width: 1,
height: 2
}
})).toEqual({
boxShadow: "1px 2px 0px rgba(0,0,0,1.00)"
});
}), test("shadowRadius only", function() {
expect((0, import_preprocess.preprocess)({
shadowRadius: 5
})).toEqual({
boxShadow: "0px 0px 5px rgba(0,0,0,1.00)"
});
}), test("shadowOffset, shadowRadius, shadowColor", function() {
expect((0, import_preprocess.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((0, import_preprocess.preprocess)({
textShadowColor: "red"
})).toEqual({});
}), test("textShadowOffset only", function() {
expect((0, import_preprocess.preprocess)({
textShadowOffset: {
width: 1,
height: 2
}
})).toEqual({});
}), test("textShadowRadius only", function() {
expect((0, import_preprocess.preprocess)({
textShadowRadius: 5
})).toEqual({});
}), test("textShadowColor and textShadowOffset only", function() {
expect((0, import_preprocess.preprocess)({
textShadowColor: "red",
textShadowOffset: {
width: 0,
height: 0
}
})).toEqual({}), expect((0, import_preprocess.preprocess)({
textShadowColor: "red",
textShadowOffset: {
width: -1,
height: 0
}
})).toEqual({
textShadow: "-1px 0px 0px rgba(255,0,0,1.00)"
}), expect((0, import_preprocess.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((0, import_preprocess.preprocess)({
textShadowColor: "red",
textShadowRadius: 0
})).toEqual({}), expect((0, import_preprocess.preprocess)({
textShadowColor: "red",
textShadowRadius: 5
})).toEqual({
textShadow: "0px 0px 5px rgba(255,0,0,1.00)"
});
}), test("textShadowColor, textShadowOffset, textShadowRadius", function() {
expect((0, import_preprocess.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.js.map