@sb1/ffe-dropdown-react 5.1.4 → 5.1.8

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/es/Dropdown.js CHANGED
@@ -1,3 +1,5 @@
1
+ var _excluded = ["className", "inline", "innerRef"];
2
+
1
3
  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
4
 
3
5
  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; }
@@ -11,15 +13,12 @@ import classNames from 'classnames';
11
13
  var Dropdown = function Dropdown(props) {
12
14
  var className = props.className,
13
15
  inline = props.inline,
14
- dark = props.dark,
15
16
  innerRef = props.innerRef,
16
- rest = _objectWithoutProperties(props, ["className", "inline", "dark", "innerRef"]);
17
+ rest = _objectWithoutProperties(props, _excluded);
17
18
 
18
19
  return /*#__PURE__*/React.createElement("select", _extends({
19
20
  className: classNames('ffe-dropdown', {
20
21
  'ffe-dropdown--inline': inline
21
- }, {
22
- 'ffe-dropdown--dark': dark
23
22
  }, className),
24
23
  ref: innerRef
25
24
  }, rest));
@@ -30,15 +29,9 @@ Dropdown.propTypes = {
30
29
  inline: bool,
31
30
  className: string,
32
31
 
33
- /** Dark variant */
34
- dark: bool,
35
-
36
32
  /** Ref-setting function, or ref created by useRef, passed to the select element */
37
33
  innerRef: oneOfType([func, shape({
38
34
  current: object
39
35
  })])
40
36
  };
41
- Dropdown.defaultProps = {
42
- dark: false
43
- };
44
37
  export default Dropdown;
package/lib/Dropdown.js CHANGED
@@ -11,6 +11,8 @@ var _propTypes = require("prop-types");
11
11
 
12
12
  var _classnames = _interopRequireDefault(require("classnames"));
13
13
 
14
+ var _excluded = ["className", "inline", "innerRef"];
15
+
14
16
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
15
17
 
16
18
  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); }
@@ -22,15 +24,12 @@ function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) r
22
24
  var Dropdown = function Dropdown(props) {
23
25
  var className = props.className,
24
26
  inline = props.inline,
25
- dark = props.dark,
26
27
  innerRef = props.innerRef,
27
- rest = _objectWithoutProperties(props, ["className", "inline", "dark", "innerRef"]);
28
+ rest = _objectWithoutProperties(props, _excluded);
28
29
 
29
30
  return /*#__PURE__*/_react.default.createElement("select", _extends({
30
31
  className: (0, _classnames.default)('ffe-dropdown', {
31
32
  'ffe-dropdown--inline': inline
32
- }, {
33
- 'ffe-dropdown--dark': dark
34
33
  }, className),
35
34
  ref: innerRef
36
35
  }, rest));
@@ -41,16 +40,10 @@ Dropdown.propTypes = {
41
40
  inline: _propTypes.bool,
42
41
  className: _propTypes.string,
43
42
 
44
- /** Dark variant */
45
- dark: _propTypes.bool,
46
-
47
43
  /** Ref-setting function, or ref created by useRef, passed to the select element */
48
44
  innerRef: (0, _propTypes.oneOfType)([_propTypes.func, (0, _propTypes.shape)({
49
45
  current: _propTypes.object
50
46
  })])
51
47
  };
52
- Dropdown.defaultProps = {
53
- dark: false
54
- };
55
48
  var _default = Dropdown;
56
49
  exports.default = _default;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sb1/ffe-dropdown-react",
3
- "version": "5.1.4",
3
+ "version": "5.1.8",
4
4
  "license": "MIT",
5
5
  "files": [
6
6
  "lib",
@@ -16,11 +16,8 @@
16
16
  "url": "ssh://git@github.com:SpareBank1/designsystem.git"
17
17
  },
18
18
  "scripts": {
19
- "build": "npm run build:cjs && npm run build:es && npm run build:types",
20
- "build:cjs": "babel -d lib/. --root-mode=upward --env-name=cjs --ignore=*.spec.js src/.",
21
- "build:es": "babel -d es/. --root-mode=upward --env-name=es --ignore=*.spec.js src/.",
22
- "build:types": "copyfiles -f src/index.d.ts types/",
23
- "lint": "eslint src/.",
19
+ "build": "ffe-buildtool babel",
20
+ "lint": "eslint src",
24
21
  "test": "jest",
25
22
  "test:watch": "jest --watch"
26
23
  },
@@ -28,9 +25,10 @@
28
25
  "setupTestFrameworkScriptFile": "../../test-setup.js"
29
26
  },
