"use strict";

var React = _interopRequireWildcard(require("react"));

var _enzyme = require("enzyme");

var _index = require("../index.js");

var _block = _interopRequireDefault(require("../../block/block.js"));

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = Object.defineProperty && Object.getOwnPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : {}; if (desc.get || desc.set) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } } newObj.default = obj; return newObj; } }

function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; var ownKeys = Object.keys(source); if (typeof Object.getOwnPropertySymbols === 'function') { ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function (sym) { return Object.getOwnPropertyDescriptor(source, sym).enumerable; })); } ownKeys.forEach(function (key) { _defineProperty(target, key, source[key]); }); } return target; }

function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }

function getStyle(element) {
  return (0, _enzyme.shallow)(element).find(_block.default).props();
}

var BASIC_TESTS = {
  Caption1: {
    as: 'div',
    font: 'font200',
    color: 'colorSecondary',
    children: 'test',
    overrides: {}
  },
  Caption2: {
    as: 'div',
    font: 'font250',
    color: 'colorSecondary',
    children: 'test',
    overrides: {}
  },
  Display: {
    as: 'div',
    font: 'font1100',
    color: 'colorPrimary',
    children: 'test',
    overrides: {}
  },
  H1: {
    as: 'h1',
    font: 'font1000',
    color: 'colorPrimary',
    children: 'test',
    overrides: {}
  },
  H2: {
    as: 'h2',
    font: 'font900',
    color: 'colorPrimary',
    children: 'test',
    overrides: {}
  },
  H3: {
    as: 'h3',
    font: 'font800',
    color: 'colorPrimary',
    children: 'test',
    overrides: {}
  },
  H4: {
    as: 'h4',
    font: 'font700',
    color: 'colorPrimary',
    children: 'test',
    overrides: {}
  },
  H5: {
    as: 'h5',
    font: 'font600',
    color: 'colorPrimary',
    children: 'test',
    overrides: {}
  },
  H6: {
    as: 'h6',
    font: 'font500',
    color: 'colorPrimary',
    children: 'test',
    overrides: {}
  },
  Label1: {
    as: 'div',
    font: 'font350',
    color: 'colorPrimary',
    children: 'test',
    overrides: {}
  },
  Label2: {
    as: 'div',
    font: 'font450',
    color: 'colorPrimary',
    children: 'test',
    overrides: {}
  },
  Paragraph1: {
    as: 'p',
    font: 'font300',
    color: 'colorPrimary',
    children: 'test',
    overrides: {}
  },
  Paragraph2: {
    as: 'p',
    font: 'font400',
    color: 'colorPrimary',
    children: 'test',
    overrides: {}
  }
};
describe('Typography', function () {
  it('Caption1 - shallow rendering with appropriate font', function () {
    expect(getStyle(React.createElement(_index.Caption1, null, "test"))).toEqual(BASIC_TESTS.Caption1);
    expect(getStyle(React.createElement(_index.Caption1, {
      color: "primary"
    }, "test"))).toEqual(_objectSpread({}, BASIC_TESTS.Caption1, {
      color: 'primary'
    }));
  });
  it('Caption2 - shallow rendering with appropriate font', function () {
    expect(getStyle(React.createElement(_index.Caption2, null, "test"))).toEqual(BASIC_TESTS.Caption2);
    expect(getStyle(React.createElement(_index.Caption2, {
      padding: "6px"
    }, "test"))).toEqual(_objectSpread({}, BASIC_TESTS.Caption2, {
      padding: '6px'
    }));
  });
  it('Display - shallow rendering with appropriate font', function () {
    expect(getStyle(React.createElement(_index.Display, null, "test"))).toEqual(BASIC_TESTS.Display);
    expect(getStyle(React.createElement(_index.Display, {
      paddingLeft: "20px"
    }, "test"))).toEqual(_objectSpread({}, BASIC_TESTS.Display, {
      paddingLeft: '20px'
    }));
  });
  it('H1 - shallow rendering with appropriate font', function () {
    expect(getStyle(React.createElement(_index.H1, null, "test"))).toEqual(BASIC_TESTS.H1);
    expect(getStyle(React.createElement(_index.H1, {
      marginTop: "30px"
    }, "test"))).toEqual(_objectSpread({}, BASIC_TESTS.H1, {
      marginTop: '30px'
    }));
  });
  it('H2 - shallow rendering with appropriate font', function () {
    expect(getStyle(React.createElement(_index.H2, null, "test"))).toEqual(BASIC_TESTS.H2);
    expect(getStyle(React.createElement(_index.H2, {
      position: "absolute",
      bottom: "0",
      left: "10px"
    }, "test"))).toEqual(_objectSpread({}, BASIC_TESTS.H2, {
      position: 'absolute',
      bottom: '0',
      left: '10px'
    }));
  });
  it('H3 - shallow rendering with appropriate font', function () {
    expect(getStyle(React.createElement(_index.H3, null, "test"))).toEqual(BASIC_TESTS.H3);
    expect(getStyle(React.createElement(_index.H3, {
      position: "sticky",
      top: "4rem"
    }, "test"))).toEqual(_objectSpread({}, BASIC_TESTS.H3, {
      position: 'sticky',
      top: '4rem'
    }));
  });
  it('H4 - shallow rendering with appropriate font', function () {
    expect(getStyle(React.createElement(_index.H4, null, "test"))).toEqual(BASIC_TESTS.H4);
    expect(getStyle(React.createElement(_index.H4, {
      maxWidth: "30px"
    }, "test"))).toEqual(_objectSpread({}, BASIC_TESTS.H4, {
      maxWidth: '30px'
    }));
  });
  it('H5 - shallow rendering with appropriate font', function () {
    expect(getStyle(React.createElement(_index.H5, null, "test"))).toEqual(BASIC_TESTS.H5);
    expect(getStyle(React.createElement(_index.H5, {
      minWidth: "20px"
    }, "test"))).toEqual(_objectSpread({}, BASIC_TESTS.H5, {
      minWidth: '20px'
    }));
  });
  it('H6 - shallow rendering with appropriate font', function () {
    expect(getStyle(React.createElement(_index.H6, {
      minHeight: "30px"
    }, "test"))).toEqual(_objectSpread({}, BASIC_TESTS.H6, {
      minHeight: '30px'
    }));
  });
  it('Label1 - shallow rendering with appropriate font', function () {
    expect(getStyle(React.createElement(_index.Label1, null, "test"))).toEqual(BASIC_TESTS.Label1);
    expect(getStyle(React.createElement(_index.Label1, {
      marginBottom: "20px",
      paddingTop: "10px"
    }, "test"))).toEqual(_objectSpread({}, BASIC_TESTS.Label1, {
      marginBottom: '20px',
      paddingTop: '10px'
    }));
  });
  it('Label2 - shallow rendering with appropriate font', function () {
    expect(getStyle(React.createElement(_index.Label2, null, "test"))).toEqual(BASIC_TESTS.Label2);
    expect(getStyle(React.createElement(_index.Label2, {
      marginLeft: "10px",
      paddingRight: "20px"
    }, "test"))).toEqual(_objectSpread({}, BASIC_TESTS.Label2, {
      marginLeft: '10px',
      paddingRight: '20px'
    }));
  });
  it('Paragraph1 - shallow rendering with appropriate font', function () {
    expect(getStyle(React.createElement(_index.Paragraph1, null, "test"))).toEqual(BASIC_TESTS.Paragraph1);
    expect(getStyle(React.createElement(_index.Paragraph1, {
      margin: "10px 4px",
      width: "200px"
    }, "test"))).toEqual(_objectSpread({}, BASIC_TESTS.Paragraph1, {
      margin: '10px 4px',
      width: '200px'
    }));
  });
  it('Paragraph2 - shallow rendering with appropriate font', function () {
    expect(getStyle(React.createElement(_index.Paragraph2, null, "test"))).toEqual(BASIC_TESTS.Paragraph2);
    expect(getStyle(React.createElement(_index.Paragraph2, {
      alignSelf: "center",
      justifySelf: "flex-end"
    }, "test"))).toEqual(_objectSpread({}, BASIC_TESTS.Paragraph2, {
      alignSelf: 'center',
      justifySelf: 'flex-end'
    }));
  });
});