UNPKG

@netdata/netdata-ui

Version:

netdata UI kit

57 lines 1.27 kB
import { DefaultTheme as theme } from "../theme/default"; import padding from "./padding"; it("renders nothing", function () { expect(padding({ theme: theme })).toBe(""); }); it("renders padding 0px", function () { expect(padding({ theme: theme, padding: [0] })).toBe("padding: 0;"); }); it("renders padding 4px 16px", function () { expect(padding({ theme: theme, padding: [1, 4] })).toBe("padding: 4px 16px;"); }); it("renders padding 8px 12px 16px", function () { expect(padding({ theme: theme, padding: [2, 3, 4] })).toBe("padding: 8px 12px 16px;"); }); it("renders padding 8px 12px 16px 32px", function () { expect(padding({ theme: theme, padding: [2, 3, 4, 7] })).toBe("padding: 8px 12px 16px 28px;"); }); it("renders padding on invalid value 8px auto", function () { expect(padding({ theme: theme, padding: [2, "auto"] })).toBe("padding: 8px auto;"); }); it("logs error", function () { console.error = jest.fn(); padding({ theme: theme, padding: "invalid" }); padding({ theme: theme, padding: {} }); padding({ theme: theme, padding: [] }); padding({ theme: theme, padding: [1, 2, 3, 4, 5, 6] }); expect(console.error).toHaveBeenCalledTimes(4); });