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.
36 lines (33 loc) • 1.83 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 createSnapshot from "../../test/create-snapshot";
import volvoTheme from "../../themes/volvo";
import { LoadingBar } from ".";
describe("<LoadingBar /> snapshot tests", function () {
it("renders nothing without isLoading prop", function () {
var snapshot = createSnapshot(React.createElement(LoadingBar, null));
expect(snapshot).toMatchSnapshot();
});
it("renders correctly when isLoading is true", function () {
var snapshot = createSnapshot(React.createElement(LoadingBar, {
isLoading: true
}));
expect(snapshot).toMatchSnapshot();
});
it("renders correctly with default theme", function () {
var snapshot = createSnapshot(React.createElement(LoadingBar, {
isLoading: true
}), volvoTheme);
expect(snapshot).toMatchSnapshot();
});
it("renders correctly with default theme & direction = rtl", function () {
var theme = _objectSpread({}, volvoTheme, {
direction: "rtl"
});
var snapshot = createSnapshot(React.createElement(LoadingBar, {
isLoading: true
}), theme);
expect(snapshot).toMatchSnapshot();
});
});