UNPKG

react-native-web-internals

Version:

React Native for Web

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