30
27
  "dependencies": {
31
- "classnames": "^2.2.5"
28
+ "classnames": "^2.3.1"
32
29
  },
33
30
  "devDependencies": {
31
+ "@sb1/ffe-buildtool": "^0.1.0",
34
32
  "enzyme": "^3.7.0",
35
33
  "enzyme-adapter-react-16": "^1.7.0",
36
34
  "eslint": "^5.9.0",
@@ -40,11 +38,11 @@
40
38
  "react-dom": "^16.9.0"
41
39
  },
42
40
  "peerDependencies": {
43
- "@sb1/ffe-form": ">=11.0.1",
44
- "react": "^16.9.0"
41
+ "@sb1/ffe-form": "*",
42
+ "react": ">=16.9.0"
45
43
  },
46
44
  "publishConfig": {
47
45
  "access": "public"
48
46
  },
49
- "gitHead": "67a0e2fa940c378759f0d706e0b62aa0efea4587"
47
+ "gitHead": "59eb2e12625e744f1a116c14a40cf69f1bbecdc6"
50
48
  }
package/types/index.d.ts CHANGED
@@ -5,7 +5,6 @@ export interface DropdownProps
5
5
  children?: React.ReactNode;
6
6
  className?: string;
7
7
  inline?: boolean;
8
- dark?: boolean;
9
8
  innerRef?: React.Ref<HTMLSelectElement>;
10
9
  }
11
10
 
