Repository URL to install this package:
|
Version:
1.2.9 ▾
|
"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
// @flow
const react_1 = __importDefault(require("react"));
const enzyme_1 = require("enzyme");
const utils_1 = require("../../test/utils");
let styled;
describe('basic', () => {
beforeEach(() => {
styled = utils_1.resetNoParserStyled();
});
it('should throw a meaningful error when called with null', () => {
const invalidComps = [undefined, null, 123, []];
invalidComps.forEach(comp => {
expect(() => {
// $FlowInvalidInputTest
const Comp = styled(comp);
enzyme_1.shallow(react_1.default.createElement(Comp, null));
// $FlowInvalidInputTest
}).toThrow(`Cannot create styled-component for component: ${comp}`);
});
});
it('should correctly assemble preprocessed CSS', () => {
const Comp = styled.div([['{ color: red; }']]);
enzyme_1.shallow(react_1.default.createElement(Comp, null));
utils_1.expectCSSMatches('.sc-a {} .b{ color: red; }');
});
it('should correctly execute passed functions and assemble preprocessed CSS', () => {
const Comp = styled.div([['{ color: ', () => 'red', '; }']]);
enzyme_1.shallow(react_1.default.createElement(Comp, null));
utils_1.expectCSSMatches('.sc-a {} .b{ color: red; }');
});
});
//# sourceMappingURL=basic.test.js.map