@sb1/ffe-core-react 4.2.2 → 4.2.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md DELETED
@@ -1,338 +0,0 @@
1
- # Change Log
2
-
3
- All notable changes to this project will be documented in this file.
4
- See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
-
6
- ## [4.2.2](https://github.com/SpareBank1/designsystem/compare/@sb1/ffe-core-react@4.2.1...@sb1/ffe-core-react@4.2.2) (2019-10-16)
7
-
8
- **Note:** Version bump only for package @sb1/ffe-core-react
9
-
10
- ## [4.2.1](https://github.com/SpareBank1/designsystem/compare/@sb1/ffe-core-react@4.2.0...@sb1/ffe-core-react@4.2.1) (2019-10-16)
11
-
12
- ### Bug Fixes
13
-
14
- - **ffe-core-react:** added prop-types for Heading ([f884467](https://github.com/SpareBank1/designsystem/commit/f8844673a842af78896e0f768a3fbd546482bd14))
15
-
16
- # [4.2.0](https://github.com/SpareBank1/designsystem/compare/@sb1/ffe-core-react@4.1.3...@sb1/ffe-core-react@4.2.0) (2019-10-14)
17
-
18
- ### Features
19
-
20
- - **ffe-core-react:** center leading paragraph ([c12806b](https://github.com/SpareBank1/designsystem/commit/c12806b3b6602c024ea09569856e6b69f17cd755))
21
- - **ffe-core-react:** possible to center heading ([4a563b1](https://github.com/SpareBank1/designsystem/commit/4a563b1186c95468865c9ed82f5429c89fda05c7))
22
-
23
- ## [4.1.3](https://github.com/SpareBank1/designsystem/compare/@sb1/ffe-core-react@4.1.2...@sb1/ffe-core-react@4.1.3) (2019-10-09)
24
-
25
- ### Bug Fixes
26
-
27
- - **ffe-core-react:** bump prop-types ([7f88f98](https://github.com/SpareBank1/designsystem/commit/7f88f98a524328efc72d62dee335cd10687aa53f))
28
- - **ffe-core-react:** element-type for type script ([f041763](https://github.com/SpareBank1/designsystem/commit/f04176300b4ef9e361d5a833cdc882190a9bf3a8))
29
-
30
- ## [4.1.2](https://github.com/SpareBank1/designsystem/compare/@sb1/ffe-core-react@4.1.1...@sb1/ffe-core-react@4.1.2) (2019-10-03)
31
-
32
- ### Bug Fixes
33
-
34
- - **ffe-core-react:** element prop-type needs elementType ([95d0ce1](https://github.com/SpareBank1/designsystem/commit/95d0ce1))
35
-
36
- ## [4.1.1](https://github.com/SpareBank1/designsystem/compare/@sb1/ffe-core-react@4.1.0...@sb1/ffe-core-react@4.1.1) (2019-09-16)
37
-
38
- **Note:** Version bump only for package @sb1/ffe-core-react
39
-
40
- # [4.1.0](https://github.com/SpareBank1/designsystem/compare/@sb1/ffe-core-react@4.0.0...@sb1/ffe-core-react@4.1.0) (2019-09-10)
41
-
42
- ### Features
43
-
44
- - **ffe-core-react:** custom element for SmallText ([6240db0](https://github.com/SpareBank1/designsystem/commit/6240db0))
45
-
46
- # [4.0.0](https://github.com/SpareBank1/designsystem/compare/@sb1/ffe-core-react@3.3.0...@sb1/ffe-core-react@4.0.0) (2019-08-27)
47
-
48
- ### chore
49
-
50
- - bump React to 16.9 to allow for using hooks etc ([e3901f1](https://github.com/SpareBank1/designsystem/commit/e3901f1))
51
-
52
- ### BREAKING CHANGES
53
-
54
- - peerDep of React is raised to 16.9. While this in itself
55
- isn't a breaking change, it allows for the use of hooks in later releases.
56
- Such changes would just be a minor version, or even a patch, but without
57
- this major version bump it would result in a runtime error for consumers.
58
-
59
- # [3.3.0](https://github.com/SpareBank1/designsystem/compare/@sb1/ffe-core-react@3.2.6...@sb1/ffe-core-react@3.3.0) (2019-05-10)
60
-
61
- ### Features
62
-
63
- - **ffe-core-react:** Added type definitions for typescript ([630b457](https://github.com/SpareBank1/designsystem/commit/630b457))
64
-
65
- ## [3.2.6](https://github.com/SpareBank1/designsystem/compare/@sb1/ffe-core-react@3.2.5...@sb1/ffe-core-react@3.2.6) (2018-12-11)
66
-
67
- ### Bug Fixes
68
-
69
- - Build tree shakeable packages ([fb4a9ea](https://github.com/SpareBank1/designsystem/commit/fb4a9ea))
70
-
71
- ## [3.2.5](https://github.com/SpareBank1/designsystem/compare/@sb1/ffe-core-react@3.2.4...@sb1/ffe-core-react@3.2.5) (2018-12-04)
72
-
73
- **Note:** Version bump only for package @sb1/ffe-core-react
74
-
75
- ## [3.2.4](https://github.com/SpareBank1/designsystem/compare/@sb1/ffe-core-react@3.2.3...@sb1/ffe-core-react@3.2.4) (2018-11-26)
76
-
77
- **Note:** Version bump only for package @sb1/ffe-core-react
78
-
79
- ## [3.2.3](https://github.com/SpareBank1/designsystem/compare/@sb1/ffe-core-react@3.2.2...@sb1/ffe-core-react@3.2.3) (2018-11-08)
80
-
81
- **Note:** Version bump only for package @sb1/ffe-core-react
82
-
83
- <a name="3.2.2"></a>
84
-
85
- ## [3.2.2](https://github.com/SpareBank1/designsystem/compare/@sb1/ffe-core-react@3.2.1...@sb1/ffe-core-react@3.2.2) (2018-08-09)
86
-
87
- **Note:** Version bump only for package @sb1/ffe-core-react
88
-
89
- <a name="3.2.1"></a>
90
-
91
- ## [3.2.1](https://github.com/SpareBank1/designsystem/compare/@sb1/ffe-core-react@3.2.0...@sb1/ffe-core-react@3.2.1) (2018-06-20)
92
-
93
- ### Bug Fixes
94
-
95
- - **ffe-core-react:** added peerDependency to ffe-core@^13.0.0 ([d1a6451](https://github.com/SpareBank1/designsystem/commit/d1a6451))
96
-
97
- <a name="3.2.0"></a>
98
-
99
- # [3.2.0](https://github.com/SpareBank1/designsystem/compare/@sb1/ffe-core-react@3.1.0...@sb1/ffe-core-react@3.2.0) (2018-06-19)
100
-
101
- ### Features
102
-
103
- - **ffe-core-react:** Add `LinkText` component ([b51ed59](https://github.com/SpareBank1/designsystem/commit/b51ed59))
104
-
105
- <a name="3.1.0"></a>
106
-
107
- # [3.1.0](https://github.com/SpareBank1/designsystem/compare/@sb1/ffe-core-react@3.0.0...@sb1/ffe-core-react@3.1.0) (2018-05-23)
108
-
109
- ### Features
110
-
111
- - **ffe-core-react:** Expose named exports ([4efe35a](https://github.com/SpareBank1/designsystem/commit/4efe35a))
112
-
113
- <a name="3.0.0"></a>
114
-
115
- # [3.0.0](https://github.com/SpareBank1/designsystem/compare/@sb1/ffe-core-react@2.0.3...@sb1/ffe-core-react@3.0.0) (2018-04-10)
116
-
117
- ### Chores
118
-
119
- - **ffe-core-react:** Remove deprecated layout ([60e8863](https://github.com/SpareBank1/designsystem/commit/60e8863))
120
-
121
- ### BREAKING CHANGES
122
-
123
- - **ffe-core-react:** Removed the React components for the deprecated
124
- Hawaii layout system. Please don't use this layout when developing
125
- new functionality and please consider moving away from it when
126
- visiting old functionality.
127
-
128
- New layouts should be based on the `ffe-grid` component.
129
-
130
- <a name="2.0.3"></a>
131
-
132
- ## [2.0.3](https://github.com/SpareBank1/designsystem/compare/@sb1/ffe-core-react@2.0.2...@sb1/ffe-core-react@2.0.3) (2018-03-27)
133
-
134
- **Note:** Version bump only for package @sb1/ffe-core-react
135
-
136
- <a name="2.0.2"></a>
137
-
138
- ## [2.0.2](https://github.com/SpareBank1/designsystem/compare/@sb1/ffe-core-react@2.0.0...@sb1/ffe-core-react@2.0.2) (2018-03-07)
139
-
140
- ### Bug Fixes
141
-
142
- - Correct peerDependencies after breaking change ([aab59ce](https://github.com/SpareBank1/designsystem/commit/aab59ce))
143
-
144
- <a name="2.0.1"></a>
145
-
146
- ## [2.0.1](https://github.com/SpareBank1/designsystem/compare/@sb1/ffe-core-react@2.0.0...@sb1/ffe-core-react@2.0.1) (2018-03-02)
147
-
148
- ### Bug Fixes
149
-
150
- - Correct peerDependencies after breaking change ([4318363](https://github.com/SpareBank1/designsystem/commit/4318363))
151
-
152
- <a name="2.0.0"></a>
153
-
154
- # 2.0.0 (2018-02-25)
155
-
156
- ### Bug Fixes
157
-
158
- - Fix a few issues with the documentation ([ab3d579](https://github.com/SpareBank1/designsystem/commit/ab3d579))
159
- - Run just 'jest', not 'jest src' ([6377dc5](https://github.com/SpareBank1/designsystem/commit/6377dc5))
160
- - **ffe-core-react:** Relax peerDeps to allow React 15. ([78eb5b4](https://github.com/SpareBank1/designsystem/commit/78eb5b4))
161
-
162
- ### Chores
163
-
164
- - add [@sb1](https://github.com/sb1)/ scope to all packages ([37efbb4](https://github.com/SpareBank1/designsystem/commit/37efbb4))
165
-
166
- ### Features
167
-
168
- - **ffe-core-react:** Add contribute.md link to readme ([1a8aab0](https://github.com/SpareBank1/designsystem/commit/1a8aab0))
169
- - **ffe-core-react:** Add new inline prop ([148bdcb](https://github.com/SpareBank1/designsystem/commit/148bdcb))
170
- - **ffe-core-react:** Upgrade to React 16 ([ef3a686](https://github.com/SpareBank1/designsystem/commit/ef3a686))
171
-
172
- ### BREAKING CHANGES
173
-
174
- - All packages have been renamed to add the @sb1 scope.
175
-
176
- See links [1] and [2] to read more about package scopes.
177
-
178
- Unfortunately this requires you update both your dependencies in
179
- `package.json` and all `import` or `require` statements in your code.
180
- Also, you unfortunately have to upgrade all FFE packages at once due to
181
- dependency between packages. If you are on the latest version prior to
182
- this breaking change the upgrade should be a matter of updating
183
- `package.json` with new package names and versions, and updating your
184
- imports.
185
-
186
- To help find the proper package versions you can either browse to the
187
- packages you need or check out the list of Git tags either on
188
- Github [3] or by cloning the repository and running the `git tag`
189
- command. All package versions get a tag in the format
190
- _package@version_.
191
-
192
- Update your `package.json` with the latest package version and add the
193
- @sb1 scope to the package name:
194
-
195
- ```diff
196
- - "ffe-core": "11.0.2",
197
- + "@sb1/ffe-core": "11.0.2",
198
- ```
199
-
200
- Scoped packages all get put in a subdirectory in `node_modules/`. In our
201
- case packages will be put in the `node_modules/@sb1/` directory. If your
202
- build depends on file paths (for instance for copying fonts) you need to
203
- update that path to include the scope.
204
-
205
- The directory structure also means you have to update your imports, both
206
- in Less and in JavaScript.
207
-
208
- Using `less-plugin-npm-import`:
209
-
210
- ```diff
211
- - @import 'npm://ffe-core/less/ffe';
212
- + @import 'npm://@sb1/ffe-core/less/ffe';
213
- ```
214
-
215
- Using Webpack:
216
-
217
- ```diff
218
- - @import '~ffe-core/less/ffe';
219
- + @import '~@sb1/ffe-core/less/ffe';
220
- ```
221
-
222
- Using plain old paths:
223
-
224
- ```diff
225
- - @import '../path/to/node_modules/ffe-core/less/ffe';
226
- + @import '../path/to/node_modules/@sb1/ffe-core/less/ffe';
227
- ```
228
-
229
- JavaScript `import`:
230
-
231
- ```diff
232
- - import { ActionButton } from 'ffe-buttons-react';
233
- + import { ActionButton } from '@sb1/ffe-buttons-react';
234
- ```
235
-
236
- JavaScript `require`:
237
-
238
- ```diff
239
- - const { ActionButton } = require('ffe-buttons-react').default;
240
- + const { ActionButton } = require('@sb1/ffe-buttons-react').default;
241
- ```
242
-
243
- [1]: https://docs.npmjs.com/misc/scope
244
- [2]: https://docs.npmjs.com/getting-started/scoped-packages
245
- [3]: https://github.com/sparebank1/designsystem/tags
246
-
247
- <a name="1.2.4"></a>
248
-
249
- ## [1.2.4](https://github.com/SpareBank1/designsystem/compare/ffe-core-react@1.2.3...ffe-core-react@1.2.4) (2018-02-23)
250
-
251
- **Note:** Version bump only for package ffe-core-react
252
-
253
- <a name="1.2.3"></a>
254
-
255
- ## [1.2.3](https://github.com/SpareBank1/designsystem/compare/ffe-core-react@1.2.2...ffe-core-react@1.2.3) (2018-02-22)
256
-
257
- **Note:** Version bump only for package ffe-core-react
258
-
259
- <a name="1.2.2"></a>
260
-
261
- ## [1.2.2](https://github.com/SpareBank1/designsystem/compare/ffe-core-react@1.2.1...ffe-core-react@1.2.2) (2018-02-21)
262
-
263
- **Note:** Version bump only for package ffe-core-react
264
-
265
- <a name="1.2.1"></a>
266
-
267
- ## [1.2.1](https://github.com/SpareBank1/designsystem/compare/ffe-core-react@1.2.0...ffe-core-react@1.2.1) (2018-01-26)
268
-
269
- ### Bug Fixes
270
-
271
- - **ffe-core-react:** Relax peerDeps to allow React 15.
272
-
273
- <a name="1.2.0"></a>
274
-
275
- # [1.2.0](https://github.com/SpareBank1/designsystem/compare/ffe-core-react@1.1.6...ffe-core-react@1.2.0) (2018-01-19)
276
-
277
- ### Features
278
-
279
- - **ffe-core-react:** Add new inline prop
280
-
281
- <a name="1.1.6"></a>
282
-
283
- ## [1.1.6](https://github.com/SpareBank1/designsystem/compare/ffe-core-react@1.1.5...ffe-core-react@1.1.6) (2018-01-19)
284
-
285
- **Note:** Version bump only for package ffe-core-react
286
-
287
- <a name="1.1.5"></a>
288
-
289
- ## [1.1.5](https://github.com/SpareBank1/designsystem/compare/ffe-core-react@1.1.4...ffe-core-react@1.1.5) (2018-01-10)
290
-
291
- ### Bug Fixes
292
-
293
- - Run just 'jest', not 'jest src'
294
-
295
- <a name="1.1.4"></a>
296
-
297
- ## [1.1.4](https://github.com/SpareBank1/designsystem/compare/ffe-core-react@1.1.3...ffe-core-react@1.1.4) (2018-01-09)
298
-
299
- **Note:** Version bump only for package ffe-core-react
300
-
301
- <a name="1.1.3"></a>
302
-
303
- ## [1.1.3](https://github.com/SpareBank1/designsystem/compare/ffe-core-react@1.1.2...ffe-core-react@1.1.3) (2018-01-05)
304
-
305
- **Note:** Version bump only for package ffe-core-react
306
-
307
- <a name="1.1.2"></a>
308
-
309
- ## [1.1.2](https://github.com/SpareBank1/designsystem/compare/ffe-core-react@1.1.1...ffe-core-react@1.1.2) (2018-01-04)
310
-
311
- **Note:** Version bump only for package ffe-core-react
312
-
313
- <a name="1.1.1"></a>
314
-
315
- ## [1.1.1](https://github.com/SpareBank1/designsystem/compare/ffe-core-react@1.1.0...ffe-core-react@1.1.1) (2018-01-02)
316
-
317
- **Note:** Version bump only for package ffe-core-react
318
-
319
- <a name="1.1.0"></a>
320
-
321
- # 1.1.0 (2017-12-22)
322
-
323
- ### Bug Fixes
324
-
325
- - Fix a few issues with the documentation
326
-
327
- ### Features
328
-
329
- - **ffe-core-react:** Add contribute.md link to readme
330
- - **ffe-core-react:** Upgrade to React 16
331
-
332
- ## v.1.0.1
333
-
334
- - Fix handling of conditional classes for Heading component
335
-
336
- # v.1.0.0
337
-
338
- - First release.
@@ -1,111 +0,0 @@
1
- function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }
2
-
3
- function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(source, true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(source).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
4
-
5
- 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; }
6
-
7
- function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; 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; }
8
-
9
- 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; }
10
-
11
- import React from 'react';
12
- import { shallow } from 'enzyme';
13
- import * as Headings from './Heading';
14
- var defaultProps = {
15
- el: Headings.Heading1,
16
- children: 'Heading'
17
- };
18
-
19
- var getWrapper = function getWrapper() {
20
- var props = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
21
-
22
- var _defaultProps$props = _objectSpread({}, defaultProps, {}, props),
23
- Heading = _defaultProps$props.el,
24
- finalProps = _objectWithoutProperties(_defaultProps$props, ["el"]);
25
-
26
- return shallow(React.createElement(Heading, finalProps));
27
- };
28
-
29
- describe('<Heading1...6 />', function () {
30
- test('renders without exploding', function () {
31
- var wrapper = getWrapper();
32
- expect(wrapper.length).toBe(1);
33
- });
34
- test('renders the correct HTML element', function () {
35
- expect(getWrapper({
36
- el: Headings.Heading1
37
- }).find('h1').length).toBe(1);
38
- expect(getWrapper({
39
- el: Headings.Heading2
40
- }).find('h2').length).toBe(1);
41
- expect(getWrapper({
42
- el: Headings.Heading3
43
- }).find('h3').length).toBe(1);
44
- expect(getWrapper({
45
- el: Headings.Heading4
46
- }).find('h4').length).toBe(1);
47
- expect(getWrapper({
48
- el: Headings.Heading5
49
- }).find('h5').length).toBe(1);
50
- expect(getWrapper({
51
- el: Headings.Heading6
52
- }).find('h6').length).toBe(1);
53
- });
54
- test('sets the correct class as default', function () {
55
- expect(getWrapper({
56
- el: Headings.Heading1
57
- }).hasClass('ffe-h1')).toBe(true);
58
- expect(getWrapper({
59
- el: Headings.Heading2
60
- }).hasClass('ffe-h2')).toBe(true);
61
- expect(getWrapper({
62
- el: Headings.Heading3
63
- }).hasClass('ffe-h3')).toBe(true);
64
- expect(getWrapper({
65
- el: Headings.Heading4
66
- }).hasClass('ffe-h4')).toBe(true);
67
- expect(getWrapper({
68
- el: Headings.Heading5
69
- }).hasClass('ffe-h5')).toBe(true);
70
- expect(getWrapper({
71
- el: Headings.Heading6
72
- }).hasClass('ffe-h6')).toBe(true);
73
- });
74
- test('overrides the class via the lookLike prop', function () {
75
- var wrapper = getWrapper({
76
- lookLike: 3
77
- });
78
- expect(wrapper.find('h1').length).toBe(1);
79
- expect(wrapper.find('h1').hasClass('ffe-h3')).toBe(true);
80
- });
81
- test('adds --error class if error prop is true', function () {
82
- var wrapper = getWrapper({
83
- error: true
84
- });
85
- expect(wrapper.hasClass('ffe-h1--error')).toBe(true);
86
- });
87
- test('adds --inline class if inline prop is true', function () {
88
- var wrapper = getWrapper({
89
- inline: true
90
- });
91
- expect(wrapper.hasClass('ffe-h1--inline')).toBe(true);
92
- });
93
- test('adds --no-margin class if noMargin prop is true', function () {
94
- var wrapper = getWrapper({
95
- noMargin: true
96
- });
97
- expect(wrapper.hasClass('ffe-h1--no-margin')).toBe(true);
98
- });
99
- test('adds --with-border class if withBorder prop is true', function () {
100
- var wrapper = getWrapper({
101
- withBorder: true
102
- });
103
- expect(wrapper.hasClass('ffe-h1--with-border')).toBe(true);
104
- });
105
- test('does not add conditional classes if no props are given', function () {
106
- var wrapper = getWrapper();
107
- expect(wrapper.hasClass('ffe-h1--error')).toBe(false);
108
- expect(wrapper.hasClass('ffe-h1--no-margin')).toBe(false);
109
- expect(wrapper.hasClass('ffe-h1--with-border')).toBe(false);
110
- });
111
- });
@@ -1,63 +0,0 @@
1
- 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); }
2
-
3
- import React from 'react';
4
- import { shallow } from 'enzyme';
5
- import LinkText from './LinkText';
6
- var defaultProps = {
7
- children: 'avtaleteksten',
8
- href: '/avtale/abc123'
9
- };
10
-
11
- var Link = function Link(props) {
12
- return React.createElement("span", props);
13
- };
14
-
15
- var getWrapper = function getWrapper(props) {
16
- return shallow(React.createElement(LinkText, _extends({}, defaultProps, props)));
17
- };
18
-
19
- describe('<LinkText />', function () {
20
- it('renders without exploding', function () {
21
- var wrapper = getWrapper();
22
- expect(wrapper.length).toBe(1);
23
- });
24
- it('renders an anchor tag by default', function () {
25
- var wrapper = getWrapper();
26
- expect(wrapper.is('a')).toBe(true);
27
- });
28
- it('lets consumers provide an element', function () {
29
- var wrapper = getWrapper({
30
- element: Link
31
- });
32
- expect(wrapper.is('Link')).toBe(true);
33
- });
34
- it('adds ffe-link-text class', function () {
35
- var wrapper = getWrapper();
36
- expect(wrapper.hasClass('ffe-link-text')).toBe(true);
37
- });
38
- it('does not add the --no-underline modifier by default', function () {
39
- var wrapper = getWrapper();
40
- expect(wrapper.hasClass('ffe-link-text--no-underline')).toBe(false);
41
- });
42
- it('adds the --no-underline modifier if underline prop is false', function () {
43
- var wrapper = getWrapper({
44
- underline: false
45
- });
46
- expect(wrapper.hasClass('ffe-link-text--no-underline')).toBe(true);
47
- });
48
- it('adds the given className next to the ffe-link-text classes', function () {
49
- var wrapper = getWrapper({
50
- className: 'some-other-class'
51
- });
52
- expect(wrapper.hasClass('ffe-link-text')).toBe(true);
53
- expect(wrapper.hasClass('some-other-class')).toBe(true);
54
- });
55
- it('passes on unrecognized props to the anchor', function () {
56
- var wrapper = getWrapper({
57
- target: '_blank',
58
- rel: 'noopener noreferrer'
59
- });
60
- expect(wrapper.props().target).toBe('_blank');
61
- expect(wrapper.props().rel).toBe('noopener noreferrer');
62
- });
63
- });
@@ -1,48 +0,0 @@
1
- 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); }
2
-
3
- import React from 'react';
4
- import { shallow } from 'enzyme';
5
- import Paragraph from './Paragraph';
6
- var defaultProps = {
7
- children: 'Test!'
8
- };
9
-
10
- var getWrapper = function getWrapper() {
11
- var props = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
12
- return shallow(React.createElement(Paragraph, _extends({}, defaultProps, props)));
13
- };
14
-
15
- describe('<Paragraph />', function () {
16
- test('renders without exploding', function () {
17
- var wrapper = getWrapper();
18
- expect(wrapper.length).toBe(1);
19
- });
20
- test('adds ffe-body-paragraph class if lead and subLead props are false (or not set)', function () {
21
- var wrapper = getWrapper();
22
- expect(wrapper.hasClass('ffe-body-paragraph')).toBe(true);
23
- });
24
- test('adds --text-center modifier if textCenter prop is true', function () {
25
- var wrapper = getWrapper({
26
- textCenter: true
27
- });
28
- expect(wrapper.hasClass('ffe-body-paragraph--text-center')).toBe(true);
29
- });
30
- test('adds --text-left modifier if textLeft prop is true', function () {
31
- var wrapper = getWrapper({
32
- textLeft: true
33
- });
34
- expect(wrapper.hasClass('ffe-body-paragraph--text-left')).toBe(true);
35
- });
36
- test('adds ffe-lead-paragraph class if lead prop is true', function () {
37
- var wrapper = getWrapper({
38
- lead: true
39
- });
40
- expect(wrapper.hasClass('ffe-lead-paragraph')).toBe(true);
41
- });
42
- test('adds ffe-sub-lead-paragraph class if lead prop is true', function () {
43
- var wrapper = getWrapper({
44
- subLead: true
45
- });
46
- expect(wrapper.hasClass('ffe-sub-lead-paragraph')).toBe(true);
47
- });
48
- });
@@ -1,122 +0,0 @@
1
- "use strict";
2
-
3
- var _react = _interopRequireDefault(require("react"));
4
-
5
- var _enzyme = require("enzyme");
6
-
7
- var Headings = _interopRequireWildcard(require("./Heading"));
8
-
9
- function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function _getRequireWildcardCache() { return cache; }; return cache; }
10
-
11
- function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; if (obj != null) { var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
12
-
13
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
14
-
15
- function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }
16
-
17
- function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(source, true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(source).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
18
-
19
- 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; }
20
-
21
- function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; 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; }
22
-
23
- 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; }
24
-
25
- var defaultProps = {
26
- el: Headings.Heading1,
27
- children: 'Heading'
28
- };
29
-
30
- var getWrapper = function getWrapper() {
31
- var props = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
32
-
33
- var _defaultProps$props = _objectSpread({}, defaultProps, {}, props),
34
- Heading = _defaultProps$props.el,
35
- finalProps = _objectWithoutProperties(_defaultProps$props, ["el"]);
36
-
37
- return (0, _enzyme.shallow)(_react.default.createElement(Heading, finalProps));
38
- };
39
-
40
- describe('<Heading1...6 />', function () {
41
- test('renders without exploding', function () {
42
- var wrapper = getWrapper();
43
- expect(wrapper.length).toBe(1);
44
- });
45
- test('renders the correct HTML element', function () {
46
- expect(getWrapper({
47
- el: Headings.Heading1
48
- }).find('h1').length).toBe(1);
49
- expect(getWrapper({
50
- el: Headings.Heading2
51
- }).find('h2').length).toBe(1);
52
- expect(getWrapper({
53
- el: Headings.Heading3
54
- }).find('h3').length).toBe(1);
55
- expect(getWrapper({
56
- el: Headings.Heading4
57
- }).find('h4').length).toBe(1);
58
- expect(getWrapper({
59
- el: Headings.Heading5
60
- }).find('h5').length).toBe(1);
61
- expect(getWrapper({
62
- el: Headings.Heading6
63
- }).find('h6').length).toBe(1);
64
- });
65
- test('sets the correct class as default', function () {
66
- expect(getWrapper({
67
- el: Headings.Heading1
68
- }).hasClass('ffe-h1')).toBe(true);
69
- expect(getWrapper({
70
- el: Headings.Heading2
71
- }).hasClass('ffe-h2')).toBe(true);
72
- expect(getWrapper({
73
- el: Headings.Heading3
74
- }).hasClass('ffe-h3')).toBe(true);
75
- expect(getWrapper({
76
- el: Headings.Heading4
77
- }).hasClass('ffe-h4')).toBe(true);
78
- expect(getWrapper({
79
- el: Headings.Heading5
80
- }).hasClass('ffe-h5')).toBe(true);
81
- expect(getWrapper({
82
- el: Headings.Heading6
83
- }).hasClass('ffe-h6')).toBe(true);
84
- });
85
- test('overrides the class via the lookLike prop', function () {
86
- var wrapper = getWrapper({
87
- lookLike: 3
88
- });
89
- expect(wrapper.find('h1').length).toBe(1);
90
- expect(wrapper.find('h1').hasClass('ffe-h3')).toBe(true);
91
- });
92
- test('adds --error class if error prop is true', function () {
93
- var wrapper = getWrapper({
94
- error: true
95
- });
96
- expect(wrapper.hasClass('ffe-h1--error')).toBe(true);
97
- });
98
- test('adds --inline class if inline prop is true', function () {
99
- var wrapper = getWrapper({
100
- inline: true
101
- });
102
- expect(wrapper.hasClass('ffe-h1--inline')).toBe(true);
103
- });
104
- test('adds --no-margin class if noMargin prop is true', function () {
105
- var wrapper = getWrapper({
106
- noMargin: true
107
- });
108
- expect(wrapper.hasClass('ffe-h1--no-margin')).toBe(true);
109
- });
110
- test('adds --with-border class if withBorder prop is true', function () {
111
- var wrapper = getWrapper({
112
- withBorder: true
113
- });
114
- expect(wrapper.hasClass('ffe-h1--with-border')).toBe(true);
115
- });
116
- test('does not add conditional classes if no props are given', function () {
117
- var wrapper = getWrapper();
118
- expect(wrapper.hasClass('ffe-h1--error')).toBe(false);
119
- expect(wrapper.hasClass('ffe-h1--no-margin')).toBe(false);
120
- expect(wrapper.hasClass('ffe-h1--with-border')).toBe(false);
121
- });
122
- });