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 / staticCaching.test.js
Size: Mime:
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const utils_1 = require("./utils");
let styled;
describe('static style caching', () => {
    beforeEach(() => {
        styled = utils_1.resetStyled();
    });
    it('should mark styles without any functions as static', () => {
        const TOP_AS_NUMBER = 10;
        const FONT_SIZE_NUMBER = 14;
        const COLOR_AS_STRING = 'purple';
        const Comp = styled.div `
      color: purple;
      font-size: ${FONT_SIZE_NUMBER}px
      position: absolute;
      top: ${TOP_AS_NUMBER}
    `;
        expect(Comp.componentStyle.isStatic).toEqual(true);
    });
    it('should mark styles with a nested styled component as static', () => {
        const NestedComp = styled.div ``;
        const Comp = styled.div `
      ${NestedComp} {
        color: purple;
      }
    `;
        expect(Comp.componentStyle.isStatic).toEqual(true);
    });
    it('should mark styles with a dynamic style as not static', () => {
        const Comp = styled.div `
      color: ${props => props.color};
    `;
        expect(Comp.componentStyle.isStatic).toEqual(false);
    });
    it('should mark components with numeric attriutes as static', () => {
        const Comp = styled.div.attrs({
            style: {
                color: 'purple',
            },
            height: 100,
        }) ``;
        expect(Comp.componentStyle.isStatic).toEqual(true);
    });
    it('should mark components with dynamic attributes as not static', () => {
        const Comp = styled.div.attrs({
            style: props => ({
                height: props.height,
            }),
        }) ``;
        expect(Comp.componentStyle.isStatic).toEqual(false);
    });
});
//# sourceMappingURL=staticCaching.test.js.map