@sb1/ffe-icons-react 9.0.8 → 9.0.10
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/Icon.js +1 -1
- package/lib/Icon.js +1 -1
- package/package.json +6 -6
- package/src/Icon.spec.js +21 -17
package/es/Icon.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
var _excluded = ["fileUrl", "className", "ariaLabel", "size"];
|
|
2
2
|
function _extends() { _extends = Object.assign ? Object.assign.bind() : 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); }
|
|
3
3
|
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; }
|
|
4
|
-
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var
|
|
4
|
+
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } } return target; }
|
|
5
5
|
import React from 'react';
|
|
6
6
|
import classNames from 'classnames';
|
|
7
7
|
import { string, oneOf } from 'prop-types';
|
package/lib/Icon.js
CHANGED
|
@@ -11,7 +11,7 @@ var _excluded = ["fileUrl", "className", "ariaLabel", "size"];
|
|
|
11
11
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
12
12
|
function _extends() { _extends = Object.assign ? Object.assign.bind() : 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); }
|
|
13
13
|
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; }
|
|
14
|
-
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var
|
|
14
|
+
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } } return target; }
|
|
15
15
|
var Icon = function Icon(props) {
|
|
16
16
|
var fileUrl = props.fileUrl,
|
|
17
17
|
className = props.className,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sb1/ffe-icons-react",
|
|
3
|
-
"version": "9.0.
|
|
3
|
+
"version": "9.0.10",
|
|
4
4
|
"description": "React-komponenter for ffe-icons",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "SpareBank 1",
|
|
@@ -22,16 +22,16 @@
|
|
|
22
22
|
"build": "ffe-buildtool babel",
|
|
23
23
|
"clean": "rimraf gen-src lib es types",
|
|
24
24
|
"lint": "eslint src",
|
|
25
|
+
"lint:fix": "eslint src --fix",
|
|
25
26
|
"test": "ffe-buildtool jest"
|
|
26
27
|
},
|
|
27
28
|
"dependencies": {
|
|
28
|
-
"@sb1/ffe-icons": "^14.0.
|
|
29
|
+
"@sb1/ffe-icons": "^14.0.1",
|
|
29
30
|
"prop-types": "^15.7.2"
|
|
30
31
|
},
|
|
31
32
|
"devDependencies": {
|
|
32
|
-
"@sb1/ffe-buildtool": "^0.5.
|
|
33
|
-
"eslint": "^
|
|
34
|
-
"eslint-loader": "^2.1.0",
|
|
33
|
+
"@sb1/ffe-buildtool": "^0.5.3",
|
|
34
|
+
"eslint": "^8.57.0",
|
|
35
35
|
"react": "^16.9.0",
|
|
36
36
|
"react-dom": "^16.9.0",
|
|
37
37
|
"rimraf": "^3.0.2"
|
|
@@ -42,5 +42,5 @@
|
|
|
42
42
|
"publishConfig": {
|
|
43
43
|
"access": "public"
|
|
44
44
|
},
|
|
45
|
-
"gitHead": "
|
|
45
|
+
"gitHead": "2ea32d4ec00a7891180a41c329a5317d6d986c13"
|
|
46
46
|
}
|
package/src/Icon.spec.js
CHANGED
|
@@ -1,28 +1,32 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import Icon from './Icon';
|
|
3
|
-
|
|
4
|
-
const getWrapper = props => shallow(<Icon {...props} />);
|
|
3
|
+
import { render, screen } from '@testing-library/react';
|
|
5
4
|
|
|
6
5
|
describe('Icon', () => {
|
|
7
|
-
it('renders without crashing and with right class', () => {
|
|
8
|
-
const wrapper = getWrapper({ fileUrl: '<svg></svg>' });
|
|
9
|
-
expect(wrapper.exists()).toBe(true);
|
|
10
|
-
expect(wrapper.hasClass('ffe-icons')).toBe(true);
|
|
11
|
-
});
|
|
12
6
|
it('renders with role="img', () => {
|
|
13
|
-
|
|
14
|
-
|
|
7
|
+
render(<Icon fileUrl="fileUrl" ariaLabel="ariaLabel" />);
|
|
8
|
+
const icon = screen.getByRole('img');
|
|
9
|
+
expect(icon.classList.contains('ffe-icons')).toBeTruthy();
|
|
15
10
|
});
|
|
11
|
+
|
|
16
12
|
it('renders correct classname based on size-prop', () => {
|
|
17
|
-
|
|
18
|
-
|
|
13
|
+
render(<Icon fileUrl="fileUrl" ariaLabel="ariaLabel" size="sm" />);
|
|
14
|
+
const icon = screen.getByRole('img');
|
|
15
|
+
expect(icon.classList.contains('ffe-icons--sm')).toBeTruthy();
|
|
19
16
|
});
|
|
17
|
+
|
|
20
18
|
it('applies additional CSS classes when provided', () => {
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
19
|
+
render(
|
|
20
|
+
<Icon
|
|
21
|
+
fileUrl="fileUrl"
|
|
22
|
+
ariaLabel="ariaLabel"
|
|
23
|
+
size="md"
|
|
24
|
+
className="my-class"
|
|
25
|
+
/>,
|
|
26
|
+
);
|
|
27
|
+
const icon = screen.getByRole('img');
|
|
28
|
+
expect(icon.classList.contains('ffe-icons')).toBeTruthy();
|
|
29
|
+
expect(icon.classList.contains('ffe-icons--md')).toBeTruthy();
|
|
30
|
+
expect(icon.classList.contains('my-class')).toBeTruthy();
|
|
27
31
|
});
|
|
28
32
|
});
|