@govuk-frederic/result-count
Advanced tools
Comparing version 0.0.3 to 0.1.0
@@ -52,8 +52,3 @@ import React from 'react'; | ||
}; | ||
ResultCount.propTypes = process.env.NODE_ENV !== "production" ? { | ||
backgroundColor: PropTypes.string, | ||
children: PropTypes.node, | ||
color: PropTypes.string | ||
} : {}; | ||
export default ResultCount; | ||
//# sourceMappingURL=index.js.map |
@@ -5,27 +5,29 @@ import React from 'react'; | ||
import * as emotion from 'emotion'; | ||
import { GREY_1, WHITE } from 'govuk-colours'; | ||
import Component from '.'; | ||
import ResultCount from '.'; | ||
expect.extend(createMatchers(emotion)); | ||
describe('ResultCount', function () { | ||
var wrapper; | ||
it('renders with expected style rule', function () { | ||
wrapper = shallow(React.createElement(Component, null)); | ||
expect(wrapper).toHaveStyleRule('line-height', '1.25'); | ||
it('renders without crashing', function () { | ||
var wrapper = shallow(React.createElement(ResultCount, null)); | ||
expect(wrapper.exists()).toBe(true); | ||
}); | ||
it('renders with count', function () { | ||
wrapper = shallow(React.createElement(Component, null, "000")); | ||
var wrapper = shallow(React.createElement(ResultCount, null, "000")); | ||
expect(wrapper.childAt(0).text()).toBe('000'); | ||
}); | ||
it('applies style rules according to props', function () { | ||
expect(wrapper).toHaveStyleRule('color', WHITE); | ||
expect(wrapper).toHaveStyleRule('background', GREY_1); | ||
wrapper = shallow(React.createElement(Component, { | ||
color: "blue", | ||
backgroundColor: "yellow" | ||
}, "000")); | ||
expect(wrapper).toHaveStyleRule('color', 'blue'); | ||
expect(wrapper).toHaveStyleRule('background', 'yellow'); | ||
describe('applies styles in response to props', function () { | ||
it('sets color from prop', function () { | ||
var wrapper = shallow(React.createElement(ResultCount, { | ||
color: "blue" | ||
}, "000")); | ||
expect(wrapper).toHaveStyleRule('color', 'blue'); | ||
}); | ||
it('sets background from prop', function () { | ||
var wrapper = shallow(React.createElement(ResultCount, { | ||
backgroundColor: "yellow" | ||
}, "000")); | ||
expect(wrapper).toHaveStyleRule('background', 'yellow'); | ||
}); | ||
}); | ||
it('matches snapshot', function () { | ||
wrapper = mount(React.createElement(Component, null, "0")); | ||
var wrapper = mount(React.createElement(ResultCount, null, "0")); | ||
expect(wrapper).toMatchSnapshot(); | ||
@@ -32,0 +34,0 @@ }); |
@@ -64,7 +64,2 @@ "use strict"; | ||
}; | ||
ResultCount.propTypes = process.env.NODE_ENV !== "production" ? { | ||
backgroundColor: _propTypes.default.string, | ||
children: _propTypes.default.node, | ||
color: _propTypes.default.string | ||
} : {}; | ||
var _default = ResultCount; | ||
@@ -71,0 +66,0 @@ exports.default = _default; |
@@ -11,4 +11,2 @@ "use strict"; | ||
var _govukColours = require("govuk-colours"); | ||
var _ = _interopRequireDefault(require(".")); | ||
@@ -22,23 +20,26 @@ | ||
describe('ResultCount', function () { | ||
var wrapper; | ||
it('renders with expected style rule', function () { | ||
wrapper = (0, _enzyme.shallow)(_react.default.createElement(_.default, null)); | ||
expect(wrapper).toHaveStyleRule('line-height', '1.25'); | ||
it('renders without crashing', function () { | ||
var wrapper = (0, _enzyme.shallow)(_react.default.createElement(_.default, null)); | ||
expect(wrapper.exists()).toBe(true); | ||
}); | ||
it('renders with count', function () { | ||
wrapper = (0, _enzyme.shallow)(_react.default.createElement(_.default, null, "000")); | ||
var wrapper = (0, _enzyme.shallow)(_react.default.createElement(_.default, null, "000")); | ||
expect(wrapper.childAt(0).text()).toBe('000'); | ||
}); | ||
it('applies style rules according to props', function () { | ||
expect(wrapper).toHaveStyleRule('color', _govukColours.WHITE); | ||
expect(wrapper).toHaveStyleRule('background', _govukColours.GREY_1); | ||
wrapper = (0, _enzyme.shallow)(_react.default.createElement(_.default, { | ||
color: "blue", | ||
backgroundColor: "yellow" | ||
}, "000")); | ||
expect(wrapper).toHaveStyleRule('color', 'blue'); | ||
expect(wrapper).toHaveStyleRule('background', 'yellow'); | ||
describe('applies styles in response to props', function () { | ||
it('sets color from prop', function () { | ||
var wrapper = (0, _enzyme.shallow)(_react.default.createElement(_.default, { | ||
color: "blue" | ||
}, "000")); | ||
expect(wrapper).toHaveStyleRule('color', 'blue'); | ||
}); | ||
it('sets background from prop', function () { | ||
var wrapper = (0, _enzyme.shallow)(_react.default.createElement(_.default, { | ||
backgroundColor: "yellow" | ||
}, "000")); | ||
expect(wrapper).toHaveStyleRule('background', 'yellow'); | ||
}); | ||
}); | ||
it('matches snapshot', function () { | ||
wrapper = (0, _enzyme.mount)(_react.default.createElement(_.default, null, "0")); | ||
var wrapper = (0, _enzyme.mount)(_react.default.createElement(_.default, null, "0")); | ||
expect(wrapper).toMatchSnapshot(); | ||
@@ -45,0 +46,0 @@ }); |
{ | ||
"name": "@govuk-frederic/result-count", | ||
"version": "0.0.3", | ||
"version": "0.1.0", | ||
"dependencies": { | ||
@@ -5,0 +5,0 @@ "@govuk-react/constants": "^0.2.7", |
@@ -5,5 +5,4 @@ import React from 'react'; | ||
import * as emotion from 'emotion'; | ||
import { GREY_1, WHITE } from 'govuk-colours'; | ||
import Component from '.'; | ||
import ResultCount from '.'; | ||
@@ -13,24 +12,26 @@ expect.extend(createMatchers(emotion)); | ||
describe('ResultCount', () => { | ||
let wrapper; | ||
it('renders with expected style rule', () => { | ||
wrapper = shallow(<Component />); | ||
expect(wrapper).toHaveStyleRule('line-height', '1.25'); | ||
it('renders without crashing', () => { | ||
const wrapper = shallow(<ResultCount />); | ||
expect(wrapper.exists()).toBe(true); | ||
}); | ||
it('renders with count', () => { | ||
wrapper = shallow(<Component>000</Component>); | ||
const wrapper = shallow(<ResultCount>000</ResultCount>); | ||
expect(wrapper.childAt(0).text()).toBe('000'); | ||
}); | ||
it('applies style rules according to props', () => { | ||
expect(wrapper).toHaveStyleRule('color', WHITE); | ||
expect(wrapper).toHaveStyleRule('background', GREY_1); | ||
wrapper = shallow(<Component color="blue" backgroundColor="yellow">000</Component>); | ||
expect(wrapper).toHaveStyleRule('color', 'blue'); | ||
expect(wrapper).toHaveStyleRule('background', 'yellow'); | ||
describe('applies styles in response to props', () => { | ||
it('sets color from prop', () => { | ||
const wrapper = shallow(<ResultCount color="blue">000</ResultCount>); | ||
expect(wrapper).toHaveStyleRule('color', 'blue'); | ||
}); | ||
it('sets background from prop', () => { | ||
const wrapper = shallow(<ResultCount backgroundColor="yellow">000</ResultCount>); | ||
expect(wrapper).toHaveStyleRule('background', 'yellow'); | ||
}); | ||
}); | ||
it('matches snapshot', () => { | ||
wrapper = mount(<Component>0</Component>); | ||
const wrapper = mount(<ResultCount>0</ResultCount>); | ||
expect(wrapper).toMatchSnapshot(); | ||
@@ -37,0 +38,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
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 1 instance in 1 package
1
27436
359