Repository URL to install this package:
Version:
1.2.13 ▾
|
"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("./utils");
let styled;
describe('props', () => {
beforeEach(() => {
styled = utils_1.resetStyled();
});
it('should execute interpolations and fall back', () => {
const Comp = styled.div `
color: ${props => props.fg || 'black'};
`;
enzyme_1.shallow(react_1.default.createElement(Comp, null));
utils_1.expectCSSMatches('.sc-a {} .b { color:black; }');
});
it('should execute interpolations and inject props', () => {
const Comp = styled.div `
color: ${props => props.fg || 'black'};
`;
enzyme_1.shallow(react_1.default.createElement(Comp, { fg: "red" }));
utils_1.expectCSSMatches('.sc-a {} .b { color:red; }');
});
it('should ignore non-0 falsy object interpolations', () => {
const Comp = styled.div `
${() => ({
borderWidth: 0,
colorA: null,
colorB: false,
colorC: undefined,
colorD: '',
})};
`;
enzyme_1.shallow(react_1.default.createElement(Comp, { fg: "red" }));
utils_1.expectCSSMatches('.sc-a {} .b { border-width:0; }');
});
});
//# sourceMappingURL=props.test.js.map