UNPKG

react-native-web-internals

Version:

React Native for Web

38 lines (37 loc) 1.14 kB
import { validate } from "../validate.native.js"; describe("validate", function () { beforeAll(function () { jest.spyOn(console, "error").mockImplementation(function () {}); }), afterAll(function () { console.error.mockRestore(); }), afterEach(function () { console.error.mockClear(); }), test("invalid shortform properties", function () { validate({ background: "red" }), validate({ font: "arial" }), validate({ borderTop: "1px solid red" }), expect(console.error).toHaveBeenCalled(); }), test("valid shortform values", function () { validate({ flex: 1 }), validate({ margin: 10 }), validate({ margin: "calc(10 * 1px)" }), validate({ margin: "calc(10 * calc(10 * 1px))" }), expect(console.error).not.toHaveBeenCalled(); }), test("invalid shortform multi-values", function () { validate({ flex: "1 1 25%" }), validate({ margin: "10px 20px" }), validate({ margin: "calc(10 * 1px) var(--test)" }), expect(console.error).toHaveBeenCalledTimes(3); }); }); //# sourceMappingURL=validate-test.native.js.map