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.
43 lines (41 loc) • 1.83 kB
JavaScript
function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
import React from "react";
import { Box } from ".";
import createSnapshot from "../../test/create-snapshot";
describe("<Box /> snapshot tests", function () {
it("renders <Box /> component correctly with default props", function () {
var snapshot = createSnapshot(React.createElement(Box, null, "Children"));
expect(snapshot).toMatchSnapshot();
});
it("renders <Box /> component correctly with a string given as 'as' prop", function () {
var snapshot = createSnapshot(React.createElement(Box, {
as: "span"
}, "Children"));
expect(snapshot).toMatchSnapshot();
});
it("renders <Box /> component correctly with extended styles", function () {
var snapshot = createSnapshot(React.createElement(Box, {
extend: {
color: "blue"
}
}, "Children"));
expect(snapshot).toMatchSnapshot();
});
it("renders <Box /> component correctly with a React element given as 'as' prop", function () {
var CustomElement = function CustomElement(props) {
return React.createElement("h1", _extends({
"data-custom": "true"
}, props));
};
var snapshot = createSnapshot(React.createElement(Box, {
as: CustomElement
}, "Children"));
expect(snapshot).toMatchSnapshot();
});
it("renders <Box /> component correctly with added custom className", function () {
var snapshot = createSnapshot(React.createElement(Box, {
className: "test-class"
}, "Children"));
expect(snapshot).toMatchSnapshot();
});
});