package/CHANGELOG.md DELETED
@@ -1,388 +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
- ## [5.1.4](https://github.com/SpareBank1/designsystem/compare/@sb1/ffe-dropdown-react@5.1.3...@sb1/ffe-dropdown-react@5.1.4) (2021-02-03)
7
-
8
-
9
- ### Bug Fixes
10
-
11
- * packages/ffe-dropdown-react/package.json to reduce vulnerabilities ([9493e8c](https://github.com/SpareBank1/designsystem/commit/9493e8cd7fe5d970f16cd910d03a25f14f954478))
12
-
13
-
14
-
15
-
16
-
17
- ## [5.1.3](https://github.com/SpareBank1/designsystem/compare/@sb1/ffe-dropdown-react@5.1.2...@sb1/ffe-dropdown-react@5.1.3) (2021-02-02)
18
-
19
-
20
- ### Bug Fixes
21
-
22
- * **ffe-dropdown-react:** reduce vulnerabilities ([f0eb019](https://github.com/SpareBank1/designsystem/commit/f0eb01913c24163a04c3c3346481cf1fc40f6758))
23
-
24
-
25
-
26
-
27
-
28
- ## [5.1.2](https://github.com/SpareBank1/designsystem/compare/@sb1/ffe-dropdown-react@5.1.1...@sb1/ffe-dropdown-react@5.1.2) (2020-02-10)
29
-
30
- ### Bug Fixes
31
-
32
- - **ffe-dropdown-react:** fixing incorrect types ([64b7adc](https://github.com/SpareBank1/designsystem/commit/64b7adcd8ba518351bc7570306df5efceeab4ff1))
33
-
34
- ## [5.1.1](https://github.com/SpareBank1/designsystem/compare/@sb1/ffe-dropdown-react@5.1.0...@sb1/ffe-dropdown-react@5.1.1) (2020-01-16)
35
-
36
- ### Bug Fixes
37
-
38
- - **ffe-dropdown-react:** fixed type definition of innerref ([16caf9c](https://github.com/SpareBank1/designsystem/commit/16caf9ced84d5d069d8e5682d4fefff8c2af8833))
39
-
40
- # [5.1.0](https://github.com/SpareBank1/designsystem/compare/@sb1/ffe-dropdown-react@5.0.0...@sb1/ffe-dropdown-react@5.1.0) (2020-01-08)
41
-
42
- ### Features
43
-
44
- - **ffe-dropdown-react:** added optional property innerref ([4867d27](https://github.com/SpareBank1/designsystem/commit/4867d27a61a7549de9a1258d94b8d2e6a455531d))
45
-
46
- # [5.0.0](https://github.com/SpareBank1/designsystem/compare/@sb1/ffe-dropdown-react@4.2.2...@sb1/ffe-dropdown-react@5.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
- ## [4.2.2](https://github.com/SpareBank1/designsystem/compare/@sb1/ffe-dropdown-react@4.2.1...@sb1/ffe-dropdown-react@4.2.2) (2019-06-26)
60
-
61
- **Note:** Version bump only for package @sb1/ffe-dropdown-react
62
-
63
- ## [4.2.1](https://github.com/SpareBank1/designsystem/compare/@sb1/ffe-dropdown-react@4.2.0...@sb1/ffe-dropdown-react@4.2.1) (2019-05-21)
64
-
65
- ### Bug Fixes
66
-
67
- - **ffe-dropdown-react:** ffe-form compat ([d52f3bf](https://github.com/SpareBank1/designsystem/commit/d52f3bf))
68
-
69
- # [4.2.0](https://github.com/SpareBank1/designsystem/compare/@sb1/ffe-dropdown-react@4.1.4...@sb1/ffe-dropdown-react@4.2.0) (2019-05-10)
70
-
71
- ### Features
72
-
73
- - **ffe-dropdown-react:** Added type definitions for typescript ([9e91e0c](https://github.com/SpareBank1/designsystem/commit/9e91e0c))
74
-
75
- ## [4.1.4](https://github.com/SpareBank1/designsystem/compare/@sb1/ffe-dropdown-react@4.1.3...@sb1/ffe-dropdown-react@4.1.4) (2018-12-11)
76
-
77
- ### Bug Fixes
78
-
79
- - Build tree shakeable packages ([fb4a9ea](https://github.com/SpareBank1/designsystem/commit/fb4a9ea))
80
-
81
- ## [4.1.3](https://github.com/SpareBank1/designsystem/compare/@sb1/ffe-dropdown-react@4.1.2...@sb1/ffe-dropdown-react@4.1.3) (2018-12-04)
82
-
83
- **Note:** Version bump only for package @sb1/ffe-dropdown-react
84
-
85
- ## [4.1.2](https://github.com/SpareBank1/designsystem/compare/@sb1/ffe-dropdown-react@4.1.1...@sb1/ffe-dropdown-react@4.1.2) (2018-11-26)
86
-
87
- **Note:** Version bump only for package @sb1/ffe-dropdown-react
88
-
89
- ## [4.1.1](https://github.com/SpareBank1/designsystem/compare/@sb1/ffe-dropdown-react@4.1.0...@sb1/ffe-dropdown-react@4.1.1) (2018-11-09)
90
-
91
- **Note:** Version bump only for package @sb1/ffe-dropdown-react
92
-
93
- # [4.1.0](https://github.com/SpareBank1/designsystem/compare/@sb1/ffe-dropdown-react@4.0.4...@sb1/ffe-dropdown-react@4.1.0) (2018-10-25)
94
-
95
- ### Bug Fixes
96
-
97
- - **ffe-dropdown-react:** Added defaultProps false for dark variant. ([69d109b](https://github.com/SpareBank1/designsystem/commit/69d109b))
98
-
99
- ### Features
100
-
101
- - **ffe-dropdown-react:** Added dark property with documentation ([28bc5f4](https://github.com/SpareBank1/designsystem/commit/28bc5f4))
102
-
103
- <a name="4.0.4"></a>
104
-
105
- ## [4.0.4](https://github.com/SpareBank1/designsystem/compare/@sb1/ffe-dropdown-react@4.0.3...@sb1/ffe-dropdown-react@4.0.4) (2018-08-09)
106
-
107
- **Note:** Version bump only for package @sb1/ffe-dropdown-react
108
-
109
- <a name="4.0.3"></a>
110
-
111
- ## [4.0.3](https://github.com/SpareBank1/designsystem/compare/@sb1/ffe-dropdown-react@4.0.2...@sb1/ffe-dropdown-react@4.0.3) (2018-03-27)
112
-
113
- **Note:** Version bump only for package @sb1/ffe-dropdown-react
114
-
115
- <a name="4.0.2"></a>
116
-
117
- ## [4.0.2](https://github.com/SpareBank1/designsystem/compare/@sb1/ffe-dropdown-react@4.0.0...@sb1/ffe-dropdown-react@4.0.2) (2018-03-07)
118
-
119
- ### Bug Fixes
120
-
121
- - Correct peerDependencies after breaking change ([aab59ce](https://github.com/SpareBank1/designsystem/commit/aab59ce))
122
-
123
- <a name="4.0.1"></a>
124
-
125
- ## [4.0.1](https://github.com/SpareBank1/designsystem/compare/@sb1/ffe-dropdown-react@4.0.0...@sb1/ffe-dropdown-react@4.0.1) (2018-03-02)
126
-
127
- ### Bug Fixes
128
-
129
- - Correct peerDependencies after breaking change ([4318363](https://github.com/SpareBank1/designsystem/commit/4318363))
130
-
131
- <a name="4.0.0"></a>
132
-
133
- # 4.0.0 (2018-02-25)
134
-
135
- ### Bug Fixes
136
-
137
- - **ffe-dropdown-react:** Add missing proptypes check ([77bb118](https://github.com/SpareBank1/designsystem/commit/77bb118))
138
-
139
- ### Chores
140
-
141
- - **ffe-dropdown-react:** Import ffe-dropdown-react ([9234074](https://github.com/SpareBank1/designsystem/commit/9234074))
142
- - add [@sb1](https://github.com/sb1)/ scope to all packages ([37efbb4](https://github.com/SpareBank1/designsystem/commit/37efbb4))
143
-
144
- ### BREAKING CHANGES
145
-
146
- - All packages have been renamed to add the @sb1 scope.
147
-
148
- See links [1] and [2] to read more about package scopes.
149
-
150
- Unfortunately this requires you update both your dependencies in
151
- `package.json` and all `import` or `require` statements in your code.
152
- Also, you unfortunately have to upgrade all FFE packages at once due to
153
- dependency between packages. If you are on the latest version prior to
154
- this breaking change the upgrade should be a matter of updating
155
- `package.json` with new package names and versions, and updating your
156
- imports.
157
-
158
- To help find the proper package versions you can either browse to the
159
- packages you need or check out the list of Git tags either on
160
- Github [3] or by cloning the repository and running the `git tag`
161
- command. All package versions get a tag in the format
162
- _package@version_.
163
-
164
- Update your `package.json` with the latest package version and add the
165
- @sb1 scope to the package name:
166
-
167
- ```diff
168
- - "ffe-core": "11.0.2",
169
- + "@sb1/ffe-core": "11.0.2",
170
- ```
171
-
172
- Scoped packages all get put in a subdirectory in `node_modules/`. In our
173
- case packages will be put in the `node_modules/@sb1/` directory. If your
174
- build depends on file paths (for instance for copying fonts) you need to
175
- update that path to include the scope.
176
-
177
- The directory structure also means you have to update your imports, both
178
- in Less and in JavaScript.
179
-
180
- Using `less-plugin-npm-import`:
181
-
182
- ```diff
183
- - @import 'npm://ffe-core/less/ffe';
184
- + @import 'npm://@sb1/ffe-core/less/ffe';
185
- ```
186
-
187
- Using Webpack:
188
-
189
- ```diff
190
- - @import '~ffe-core/less/ffe';
191
- + @import '~@sb1/ffe-core/less/ffe';
192
- ```
193
-
194
- Using plain old paths:
195
-
196
- ```diff
197
- - @import '../path/to/node_modules/ffe-core/less/ffe';
198
- + @import '../path/to/node_modules/@sb1/ffe-core/less/ffe';
199
- ```
200
-
201
- JavaScript `import`:
202
-
203
- ```diff
204
- - import { ActionButton } from 'ffe-buttons-react';
205
- + import { ActionButton } from '@sb1/ffe-buttons-react';
206
- ```
207
-
208
- JavaScript `require`:
209
-
210
- ```diff
211
- - const { ActionButton } = require('ffe-buttons-react').default;
212
- + const { ActionButton } = require('@sb1/ffe-buttons-react').default;
213
- ```
214
-
215
- [1]: https://docs.npmjs.com/misc/scope
216
- [2]: https://docs.npmjs.com/getting-started/scoped-packages
217
- [3]: https://github.com/sparebank1/designsystem/tags
218
-
219
- - **ffe-dropdown-react:** Simplify the ffe-dropdown-react implementation.
220
-
221
- This commit simplifies the component, and leaves more of the
222
- compositional power to the consumer.
223
-
224
- In order to migrate to this new major, the consumer should wrap
225
- their existing component in `ffe-form-react`'s `InputGroup`
226
- component. This will provide most of the functionality that this
227
- major removes from `ffe-dropdown-react`. Please refer to the
228
- documentation for new usage information.
229
-
230
- <a name="3.0.7"></a>
231
-
232
- ## [3.0.7](https://github.com/SpareBank1/designsystem/compare/ffe-dropdown-react@3.0.6...ffe-dropdown-react@3.0.7) (2018-02-23)
233
-
234
- **Note:** Version bump only for package ffe-dropdown-react
235
-
236
- <a name="3.0.6"></a>
237
-
238
- ## [3.0.6](https://github.com/SpareBank1/designsystem/compare/ffe-dropdown-react@3.0.5...ffe-dropdown-react@3.0.6) (2018-02-22)
239
-
240
- **Note:** Version bump only for package ffe-dropdown-react
241
-
242
- <a name="3.0.5"></a>
243
-
244
- ## [3.0.5](https://github.com/SpareBank1/designsystem/compare/ffe-dropdown-react@3.0.4...ffe-dropdown-react@3.0.5) (2018-01-22)
245
-
246
- **Note:** Version bump only for package ffe-dropdown-react
247
-
248
- <a name="3.0.4"></a>
249
-
250
- ## [3.0.4](https://github.com/SpareBank1/designsystem/compare/ffe-dropdown-react@3.0.3...ffe-dropdown-react@3.0.4) (2018-01-22)
251
-
252
- ### Bug Fixes
253
-
254
- - **ffe-dropdown-react:** Add missing proptypes check
255
-
256
- <a name="3.0.3"></a>
257
-
258
- ## [3.0.3](https://github.com/SpareBank1/designsystem/compare/ffe-dropdown-react@3.0.2...ffe-dropdown-react@3.0.3) (2018-01-19)
259
-
260
- **Note:** Version bump only for package ffe-dropdown-react
261
-
262
- <a name="3.0.2"></a>
263
-
264
- ## [3.0.2](https://github.com/SpareBank1/designsystem/compare/ffe-dropdown-react@3.0.1...ffe-dropdown-react@3.0.2) (2018-01-18)
265
-
266
- **Note:** Version bump only for package ffe-dropdown-react
267
-
268
- <a name="3.0.1"></a>
269
-
270
- ## [3.0.1](https://github.com/SpareBank1/designsystem/compare/ffe-dropdown-react@3.0.0...ffe-dropdown-react@3.0.1) (2018-01-12)
271
-
272
- **Note:** Version bump only for package ffe-dropdown-react
273
-
274
- <a name="3.0.0"></a>
275
-
276
- # 3.0.0 (2018-01-12)
277
-
278
- ### Chores
279
-
280
- - **ffe-dropdown-react:** Import ffe-dropdown-react
281
-
282
- ### BREAKING CHANGES
283
-
284
- - **ffe-dropdown-react:** Simplify the ffe-dropdown-react implementation.
285
-
286
- This commit simplifies the component, and leaves more of the
287
- compositional power to the consumer.
288
-
289
- In order to migrate to this new major, the consumer should wrap
290
- their existing component in `ffe-form-react`'s `InputGroup`
291
- component. This will provide most of the functionality that this
292
- major removes from `ffe-dropdown-react`. Please refer to the
293
- documentation for new usage information.
294
-
295
- ## 2.9.2
296
-
297
- - Setting the default behaviour to tabbable.
298
-
299
- ## 2.9.1
300
-
301
- - Add support for version 8 of `ffe-form`.
302
- - Specify version of `React`-related packages to `15.x`
303
-
304
- # 2.9.0
305
-
306
- - Added support for `isTabbable`
307
-
308
- ## 2.8.1
309
-
310
- - Use PropTypes from prop-types package
311
-
312
- # 2.8.0
313
-
314
- - Increased version range for ffe-form.
315
-
316
- # 2.7.0
317
-
318
- - Pass through (almost) all `props` passed to `Dropdown` directly to `select`. Then we can use the component more like the native ones.
319
- - Remove `aria-live="polite"` from the wrapping input group.
320
-
321
- ## 2.6.1
322
-
323
- - Expand peerDep scope of `ffe-form` to include `5.x`.
324
- - Remove peerDep on `ffe-core` and `ffe-spinner`.
325
-
326
- # 2.6.0
327
-
328
- - Added support for autoFocus attribute
329
-
330
- ## 2.5.2
331
-
332
- - Use latest FFE eslint config
333
-
334
- ## 2.5.1
335
-
336
- - Added support for ffe-form version 4.x.x
337
-
338
- # 2.5.0
339
-
340
- - Added support for `name` property
341
-
342
- ## 2.4.2
343
-
344
- - Added ffe-form-label--block to label
345
-
346
- ## 2.4.1
347
-
348
- - Added support for ffe-form version 3.x.x
349
-
350
- # 2.4.0
351
-
352
- - Added added support for css styling of container-div, using prop containerClassName
353
-
354
- # 2.3.0
355
-
356
- - Added onBlur support
357
-
358
- # 2.2.0
359
-
360
- - Relaxing the peer dependency on `ffe-form` to allow both 1.x and 2.x
361
-
362
- # 2.1.0
363
-
364
- - Removed dependency on ffe-dropdown - styling in ffe-dropdown has been moved to ffe-form
365
- - Bumped dependency on ffe-form
366
-
367
- # 2.0.0
368
-
369
- - Bumped dependency on `ffe-core` to `^8.0.2`
370
- - Added peerDependency on `ffe-form`, `ffe-spinner` and `ffe-dropdown`
371
- - Added a budo example page that can be launched with `npm start`
372
- - Fixed error message class by updating to `.ffe-field-error-message`
373
-
374
- # 1.8.0
375
-
376
- - Add isLoading support
377
-
378
- # 1.7.0
379
-
380
- - Add custom className support
381
-
382
- # 1.6.0
383
-
384
- - Add error message support
385
-
386
- # 1.5.0 (16.6.2016)
387
-
388
- - Add `defaultValue` property.
@@ -1,42 +0,0 @@
1
- import React from 'react';
2
- import { shallow } from 'enzyme';
3
- import Dropdown from './Dropdown';
4
-
5
- var getWrapper = function getWrapper(props) {
6
- return shallow( /*#__PURE__*/React.createElement(Dropdown, props, /*#__PURE__*/React.createElement("option", null, "Option 1"), /*#__PURE__*/React.createElement("option", null, "Option 2")));
7
- };
8
-
9
- describe('<Dropdown />', function () {
10
- it('renders a select', function () {
11
- var wrapper = getWrapper();
12
- expect(wrapper.is('select')).toBe(true);
13
- expect(wrapper.hasClass('ffe-dropdown')).toBe(true);
14
- });
15
- it('renders children inside the select', function () {
16
- var wrapper = getWrapper();
17
- expect(wrapper.find('option')).toHaveLength(2);
18
- });
19
- it('sets the inline modifier class', function () {
20
- var wrapper = getWrapper();
21
- expect(wrapper.hasClass('ffe-dropdown--inline')).toBe(false);
22
- wrapper.setProps({
23
- inline: true
24
- });
25
- expect(wrapper.hasClass('ffe-dropdown--inline')).toBe(true);
26
- });
27
- it('adds additional classes', function () {
28
- var wrapper = getWrapper({
29
- className: 'custom-test-class'
30
- });
31
- expect(wrapper.hasClass('custom-test-class')).toBe(true);
32
- expect(wrapper.hasClass('ffe-dropdown')).toBe(true);
33
- });
34
- it('passes on any props to the <select />', function () {
35
- var wrapper = getWrapper({
36
- 'aria-invalid': 'true',
37
- disabled: 'true'
38
- });
39
- expect(wrapper.find('select').prop('aria-invalid')).toBe('true');
40
- expect(wrapper.find('select').prop('disabled')).toBe('true');
41
- });
42
- });
@@ -1,48 +0,0 @@
1
- "use strict";
2
-
3
- var _react = _interopRequireDefault(require("react"));
4
-
5
- var _enzyme = require("enzyme");
6
-
7
- var _Dropdown = _interopRequireDefault(require("./Dropdown"));
8
-
9
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
10
-
11
- var getWrapper = function getWrapper(props) {
12
- return (0, _enzyme.shallow)( /*#__PURE__*/_react.default.createElement(_Dropdown.default, props, /*#__PURE__*/_react.default.createElement("option", null, "Option 1"), /*#__PURE__*/_react.default.createElement("option", null, "Option 2")));
13
- };
14
-
15
- describe('<Dropdown />', function () {
16
- it('renders a select', function () {
17
- var wrapper = getWrapper();
18
- expect(wrapper.is('select')).toBe(true);
19
- expect(wrapper.hasClass('ffe-dropdown')).toBe(true);
20
- });
21
- it('renders children inside the select', function () {
22
- var wrapper = getWrapper();
23
- expect(wrapper.find('option')).toHaveLength(2);
24
- });
25
- it('sets the inline modifier class', function () {
26
- var wrapper = getWrapper();
27
- expect(wrapper.hasClass('ffe-dropdown--inline')).toBe(false);
28
- wrapper.setProps({
29
- inline: true
30
- });
31
- expect(wrapper.hasClass('ffe-dropdown--inline')).toBe(true);
32
- });
33
- it('adds additional classes', function () {
34
- var wrapper = getWrapper({
35
- className: 'custom-test-class'
36
- });
37
- expect(wrapper.hasClass('custom-test-class')).toBe(true);
38
- expect(wrapper.hasClass('ffe-dropdown')).toBe(true);
39
- });
40
- it('passes on any props to the <select />', function () {
41
- var wrapper = getWrapper({
42
- 'aria-invalid': 'true',
43
- disabled: 'true'
44
- });
45
- expect(wrapper.find('select').prop('aria-invalid')).toBe('true');
46
- expect(wrapper.find('select').prop('disabled')).toBe('true');
47
- });
48
- });