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.
64 lines (62 loc) • 1.95 kB
JavaScript
import React from "react";
import { Logo } from ".";
import { getImagesSrc } from "./helpers";
import createSnapshot from "../../test/create-snapshot";
describe("<Logo /> snapshot tests", function () {
it("renders correctly with type=LOGO_TYPES.WORDMARK ", function () {
var snapshot = createSnapshot(React.createElement(Logo, {
type: "wordmark"
}));
expect(snapshot).toMatchSnapshot();
});
it("renders <Logo /> correctly with theme", function () {
var theme = {
logoImages: {
square: "polestar-logo.png",
square2x: "polestar-logo-2x.png",
wordmark: "polestar-wordmark-white.png",
wordmark2x: "polestar-wordmark-white-2x.png"
},
logoImagesPath: "/logo/testpath/",
logoTypes: {
SQUARE: "square",
WORDMARK: "wordmark"
},
styles: {
logo: {
color: "#ffffff"
}
}
};
var snapshot = createSnapshot(React.createElement(Logo, {
type: theme.logoTypes.WORDMARK,
altText: "Polestar"
}), theme);
expect(snapshot).toMatchSnapshot();
});
});
describe("<Logo /> helper tests", function () {
it("returns theme images srcSet", function () {
var theme = {
logoImages: {
square: "polestar-logo.png",
square2x: "polestar-logo-2x.png",
wordmark: "polestar-wordmark-white.png",
wordmark2x: "polestar-wordmark-white-2x.png"
},
logoImagesPath: "/logo/testpath/",
logoTypes: {
SQUARE: "square",
wordmark: "wordmark"
}
};
var _getImagesSrc = getImagesSrc({
type: theme.logoTypes.SQUARE,
theme: theme
}),
src = _getImagesSrc.src,
srcSet = _getImagesSrc.srcSet;
expect(src).toEqual("".concat(theme.logoImagesPath).concat(theme.logoImages.square));
expect(srcSet).toEqual("".concat(src, ", ").concat(theme.logoImagesPath).concat(theme.logoImages.square2x, " 2x"));
});
});