Why Gemfury? Push, build, and install  RubyGems npm packages Python packages Maven artifacts PHP packages Go Modules Debian packages RPM packages NuGet packages

Repository URL to install this package:

Details    
view-container / dist / test / props.test.js
Size: Mime:
"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