@govuk-frederic/header-button
Advanced tools
Comparing version 0.1.1 to 0.2.0
import React from 'react'; | ||
import PropTypes from 'prop-types'; | ||
import styled from 'react-emotion'; | ||
import styled from 'styled-components'; | ||
import { FOCUS_COLOUR, LINK_ACTIVE_COLOUR, LINK_COLOUR } from 'govuk-colours'; | ||
import { NTA_LIGHT } from '@govuk-react/constants'; | ||
var Button = | ||
/*#__PURE__*/ | ||
styled('button', { | ||
target: "e4u1u2g0", | ||
label: "Button" | ||
})({ | ||
var Button = styled('button')({ | ||
background: 'none', | ||
@@ -54,3 +49,3 @@ borderBottom: '4px solid transparent', | ||
* ``` | ||
* | ||
* | ||
* Multiple header buttons | ||
@@ -63,7 +58,7 @@ * ```jsx | ||
* ``` | ||
* | ||
* | ||
* Multiple header buttons with keyline | ||
* ```jsx | ||
* import Keyline from '@govuk-frederic/keyline'; | ||
* | ||
* | ||
* <Fragment> | ||
@@ -76,3 +71,3 @@ * <Keyline> | ||
* ``` | ||
* | ||
* | ||
* Active header button | ||
@@ -82,3 +77,3 @@ * ```jsx | ||
* ``` | ||
* | ||
* | ||
* Disabled header button | ||
@@ -85,0 +80,0 @@ * ```jsx |
import React from 'react'; | ||
import { mount, shallow } from 'enzyme'; | ||
import { createMatchers } from 'jest-emotion'; | ||
import * as emotion from 'emotion'; | ||
import { mount } from 'enzyme'; | ||
import { LINK_COLOUR } from 'govuk-colours'; | ||
import HeaderButton from '.'; | ||
expect.extend(createMatchers(emotion)); | ||
describe('HeaderButton', function () { | ||
it('renders without crashing', function () { | ||
var wrapper = shallow(React.createElement(HeaderButton, null)); | ||
var wrapper = mount(React.createElement(HeaderButton, null)); | ||
expect(wrapper.exists()).toBe(true); | ||
}); | ||
it('applies styles on active prop', function () { | ||
var wrapper = shallow(React.createElement(HeaderButton, { | ||
var wrapper = mount(React.createElement(HeaderButton, { | ||
active: true | ||
})).find('Button'); | ||
})); | ||
expect(wrapper).toHaveStyleRule('border-bottom-color', LINK_COLOUR); | ||
@@ -22,5 +19,5 @@ expect(wrapper).toHaveStyleRule('border-top-color', LINK_COLOUR); | ||
it('applies styles on disabled prop', function () { | ||
var wrapper = shallow(React.createElement(HeaderButton, { | ||
var wrapper = mount(React.createElement(HeaderButton, { | ||
disabled: true | ||
})).find('Button'); | ||
})); | ||
expect(wrapper).toHaveStyleRule('opacity', '0.35'); // Can't see a way of testing pseudo-selectors here... | ||
@@ -27,0 +24,0 @@ }); |
@@ -10,3 +10,3 @@ "use strict"; | ||
var _reactEmotion = _interopRequireDefault(require("react-emotion")); | ||
var _styledComponents = _interopRequireDefault(require("styled-components")); | ||
@@ -19,8 +19,3 @@ var _govukColours = require("govuk-colours"); | ||
var Button = | ||
/*#__PURE__*/ | ||
(0, _reactEmotion.default)('button', { | ||
target: "e4u1u2g0", | ||
label: "Button" | ||
})({ | ||
var Button = (0, _styledComponents.default)('button')({ | ||
background: 'none', | ||
@@ -68,3 +63,3 @@ borderBottom: '4px solid transparent', | ||
* ``` | ||
* | ||
* | ||
* Multiple header buttons | ||
@@ -77,7 +72,7 @@ * ```jsx | ||
* ``` | ||
* | ||
* | ||
* Multiple header buttons with keyline | ||
* ```jsx | ||
* import Keyline from '@govuk-frederic/keyline'; | ||
* | ||
* | ||
* <Fragment> | ||
@@ -90,3 +85,3 @@ * <Keyline> | ||
* ``` | ||
* | ||
* | ||
* Active header button | ||
@@ -96,3 +91,3 @@ * ```jsx | ||
* ``` | ||
* | ||
* | ||
* Disabled header button | ||
@@ -110,3 +105,3 @@ * ```jsx | ||
exports.default = _default; | ||
module.exports = exports["default"]; | ||
module.exports = exports.default; | ||
//# sourceMappingURL=index.js.map |
@@ -7,6 +7,2 @@ "use strict"; | ||
var _jestEmotion = require("jest-emotion"); | ||
var emotion = _interopRequireWildcard(require("emotion")); | ||
var _govukColours = require("govuk-colours"); | ||
@@ -16,16 +12,13 @@ | ||
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('HeaderButton', 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('applies styles on active prop', function () { | ||
var wrapper = (0, _enzyme.shallow)(_react.default.createElement(_.default, { | ||
var wrapper = (0, _enzyme.mount)(_react.default.createElement(_.default, { | ||
active: true | ||
})).find('Button'); | ||
})); | ||
expect(wrapper).toHaveStyleRule('border-bottom-color', _govukColours.LINK_COLOUR); | ||
@@ -36,5 +29,5 @@ expect(wrapper).toHaveStyleRule('border-top-color', _govukColours.LINK_COLOUR); | ||
it('applies styles on disabled prop', function () { | ||
var wrapper = (0, _enzyme.shallow)(_react.default.createElement(_.default, { | ||
var wrapper = (0, _enzyme.mount)(_react.default.createElement(_.default, { | ||
disabled: true | ||
})).find('Button'); | ||
})); | ||
expect(wrapper).toHaveStyleRule('opacity', '0.35'); // Can't see a way of testing pseudo-selectors here... | ||
@@ -41,0 +34,0 @@ }); |
{ | ||
"name": "@govuk-frederic/header-button", | ||
"version": "0.1.1", | ||
"version": "0.2.0", | ||
"dependencies": { | ||
"@govuk-react/constants": "^0.2.7", | ||
"@govuk-react/constants": "^0.6.0-alpha.1", | ||
"govuk-colours": "^1.0.3" | ||
}, | ||
"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 @@ }, |
import React from 'react'; | ||
import PropTypes from 'prop-types'; | ||
import styled from 'react-emotion'; | ||
import styled from 'styled-components'; | ||
@@ -56,3 +56,3 @@ import { FOCUS_COLOUR, LINK_ACTIVE_COLOUR, LINK_COLOUR } from 'govuk-colours'; | ||
* ``` | ||
* | ||
* | ||
* Multiple header buttons | ||
@@ -65,7 +65,7 @@ * ```jsx | ||
* ``` | ||
* | ||
* | ||
* Multiple header buttons with keyline | ||
* ```jsx | ||
* import Keyline from '@govuk-frederic/keyline'; | ||
* | ||
* | ||
* <Fragment> | ||
@@ -78,3 +78,3 @@ * <Keyline> | ||
* ``` | ||
* | ||
* | ||
* Active header button | ||
@@ -84,3 +84,3 @@ * ```jsx | ||
* ``` | ||
* | ||
* | ||
* Disabled header button | ||
@@ -87,0 +87,0 @@ * ```jsx |
import React from 'react'; | ||
import { mount, shallow } from 'enzyme'; | ||
import { createMatchers } from 'jest-emotion'; | ||
import * as emotion from 'emotion'; | ||
import { mount } from 'enzyme'; | ||
import { LINK_COLOUR } from 'govuk-colours'; | ||
@@ -9,7 +7,5 @@ | ||
expect.extend(createMatchers(emotion)); | ||
describe('HeaderButton', () => { | ||
it('renders without crashing', () => { | ||
const wrapper = shallow(<HeaderButton />); | ||
const wrapper = mount(<HeaderButton />); | ||
expect(wrapper.exists()).toBe(true); | ||
@@ -19,3 +15,3 @@ }); | ||
it('applies styles on active prop', () => { | ||
const wrapper = shallow(<HeaderButton active />).find('Button'); | ||
const wrapper = mount(<HeaderButton active />); | ||
expect(wrapper).toHaveStyleRule('border-bottom-color', LINK_COLOUR); | ||
@@ -25,5 +21,5 @@ expect(wrapper).toHaveStyleRule('border-top-color', LINK_COLOUR); | ||
}); | ||
it('applies styles on disabled prop', () => { | ||
const wrapper = shallow(<HeaderButton disabled />).find('Button'); | ||
const wrapper = mount(<HeaderButton disabled />); | ||
expect(wrapper).toHaveStyleRule('opacity', '0.35'); | ||
@@ -30,0 +26,0 @@ // Can't see a way of testing pseudo-selectors here... |
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
34503
4
0
444
+ 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-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.8(transitive)
+ Addedpicocolors@1.1.1(transitive)
+ Addedpostcss@8.4.49(transitive)
+ Addedpostcss-value-parser@4.2.0(transitive)
+ Addedreact-dom@19.0.0(transitive)
+ Addedscheduler@0.25.0(transitive)
+ Addedshallowequal@1.1.0(transitive)
+ Addedsource-map-js@1.2.1(transitive)
+ Addedstyled-components@6.1.15(transitive)
+ Addedstylis@4.3.2(transitive)
+ Addedtslib@2.6.2(transitive)
- Removed@govuk-react/constants@0.2.7(transitive)
- Removedemotion@11.0.0(transitive)
- Removedjs-tokens@4.0.0(transitive)
- Removedloose-envify@1.4.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)