@sb1/ffe-accordion-react 9.2.4 → 9.2.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/lib/Accordion.js CHANGED
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
 
3
- function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
3
+ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
4
4
 
5
5
  Object.defineProperty(exports, "__esModule", {
6
6
  value: true
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
 
3
- function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
3
+ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
4
4
 
5
5
  Object.defineProperty(exports, "__esModule", {
6
6
  value: true
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sb1/ffe-accordion-react",
3
- "version": "9.2.4",
3
+ "version": "9.2.8",
4
4
  "license": "MIT",
5
5
  "author": "SpareBank 1",
6
6
  "files": [
@@ -17,11 +17,8 @@
17
17
  "url": "ssh://git@github.com:SpareBank1/designsystem.git"
18
18
  },
19
19
  "scripts": {
20
- "build": "npm run build:cjs && npm run build:es && npm run build:types",
21
- "build:cjs": "babel -d lib/. --root-mode=upward --env-name=cjs --ignore=*.spec.js src/.",
22
- "build:es": "babel -d es/. --root-mode=upward --env-name=es --ignore=*.spec.js src/.",
23
- "build:types": "copyfiles -f src/index.d.ts types/",
24
- "lint": "eslint src/.",
20
+ "build": "ffe-buildtool babel",
21
+ "lint": "eslint src",
25
22
  "test": "jest",
26
23
  "test:watch": "jest --watch"
27
24
  },
@@ -29,13 +26,14 @@
29
26
  "setupTestFrameworkScriptFile": "../../test-setup.js"
30
27
  },
31
28
  "dependencies": {
32
- "@sb1/ffe-collapse-react": "^1.1.6",
33
- "@sb1/ffe-icons-react": "^7.2.19",
34
- "classnames": "^2.2.5",
35
- "prop-types": "^15.6.0",
36
- "uuid": "^8.0.0"
29
+ "@sb1/ffe-collapse-react": "^1.1.9",
30
+ "@sb1/ffe-icons-react": "^7.2.21",
31
+ "classnames": "^2.3.1",
32
+ "prop-types": "^15.7.2",
33
+ "uuid": "^8.3.2"
37
34
  },
38
35
  "devDependencies": {
36
+ "@sb1/ffe-buildtool": "^0.2.0",
39
37
  "enzyme": "^3.7.0",
40
38
  "enzyme-adapter-react-16": "^1.7.0",
41
39
  "jest": "^26.0.0",
@@ -49,5 +47,5 @@
49
47
  "publishConfig": {
50
48
  "access": "public"
51
49
  },
52
- "gitHead": "779a28007545ef4d26681b63d458f5d82a5abdfb"
50
+ "gitHead": "5da885a3bba8e6990f1f06796983ca0f1add9d9a"
53
51
  }
@@ -1,83 +0,0 @@
1
- import Accordion from './Accordion';
2
- import AccordionItem from './AccordionItem';
3
- import React from 'react';
4
- import { fireEvent, render, screen } from '@testing-library/react';
5
- describe('<Accordion />', function () {
6
- it('should render headings', function () {
7
- render( /*#__PURE__*/React.createElement(Accordion, {
8
- headingLevel: 3
9
- }, /*#__PURE__*/React.createElement(AccordionItem, {
10
- heading: "heading1"
11
- }, "content1"), /*#__PURE__*/React.createElement(AccordionItem, {
12
- heading: "heading2"
13
- }, "content2")));
14
- expect(screen.getByRole('heading', {
15
- name: /heading1/i,
16
- level: 3
17
- })).toBeInTheDocument();
18
- expect(screen.getByRole('heading', {
19
- name: /heading2/i,
20
- level: 3
21
- })).toBeInTheDocument();
22
- });
23
- it('should set up correct associations between heading and content', function () {
24
- render( /*#__PURE__*/React.createElement(Accordion, {
25
- headingLevel: 3
26
- }, /*#__PURE__*/React.createElement(AccordionItem, {
27
- defaultOpen: true,
28
- heading: "heading1"
29
- }, "content1"), /*#__PURE__*/React.createElement(AccordionItem, {
30
- defaultOpen: true,
31
- heading: "heading2"
32
- }, "content2")));
33
- var firstButton = screen.getByRole('button', {
34
- name: /heading1/i
35
- });
36
- var firstContent = screen.getByRole('region', {
37
- name: /heading1/i
38
- });
39
- expect(firstButton.getAttribute('aria-controls')).toEqual(firstContent.getAttribute('id'));
40
- expect(firstContent.getAttribute('aria-labelledby')).toEqual(firstButton.getAttribute('id'));
41
- var secondButton = screen.getByRole('button', {
42
- name: /heading2/i
43
- });
44
- var secondContent = screen.getByRole('region', {
45
- name: /heading2/i
46
- });
47
- expect(secondButton.getAttribute('aria-controls')).toEqual(secondContent.getAttribute('id'));
48
- expect(secondContent.getAttribute('aria-labelledby')).toEqual(secondButton.getAttribute('id'));
49
- });
50
- it('should expand sections', function () {
51
- render( /*#__PURE__*/React.createElement(Accordion, {
52
- headingLevel: 3
53
- }, /*#__PURE__*/React.createElement(AccordionItem, {
54
- heading: "heading1"
55
- }, "content1"), /*#__PURE__*/React.createElement(AccordionItem, {
56
- heading: "heading2"
57
- }, "content2")));
58
- var firstButton = screen.getByRole('button', {
59
- name: /heading1/i
60
- });
61
- var secondButton = screen.getByRole('button', {
62
- name: /heading2/i
63
- });
64
- expect(firstButton.getAttribute('aria-expanded')).toEqual('false');
65
- expect(secondButton.getAttribute('aria-expanded')).toEqual('false');
66
- expect(screen.queryByRole('region', {
67
- name: /heading1/i
68
- })).not.toBeInTheDocument();
69
- expect(screen.queryByRole('region', {
70
- name: /heading2/i
71
- })).not.toBeInTheDocument();
72
- fireEvent.click(firstButton);
73
- fireEvent.click(secondButton);
74
- expect(firstButton.getAttribute('aria-expanded')).toEqual('true');
75
- expect(secondButton.getAttribute('aria-expanded')).toEqual('true');
76
- expect(screen.getByRole('region', {
77
- name: /heading1/i
78
- })).toBeInTheDocument();
79
- expect(screen.getByRole('region', {
80
- name: /heading2/i
81
- })).toBeInTheDocument();
82
- });
83
- });
@@ -1,103 +0,0 @@
1
- "use strict";
2
-
3
- var _Accordion = _interopRequireDefault(require("./Accordion"));
4
-
5
- var _AccordionItem = _interopRequireDefault(require("./AccordionItem"));
6
-
7
- var _react = _interopRequireDefault(require("react"));
8
-
9
- var _react2 = require("@testing-library/react");
10
-
11
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
12
-
13
- describe('<Accordion />', function () {
14
- it('should render headings', function () {
15
- (0, _react2.render)( /*#__PURE__*/_react.default.createElement(_Accordion.default, {
16
- headingLevel: 3
17
- }, /*#__PURE__*/_react.default.createElement(_AccordionItem.default, {
18
- heading: "heading1"
19
- }, "content1"), /*#__PURE__*/_react.default.createElement(_AccordionItem.default, {
20
- heading: "heading2"
21
- }, "content2")));
22
- expect(_react2.screen.getByRole('heading', {
23
- name: /heading1/i,
24
- level: 3
25
- })).toBeInTheDocument();
26
- expect(_react2.screen.getByRole('heading', {
27
- name: /heading2/i,
28
- level: 3
29
- })).toBeInTheDocument();
30
- });
31
- it('should set up correct associations between heading and content', function () {
32
- (0, _react2.render)( /*#__PURE__*/_react.default.createElement(_Accordion.default, {
33
- headingLevel: 3
34
- }, /*#__PURE__*/_react.default.createElement(_AccordionItem.default, {
35
- defaultOpen: true,
36
- heading: "heading1"
37
- }, "content1"), /*#__PURE__*/_react.default.createElement(_AccordionItem.default, {
38
- defaultOpen: true,
39
- heading: "heading2"
40
- }, "content2")));
41
-
42
- var firstButton = _react2.screen.getByRole('button', {
43
- name: /heading1/i
44
- });
45
-
46
- var firstContent = _react2.screen.getByRole('region', {
47
- name: /heading1/i
48
- });
49
-
50
- expect(firstButton.getAttribute('aria-controls')).toEqual(firstContent.getAttribute('id'));
51
- expect(firstContent.getAttribute('aria-labelledby')).toEqual(firstButton.getAttribute('id'));
52
-
53
- var secondButton = _react2.screen.getByRole('button', {
54
- name: /heading2/i
55
- });
56
-
57
- var secondContent = _react2.screen.getByRole('region', {
58
- name: /heading2/i
59
- });
60
-
61
- expect(secondButton.getAttribute('aria-controls')).toEqual(secondContent.getAttribute('id'));
62
- expect(secondContent.getAttribute('aria-labelledby')).toEqual(secondButton.getAttribute('id'));
63
- });
64
- it('should expand sections', function () {
65
- (0, _react2.render)( /*#__PURE__*/_react.default.createElement(_Accordion.default, {
66
- headingLevel: 3
67
- }, /*#__PURE__*/_react.default.createElement(_AccordionItem.default, {
68
- heading: "heading1"
69
- }, "content1"), /*#__PURE__*/_react.default.createElement(_AccordionItem.default, {
70
- heading: "heading2"
71
- }, "content2")));
72
-
73
- var firstButton = _react2.screen.getByRole('button', {
74
- name: /heading1/i
75
- });
76
-
77
- var secondButton = _react2.screen.getByRole('button', {
78
- name: /heading2/i
79
- });
80
-
81
- expect(firstButton.getAttribute('aria-expanded')).toEqual('false');
82
- expect(secondButton.getAttribute('aria-expanded')).toEqual('false');
83
- expect(_react2.screen.queryByRole('region', {
84
- name: /heading1/i
85
- })).not.toBeInTheDocument();
86
- expect(_react2.screen.queryByRole('region', {
87
- name: /heading2/i
88
- })).not.toBeInTheDocument();
89
-
90
- _react2.fireEvent.click(firstButton);
91
-
92
- _react2.fireEvent.click(secondButton);
93
-
94
- expect(firstButton.getAttribute('aria-expanded')).toEqual('true');
95
- expect(secondButton.getAttribute('aria-expanded')).toEqual('true');
96
- expect(_react2.screen.getByRole('region', {
97
- name: /heading1/i
98
- })).toBeInTheDocument();
99
- expect(_react2.screen.getByRole('region', {
100
- name: /heading2/i
101
- })).toBeInTheDocument();
102
- });
103
- });