@govuk-react/caption
Advanced tools
Comparing version 0.9.0 to 0.9.1
@@ -5,9 +5,8 @@ function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); } | ||
import React from 'react'; | ||
import PropTypes from 'prop-types'; | ||
import { SECONDARY_TEXT_COLOUR } from 'govuk-colours'; | ||
import { spacing, typography } from '@govuk-react/lib'; | ||
import { CAPTION_SIZES, MEDIA_QUERIES, SPACING_POINTS, TYPOGRAPHY_SCALE } from '@govuk-react/constants'; | ||
import { CAPTION_SIZES, MEDIA_QUERIES, SPACING_POINTS } from '@govuk-react/constants'; | ||
var StyledCaption = styled('span').withConfig({ | ||
displayName: "src__StyledCaption", | ||
componentId: "sc-1uq9o1t-0" | ||
componentId: "dd9g0r-0" | ||
})(function (_ref) { | ||
@@ -14,0 +13,0 @@ var size = _ref.size; |
import React from 'react'; | ||
import { mount } from 'enzyme'; | ||
import { render } from '@testing-library/react'; | ||
import Caption from './fixtures'; | ||
@@ -17,12 +17,13 @@ describe('Caption', function () { | ||
}); | ||
it('allows custom string-based font size without crashing', function () { | ||
var sizes = ['XL', 'XLARGE', 'L', 'LARGE', 'M', 'MEDIUM']; | ||
sizes.forEach(function (size) { | ||
expect(mount( /*#__PURE__*/React.createElement(Caption, { | ||
size: size | ||
}, "Tests")).exists()).toBeTruthy(); | ||
describe('renders custom string-based font sizes', function () { | ||
['XL', 'XLARGE', 'L', 'LARGE', 'M', 'MEDIUM'].forEach(function (size) { | ||
it("shows a '" + size + "' item", function () { | ||
expect(render( /*#__PURE__*/React.createElement(Caption, { | ||
size: size | ||
}, "Tests")).getByText('Tests')).toBeInTheDocument(); | ||
}); | ||
}); | ||
}); | ||
it('allows custom numeric GDS font size without crashing', function () { | ||
mount( /*#__PURE__*/React.createElement(Caption, { | ||
render( /*#__PURE__*/React.createElement(Caption, { | ||
size: 16 | ||
@@ -33,3 +34,3 @@ }, "Test")); | ||
expect(function () { | ||
mount( /*#__PURE__*/React.createElement(Caption, { | ||
render( /*#__PURE__*/React.createElement(Caption, { | ||
size: 0 | ||
@@ -39,3 +40,3 @@ }, "example")); | ||
expect(function () { | ||
mount( /*#__PURE__*/React.createElement(Caption, { | ||
render( /*#__PURE__*/React.createElement(Caption, { | ||
size: 1 | ||
@@ -45,3 +46,3 @@ }, "example")); | ||
expect(function () { | ||
mount( /*#__PURE__*/React.createElement(Caption, { | ||
render( /*#__PURE__*/React.createElement(Caption, { | ||
size: 99999 | ||
@@ -51,3 +52,3 @@ }, "example")); | ||
expect(function () { | ||
mount( /*#__PURE__*/React.createElement(Caption, { | ||
render( /*#__PURE__*/React.createElement(Caption, { | ||
size: "test" | ||
@@ -57,6 +58,3 @@ }, "example")); | ||
}); | ||
it('matches wrapper snapshot', function () { | ||
expect(mount( /*#__PURE__*/React.createElement(Caption, null, "Heading text"))).toMatchSnapshot(); | ||
}); | ||
}); | ||
//# sourceMappingURL=test.js.map |
@@ -10,4 +10,2 @@ "use strict"; | ||
var _propTypes = _interopRequireDefault(require("prop-types")); | ||
var _govukColours = require("govuk-colours"); | ||
@@ -25,3 +23,3 @@ | ||
displayName: "src__StyledCaption", | ||
componentId: "sc-1uq9o1t-0" | ||
componentId: "dd9g0r-0" | ||
})(function (_ref) { | ||
@@ -28,0 +26,0 @@ var size = _ref.size; |
@@ -5,3 +5,3 @@ "use strict"; | ||
var _enzyme = require("enzyme"); | ||
var _react2 = require("@testing-library/react"); | ||
@@ -25,12 +25,13 @@ var _fixtures = _interopRequireDefault(require("./fixtures")); | ||
}); | ||
it('allows custom string-based font size without crashing', function () { | ||
var sizes = ['XL', 'XLARGE', 'L', 'LARGE', 'M', 'MEDIUM']; | ||
sizes.forEach(function (size) { | ||
expect((0, _enzyme.mount)( /*#__PURE__*/_react["default"].createElement(_fixtures["default"], { | ||
size: size | ||
}, "Tests")).exists()).toBeTruthy(); | ||
describe('renders custom string-based font sizes', function () { | ||
['XL', 'XLARGE', 'L', 'LARGE', 'M', 'MEDIUM'].forEach(function (size) { | ||
it("shows a '" + size + "' item", function () { | ||
expect((0, _react2.render)( /*#__PURE__*/_react["default"].createElement(_fixtures["default"], { | ||
size: size | ||
}, "Tests")).getByText('Tests')).toBeInTheDocument(); | ||
}); | ||
}); | ||
}); | ||
it('allows custom numeric GDS font size without crashing', function () { | ||
(0, _enzyme.mount)( /*#__PURE__*/_react["default"].createElement(_fixtures["default"], { | ||
(0, _react2.render)( /*#__PURE__*/_react["default"].createElement(_fixtures["default"], { | ||
size: 16 | ||
@@ -41,3 +42,3 @@ }, "Test")); | ||
expect(function () { | ||
(0, _enzyme.mount)( /*#__PURE__*/_react["default"].createElement(_fixtures["default"], { | ||
(0, _react2.render)( /*#__PURE__*/_react["default"].createElement(_fixtures["default"], { | ||
size: 0 | ||
@@ -47,3 +48,3 @@ }, "example")); | ||
expect(function () { | ||
(0, _enzyme.mount)( /*#__PURE__*/_react["default"].createElement(_fixtures["default"], { | ||
(0, _react2.render)( /*#__PURE__*/_react["default"].createElement(_fixtures["default"], { | ||
size: 1 | ||
@@ -53,3 +54,3 @@ }, "example")); | ||
expect(function () { | ||
(0, _enzyme.mount)( /*#__PURE__*/_react["default"].createElement(_fixtures["default"], { | ||
(0, _react2.render)( /*#__PURE__*/_react["default"].createElement(_fixtures["default"], { | ||
size: 99999 | ||
@@ -59,3 +60,3 @@ }, "example")); | ||
expect(function () { | ||
(0, _enzyme.mount)( /*#__PURE__*/_react["default"].createElement(_fixtures["default"], { | ||
(0, _react2.render)( /*#__PURE__*/_react["default"].createElement(_fixtures["default"], { | ||
size: "test" | ||
@@ -65,6 +66,3 @@ }, "example")); | ||
}); | ||
it('matches wrapper snapshot', function () { | ||
expect((0, _enzyme.mount)( /*#__PURE__*/_react["default"].createElement(_fixtures["default"], null, "Heading text"))).toMatchSnapshot(); | ||
}); | ||
}); | ||
//# sourceMappingURL=test.js.map |
{ | ||
"name": "@govuk-react/caption", | ||
"version": "0.9.0", | ||
"version": "0.9.1", | ||
"dependencies": { | ||
"@govuk-react/constants": "^0.9.0", | ||
"@govuk-react/lib": "^0.9.0", | ||
"@govuk-react/constants": "^0.9.1", | ||
"@govuk-react/lib": "^0.9.1", | ||
"govuk-colours": "^1.1.0" | ||
@@ -15,4 +15,4 @@ }, | ||
"build": "yarn build:lib && yarn build:es", | ||
"build:lib": "rimraf lib && babel src -d lib --source-maps --config-file ../../babel.config.js", | ||
"build:es": "rimraf es && cross-env BABEL_ENV=es babel src -d es --source-maps --config-file ../../babel.config.js", | ||
"build:lib": "rimraf lib && babel src -x .js,jsx,.ts,.tsx -d lib --source-maps --config-file ../../babel.config.js", | ||
"build:es": "rimraf es && cross-env BABEL_ENV=es babel src -x .js,jsx,.ts,.tsx -d es --source-maps --config-file ../../babel.config.js", | ||
"docs": "doc-component ./lib/index.js ./README.md" | ||
@@ -19,0 +19,0 @@ }, |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
45472
22
526
Updated@govuk-react/lib@^0.9.1