UNPKG

vcc-ui

Version:

VCC UI is a collection of React UI Components that can be used for developing front-end applications at Volvo Car Corporation.

39 lines (37 loc) 1.53 kB
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } import React from "react"; import { Button } from "."; import { BREAKPOINTS } from "../../constants/breakpoints"; import createSnapshot from "../../test/create-snapshot"; describe("<Button /> snapshot tests", function () { var helloLabel = "Hello World"; it("renders <Button /> correctly with default props", function () { var snapshot = createSnapshot(React.createElement(Button, null, helloLabel)); expect(snapshot).toMatchSnapshot(); }); it("renders <Button /> correctly with theme", function () { var theme = { button: { background: "magenta" } }; var snapshot = createSnapshot(React.createElement(Button, null, helloLabel), theme); expect(snapshot).toMatchSnapshot(); }); it("renders <Button /> correctly with theme and media queries", function () { var _button; var theme = { button: { button: (_button = {}, _defineProperty(_button, BREAKPOINTS.onS, { background: "blue" }), _defineProperty(_button, BREAKPOINTS.onM, { background: "orange" }), _defineProperty(_button, BREAKPOINTS.onL, { background: "magenta" }), _button) } }; var snapshot = createSnapshot(React.createElement(Button, null, helloLabel), theme); expect(snapshot).toMatchSnapshot(); }); });