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.
52 lines (49 loc) • 2.31 kB
JavaScript
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 { Link } from ".";
import volvoTheme from "../../themes/volvo";
import createSnapshot from "../../test/create-snapshot";
describe("<Link /> snapshot tests", function () {
it("renders <Link /> correctly with default props", function () {
var snapshot = createSnapshot(React.createElement(Link, null, "Children"));
expect(snapshot).toMatchSnapshot();
});
it("renders <Link /> correctly with arrow=up", function () {
var snapshot = createSnapshot(React.createElement(Link, {
arrow: "up"
}, "Children"));
expect(snapshot).toMatchSnapshot();
});
it("renders <Link /> correctly with arrow=down", function () {
var snapshot = createSnapshot(React.createElement(Link, {
arrow: "down"
}, "Children"));
expect(snapshot).toMatchSnapshot();
});
it("renders <Link /> correctly with arrow=right", function () {
var snapshot = createSnapshot(React.createElement(Link, {
arrow: "right"
}, "Children"));
expect(snapshot).toMatchSnapshot();
});
it("renders <Link /> correctly with arrow=left", function () {
var snapshot = createSnapshot(React.createElement(Link, {
arrow: "left"
}, "Children"));
expect(snapshot).toMatchSnapshot();
});
it("renders <Link /> correctly with theme", function () {
var theme = _objectSpread({}, volvoTheme, {
styles: {
link: {
background: "lightgrey"
}
}
});
var snapshot = createSnapshot(React.createElement(Link, {
arrow: "left"
}, "Children"), theme);
expect(snapshot).toMatchSnapshot();
});
});