@govuk-frederic/result-count-title
Advanced tools
Comparing version 0.1.1 to 0.2.0
@@ -1,14 +0,9 @@ | ||
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; } | ||
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; } | ||
import React from 'react'; | ||
import PropTypes from 'prop-types'; | ||
import styled from 'react-emotion'; | ||
import styled from 'styled-components'; | ||
import ResultCount from '@govuk-frederic/result-count'; | ||
import { NTA_LIGHT } from '@govuk-react/constants'; | ||
var Wrapper = | ||
/*#__PURE__*/ | ||
styled('div', { | ||
target: "e4u1u2g0", | ||
label: "Wrapper" | ||
})({ | ||
var Wrapper = styled('div')({ | ||
display: 'inline-block', | ||
@@ -18,8 +13,3 @@ whiteSpace: 'nowrap', | ||
}); | ||
var Title = | ||
/*#__PURE__*/ | ||
styled('div', { | ||
target: "e4u1u2g1", | ||
label: "Title" | ||
})({ | ||
var Title = styled('div')({ | ||
display: 'inline-block', | ||
@@ -51,3 +41,3 @@ fontFamily: NTA_LIGHT, | ||
countColor = _ref.countColor, | ||
props = _objectWithoutProperties(_ref, ["countBackgroundColor", "children", "count", "countColor"]); | ||
props = _objectWithoutPropertiesLoose(_ref, ["countBackgroundColor", "children", "count", "countColor"]); | ||
@@ -54,0 +44,0 @@ return React.createElement(Wrapper, props, React.createElement(ResultCount, { |
import React from 'react'; | ||
import { mount, shallow } from 'enzyme'; | ||
import { createMatchers } from 'jest-emotion'; | ||
import * as emotion from 'emotion'; | ||
import { mount } from 'enzyme'; | ||
import ResultCountTitle from '.'; | ||
expect.extend(createMatchers(emotion)); | ||
describe('ResultCountTitle', function () { | ||
it('renders without crashing', function () { | ||
var wrapper = shallow(React.createElement(ResultCountTitle, null)); | ||
var wrapper = mount(React.createElement(ResultCountTitle, null)); | ||
expect(wrapper.exists()).toBe(true); | ||
}); | ||
it('renders with count', function () { | ||
var wrapper = shallow(React.createElement(ResultCountTitle, { | ||
var wrapper = mount(React.createElement(ResultCountTitle, { | ||
count: "000" | ||
})); | ||
expect(wrapper.find('ResultCount').childAt(0).text()).toBe('000'); | ||
expect(wrapper.text()).toContain('000'); | ||
}); | ||
it('renders with title', function () { | ||
var wrapper = shallow(React.createElement(ResultCountTitle, null, "Title")); | ||
expect(wrapper.find('Title').childAt(0).text()).toBe('Title'); | ||
var wrapper = mount(React.createElement(ResultCountTitle, null, "Title")); | ||
expect(wrapper.text()).toContain('Title'); | ||
}); | ||
@@ -22,0 +19,0 @@ it('matches snapshot', function () { |
@@ -10,3 +10,3 @@ "use strict"; | ||
var _reactEmotion = _interopRequireDefault(require("react-emotion")); | ||
var _styledComponents = _interopRequireDefault(require("styled-components")); | ||
@@ -19,10 +19,5 @@ var _resultCount = _interopRequireDefault(require("@govuk-frederic/result-count")); | ||
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; } | ||
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; } | ||
var Wrapper = | ||
/*#__PURE__*/ | ||
(0, _reactEmotion.default)('div', { | ||
target: "e4u1u2g0", | ||
label: "Wrapper" | ||
})({ | ||
var Wrapper = (0, _styledComponents.default)('div')({ | ||
display: 'inline-block', | ||
@@ -32,8 +27,3 @@ whiteSpace: 'nowrap', | ||
}); | ||
var Title = | ||
/*#__PURE__*/ | ||
(0, _reactEmotion.default)('div', { | ||
target: "e4u1u2g1", | ||
label: "Title" | ||
})({ | ||
var Title = (0, _styledComponents.default)('div')({ | ||
display: 'inline-block', | ||
@@ -65,3 +55,3 @@ fontFamily: _constants.NTA_LIGHT, | ||
countColor = _ref.countColor, | ||
props = _objectWithoutProperties(_ref, ["countBackgroundColor", "children", "count", "countColor"]); | ||
props = _objectWithoutPropertiesLoose(_ref, ["countBackgroundColor", "children", "count", "countColor"]); | ||
@@ -76,3 +66,3 @@ return _react.default.createElement(Wrapper, props, _react.default.createElement(_resultCount.default, { | ||
exports.default = _default; | ||
module.exports = exports["default"]; | ||
module.exports = exports.default; | ||
//# sourceMappingURL=index.js.map |
@@ -7,27 +7,20 @@ "use strict"; | ||
var _jestEmotion = require("jest-emotion"); | ||
var emotion = _interopRequireWildcard(require("emotion")); | ||
var _ = _interopRequireDefault(require(".")); | ||
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 _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
expect.extend((0, _jestEmotion.createMatchers)(emotion)); | ||
describe('ResultCountTitle', function () { | ||
it('renders without crashing', function () { | ||
var wrapper = (0, _enzyme.shallow)(_react.default.createElement(_.default, null)); | ||
var wrapper = (0, _enzyme.mount)(_react.default.createElement(_.default, null)); | ||
expect(wrapper.exists()).toBe(true); | ||
}); | ||
it('renders with count', function () { | ||
var wrapper = (0, _enzyme.shallow)(_react.default.createElement(_.default, { | ||
var wrapper = (0, _enzyme.mount)(_react.default.createElement(_.default, { | ||
count: "000" | ||
})); | ||
expect(wrapper.find('ResultCount').childAt(0).text()).toBe('000'); | ||
expect(wrapper.text()).toContain('000'); | ||
}); | ||
it('renders with title', function () { | ||
var wrapper = (0, _enzyme.shallow)(_react.default.createElement(_.default, null, "Title")); | ||
expect(wrapper.find('Title').childAt(0).text()).toBe('Title'); | ||
var wrapper = (0, _enzyme.mount)(_react.default.createElement(_.default, null, "Title")); | ||
expect(wrapper.text()).toContain('Title'); | ||
}); | ||
@@ -34,0 +27,0 @@ it('matches snapshot', function () { |
{ | ||
"name": "@govuk-frederic/result-count-title", | ||
"version": "0.1.1", | ||
"version": "0.2.0", | ||
"dependencies": { | ||
"@govuk-frederic/result-count": "^0.1.1", | ||
"@govuk-react/constants": "^0.2.7" | ||
"@govuk-frederic/result-count": "^0.2.0", | ||
"@govuk-react/constants": "^0.6.0-alpha.1" | ||
}, | ||
"devDependencies": { | ||
"@govuk-react/storybook-components": "^0.2.4", | ||
"@storybook/addon-knobs": "^3.4.2" | ||
}, | ||
"peerDependencies": { | ||
"emotion": ">=9", | ||
"prop-types": ">=15", | ||
"react": ">=16.2.0", | ||
"react-emotion": ">=9" | ||
"styled-components": ">=4" | ||
}, | ||
"scripts": { | ||
"build": "npm run build:lib && npm run build:es", | ||
"build:lib": "rimraf lib && babel src -d lib --source-maps", | ||
"build:es": "rimraf es && cross-env BABEL_ENV=es babel src -d es --source-maps", | ||
"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", | ||
"docs": "doc-component ./lib/index.js ./README.md" | ||
@@ -23,0 +17,0 @@ }, |
@@ -26,3 +26,3 @@ ResultCountTitle | ||
`children` | | `````` | node | | ||
`count` | | `````` | union(number|string) | | ||
`count` | | `````` | union(number \| string) | | ||
`countBackgroundColor` | | `````` | string | | ||
@@ -29,0 +29,0 @@ `countColor` | | `````` | string | |
import React from 'react'; | ||
import PropTypes from 'prop-types'; | ||
import styled from 'react-emotion'; | ||
import styled from 'styled-components'; | ||
@@ -5,0 +5,0 @@ import ResultCount from '@govuk-frederic/result-count'; |
import React from 'react'; | ||
import { mount, shallow } from 'enzyme'; | ||
import { createMatchers } from 'jest-emotion'; | ||
import * as emotion from 'emotion'; | ||
import { mount } from 'enzyme'; | ||
import ResultCountTitle from '.'; | ||
expect.extend(createMatchers(emotion)); | ||
describe('ResultCountTitle', () => { | ||
it('renders without crashing', () => { | ||
const wrapper = shallow(<ResultCountTitle />); | ||
const wrapper = mount(<ResultCountTitle />); | ||
expect(wrapper.exists()).toBe(true); | ||
@@ -17,9 +13,9 @@ }); | ||
it('renders with count', () => { | ||
const wrapper = shallow(<ResultCountTitle count="000" />); | ||
expect(wrapper.find('ResultCount').childAt(0).text()).toBe('000'); | ||
const wrapper = mount(<ResultCountTitle count="000" />); | ||
expect(wrapper.text()).toContain('000'); | ||
}); | ||
it('renders with title', () => { | ||
const wrapper = shallow(<ResultCountTitle>Title</ResultCountTitle>); | ||
expect(wrapper.find('Title').childAt(0).text()).toBe('Title'); | ||
const wrapper = mount(<ResultCountTitle>Title</ResultCountTitle>); | ||
expect(wrapper.text()).toContain('Title'); | ||
}); | ||
@@ -26,0 +22,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
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
28276
4
0
279
+ Added@emotion/is-prop-valid@1.2.2(transitive)
+ Added@emotion/memoize@0.8.1(transitive)
+ Added@emotion/unitless@0.8.1(transitive)
+ Added@govuk-frederic/result-count@0.2.0(transitive)
+ Added@govuk-react/constants@0.6.0(transitive)
+ Added@types/stylis@4.2.5(transitive)
+ Addedcamelize@1.0.1(transitive)
+ Addedcss-color-keywords@1.0.0(transitive)
+ Addedcss-to-react-native@3.2.0(transitive)
+ Addedcsstype@3.1.3(transitive)
+ Addednanoid@3.3.7(transitive)
+ Addedpicocolors@1.1.1(transitive)
+ Addedpostcss@8.4.38(transitive)
+ Addedpostcss-value-parser@4.2.0(transitive)
+ Addedreact-dom@18.3.1(transitive)
+ Addedscheduler@0.23.2(transitive)
+ Addedshallowequal@1.1.0(transitive)
+ Addedsource-map-js@1.2.1(transitive)
+ Addedstyled-components@6.1.13(transitive)
+ Addedstylis@4.3.2(transitive)
+ Addedtslib@2.6.2(transitive)
- Removed@govuk-frederic/result-count@0.1.1(transitive)
- Removed@govuk-react/constants@0.2.7(transitive)
- Removedemotion@11.0.0(transitive)
- Removedobject-assign@4.1.1(transitive)
- Removedprop-types@15.8.1(transitive)
- Removedreact-emotion@10.0.0(transitive)
- Removedreact-is@16.13.1(transitive)