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 (36 loc) 1.9 kB
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; var ownKeys = Object.keys(source); if (typeof Object.getOwnPropertySymbols === 'function') { ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function (sym) { return Object.getOwnPropertyDescriptor(source, sym).enumerable; })); } ownKeys.forEach(function (key) { _defineProperty(target, key, source[key]); }); } return target; } 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 createSnapshot from "../../test/create-snapshot"; import volvoTheme from "../../themes/volvo"; 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 = _objectSpread({}, volvoTheme, { styles: { button: { background: "magenta" } } }); var snapshot = createSnapshot(React.createElement(Button, null, helloLabel), theme); expect(snapshot).toMatchSnapshot(); }); it("renders <Button /> with default type", function () { var snapshot = createSnapshot(React.createElement(Button, { type: undefined }, helloLabel)); expect(snapshot).toMatchSnapshot(); }); it("renders <Button /> with overriding type", function () { var snapshot = createSnapshot(React.createElement(Button, { type: "submit" }, helloLabel)); expect(snapshot).toMatchSnapshot(); }); });