@sb1/ffe-cards-react 5.0.1 → 5.0.5
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/IconCard/IconCard.js +1 -1
- package/lib/ImageCard/ImageCard.js +1 -1
- package/lib/TextCard/TextCard.js +1 -1
- package/package.json +9 -10
- package/es/CardBase.spec.js +0 -27
- package/es/IconCard/IconCard.spec.js +0 -56
- package/es/ImageCard/ImageCard.spec.js +0 -50
- package/es/TextCard/TextCard.spec.js +0 -33
- package/lib/CardBase.spec.js +0 -34
- package/lib/IconCard/IconCard.spec.js +0 -65
- package/lib/ImageCard/ImageCard.spec.js +0 -59
- package/lib/TextCard/TextCard.spec.js +0 -41
package/lib/IconCard/IconCard.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
function _typeof(obj) { "@babel/helpers - typeof";
|
|
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";
|
|
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/lib/TextCard/TextCard.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
function _typeof(obj) { "@babel/helpers - typeof";
|
|
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-cards-react",
|
|
3
|
-
"version": "5.0.
|
|
3
|
+
"version": "5.0.5",
|
|
4
4
|
"description": "React implementation of ffe-react",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "SpareBank 1",
|
|
@@ -18,11 +18,9 @@
|
|
|
18
18
|
"url": "ssh://git@github.com:SpareBank1/designsystem.git"
|
|
19
19
|
},
|
|
20
20
|
"scripts": {
|
|
21
|
-
"build": "
|
|
22
|
-
"
|
|
23
|
-
"
|
|
24
|
-
"build:types": "copyfiles -f src/index.d.ts types/",
|
|
25
|
-
"lint": "eslint src/.",
|
|
21
|
+
"build": "ffe-buildtool babel",
|
|
22
|
+
"watch": "ffe-buildtool babel-watch",
|
|
23
|
+
"lint": "eslint src",
|
|
26
24
|
"test": "jest",
|
|
27
25
|
"test:watch": "jest --watch"
|
|
28
26
|
},
|
|
@@ -30,11 +28,12 @@
|
|
|
30
28
|
"setupTestFrameworkScriptFile": "../../test-setup.js"
|
|
31
29
|
},
|
|
32
30
|
"dependencies": {
|
|
33
|
-
"prop-types": "^15.7.
|
|
31
|
+
"prop-types": "^15.7.2"
|
|
34
32
|
},
|
|
35
33
|
"devDependencies": {
|
|
36
|
-
"@sb1/ffe-
|
|
37
|
-
"@sb1/ffe-icons
|
|
34
|
+
"@sb1/ffe-buildtool": "^0.3.0",
|
|
35
|
+
"@sb1/ffe-icons": "^12.16.0",
|
|
36
|
+
"@sb1/ffe-icons-react": "^7.2.21",
|
|
38
37
|
"enzyme": "^3.7.0",
|
|
39
38
|
"enzyme-adapter-react-16": "^1.7.0",
|
|
40
39
|
"jest": "^26.0.0",
|
|
@@ -48,5 +47,5 @@
|
|
|
48
47
|
"publishConfig": {
|
|
49
48
|
"access": "public"
|
|
50
49
|
},
|
|
51
|
-
"gitHead": "
|
|
50
|
+
"gitHead": "1960685a8b6055efc0653aa1643138cf4a7054fc"
|
|
52
51
|
}
|
package/es/CardBase.spec.js
DELETED
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { shallow } from 'enzyme';
|
|
3
|
-
import CardBase from './CardBase';
|
|
4
|
-
|
|
5
|
-
var getWrapper = function getWrapper(props) {
|
|
6
|
-
return shallow( /*#__PURE__*/React.createElement(CardBase, props));
|
|
7
|
-
};
|
|
8
|
-
|
|
9
|
-
var children = /*#__PURE__*/React.createElement("div", null, "Hello world");
|
|
10
|
-
describe('CardBase', function () {
|
|
11
|
-
it('should render a div element with correct class and children inside', function () {
|
|
12
|
-
var wrapper = getWrapper({
|
|
13
|
-
children: children
|
|
14
|
-
});
|
|
15
|
-
expect(wrapper.find('div').exists()).toBe(true);
|
|
16
|
-
expect(wrapper.hasClass('ffe-card-base')).toBe(true);
|
|
17
|
-
expect(wrapper.find('.ffe-card-base').children().first().getElement()).toEqual(children);
|
|
18
|
-
});
|
|
19
|
-
it('should render my custom element and custom class', function () {
|
|
20
|
-
var wrapper = getWrapper({
|
|
21
|
-
className: 'my-custom-class',
|
|
22
|
-
element: 'article'
|
|
23
|
-
});
|
|
24
|
-
expect(wrapper.find('article').exists()).toBe(true);
|
|
25
|
-
expect(wrapper.hasClass('my-custom-class')).toBe(true);
|
|
26
|
-
});
|
|
27
|
-
});
|
|
@@ -1,56 +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 IconCard from './IconCard';
|
|
6
|
-
import SparegrisIkon from '../../../ffe-icons-react/lib/sparegris-ikon';
|
|
7
|
-
import { Text } from '../components';
|
|
8
|
-
|
|
9
|
-
var getWrapper = function getWrapper(props) {
|
|
10
|
-
return shallow( /*#__PURE__*/React.createElement(IconCard, _extends({
|
|
11
|
-
icon: /*#__PURE__*/React.createElement(SparegrisIkon, null)
|
|
12
|
-
}, props)));
|
|
13
|
-
};
|
|
14
|
-
|
|
15
|
-
var children = /*#__PURE__*/React.createElement("div", null, "Hello world");
|
|
16
|
-
describe('IconCard', function () {
|
|
17
|
-
it('should render correct class and contain a div with body class', function () {
|
|
18
|
-
var wrapper = getWrapper({
|
|
19
|
-
children: children
|
|
20
|
-
});
|
|
21
|
-
expect(wrapper.hasClass('ffe-icon-card')).toBe(true);
|
|
22
|
-
expect(wrapper.find('.ffe-icon-card__body').exists()).toBe(true);
|
|
23
|
-
expect(wrapper.find('.ffe-icon-card__body').children().first().getElement()).toEqual(children);
|
|
24
|
-
});
|
|
25
|
-
it('should render icon, with an added class', function () {
|
|
26
|
-
var wrapper = getWrapper({
|
|
27
|
-
icon: /*#__PURE__*/React.createElement(SparegrisIkon, {
|
|
28
|
-
className: "my-custom-class"
|
|
29
|
-
})
|
|
30
|
-
});
|
|
31
|
-
expect(wrapper.find(SparegrisIkon).hasClass('ffe-icon-card__icon')).toBe(true);
|
|
32
|
-
expect(wrapper.find(SparegrisIkon).hasClass('my-custom-class')).toBe(true);
|
|
33
|
-
});
|
|
34
|
-
it('should add modifying classes when modifiers are given', function () {
|
|
35
|
-
var wrapper = getWrapper({
|
|
36
|
-
condensed: true,
|
|
37
|
-
greyCharcoal: true
|
|
38
|
-
});
|
|
39
|
-
expect(wrapper.hasClass('ffe-icon-card--condensed')).toBe(true);
|
|
40
|
-
expect(wrapper.hasClass('ffe-icon-card--grey-charcoal')).toBe(true);
|
|
41
|
-
});
|
|
42
|
-
it('should render children as a function', function () {
|
|
43
|
-
var wrapper = getWrapper({
|
|
44
|
-
children: function children(Components) {
|
|
45
|
-
return /*#__PURE__*/React.createElement(Components.Text, null, "Hello world");
|
|
46
|
-
}
|
|
47
|
-
});
|
|
48
|
-
expect(wrapper.find(Text).exists()).toBe(true);
|
|
49
|
-
});
|
|
50
|
-
it('should render my custom class', function () {
|
|
51
|
-
var wrapper = getWrapper({
|
|
52
|
-
className: 'my-custom-class'
|
|
53
|
-
});
|
|
54
|
-
expect(wrapper.hasClass('my-custom-class')).toBe(true);
|
|
55
|
-
});
|
|
56
|
-
});
|
|
@@ -1,50 +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 ImageCard from './ImageCard';
|
|
6
|
-
import { Text } from '../components';
|
|
7
|
-
var image = /*#__PURE__*/React.createElement("img", {
|
|
8
|
-
alt: ""
|
|
9
|
-
});
|
|
10
|
-
|
|
11
|
-
var getWrapper = function getWrapper(props) {
|
|
12
|
-
return shallow( /*#__PURE__*/React.createElement(ImageCard, _extends({}, props, {
|
|
13
|
-
image: image
|
|
14
|
-
})));
|
|
15
|
-
};
|
|
16
|
-
|
|
17
|
-
var children = /*#__PURE__*/React.createElement("div", null, "Hello world");
|
|
18
|
-
describe('ImageCard', function () {
|
|
19
|
-
it('should render correct class and contain a div with image class', function () {
|
|
20
|
-
var wrapper = getWrapper();
|
|
21
|
-
expect(wrapper.hasClass('ffe-image-card')).toBe(true);
|
|
22
|
-
expect(wrapper.find('div.ffe-image-card__image').exists()).toBe(true);
|
|
23
|
-
});
|
|
24
|
-
it('should render image and overlay alongside each other', function () {
|
|
25
|
-
var wrapper = getWrapper();
|
|
26
|
-
var imageEl = wrapper.find('.ffe-image-card__image');
|
|
27
|
-
expect(imageEl.children().first().hasClass('ffe-image-card__image__overlay')).toBe(true);
|
|
28
|
-
expect(imageEl.children().last().getElement()).toEqual(image);
|
|
29
|
-
});
|
|
30
|
-
it('should render children inside a div with body class', function () {
|
|
31
|
-
var wrapper = getWrapper({
|
|
32
|
-
children: children
|
|
33
|
-
});
|
|
34
|
-
expect(wrapper.find('.ffe-image-card__body').children().first().getElement()).toEqual(children);
|
|
35
|
-
});
|
|
36
|
-
it('should render children as a function', function () {
|
|
37
|
-
var wrapper = getWrapper({
|
|
38
|
-
children: function children(Components) {
|
|
39
|
-
return /*#__PURE__*/React.createElement(Components.Text, null, "Hello world");
|
|
40
|
-
}
|
|
41
|
-
});
|
|
42
|
-
expect(wrapper.find(Text).exists()).toBe(true);
|
|
43
|
-
});
|
|
44
|
-
it('should render my custom class', function () {
|
|
45
|
-
var wrapper = getWrapper({
|
|
46
|
-
className: 'my-custom-class'
|
|
47
|
-
});
|
|
48
|
-
expect(wrapper.hasClass('my-custom-class')).toBe(true);
|
|
49
|
-
});
|
|
50
|
-
});
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { shallow } from 'enzyme';
|
|
3
|
-
import TextCard from './TextCard';
|
|
4
|
-
import { Text } from '../components';
|
|
5
|
-
|
|
6
|
-
var getWrapper = function getWrapper(props) {
|
|
7
|
-
return shallow( /*#__PURE__*/React.createElement(TextCard, props));
|
|
8
|
-
};
|
|
9
|
-
|
|
10
|
-
var children = /*#__PURE__*/React.createElement("div", null, "Hello world");
|
|
11
|
-
describe('TextCard', function () {
|
|
12
|
-
it('should render correct class and children', function () {
|
|
13
|
-
var wrapper = getWrapper({
|
|
14
|
-
children: children
|
|
15
|
-
});
|
|
16
|
-
expect(wrapper.hasClass('ffe-text-card')).toBe(true);
|
|
17
|
-
expect(wrapper.find('.ffe-text-card').children().first().getElement()).toEqual(children);
|
|
18
|
-
});
|
|
19
|
-
it('should render children as a function', function () {
|
|
20
|
-
var wrapper = getWrapper({
|
|
21
|
-
children: function children(Components) {
|
|
22
|
-
return /*#__PURE__*/React.createElement(Components.Text, null, "Hello world");
|
|
23
|
-
}
|
|
24
|
-
});
|
|
25
|
-
expect(wrapper.find(Text).exists()).toBe(true);
|
|
26
|
-
});
|
|
27
|
-
it('should render my custom class', function () {
|
|
28
|
-
var wrapper = getWrapper({
|
|
29
|
-
className: 'my-custom-class'
|
|
30
|
-
});
|
|
31
|
-
expect(wrapper.hasClass('my-custom-class')).toBe(true);
|
|
32
|
-
});
|
|
33
|
-
});
|
package/lib/CardBase.spec.js
DELETED
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var _react = _interopRequireDefault(require("react"));
|
|
4
|
-
|
|
5
|
-
var _enzyme = require("enzyme");
|
|
6
|
-
|
|
7
|
-
var _CardBase = _interopRequireDefault(require("./CardBase"));
|
|
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(_CardBase.default, props));
|
|
13
|
-
};
|
|
14
|
-
|
|
15
|
-
var children = /*#__PURE__*/_react.default.createElement("div", null, "Hello world");
|
|
16
|
-
|
|
17
|
-
describe('CardBase', function () {
|
|
18
|
-
it('should render a div element with correct class and children inside', function () {
|
|
19
|
-
var wrapper = getWrapper({
|
|
20
|
-
children: children
|
|
21
|
-
});
|
|
22
|
-
expect(wrapper.find('div').exists()).toBe(true);
|
|
23
|
-
expect(wrapper.hasClass('ffe-card-base')).toBe(true);
|
|
24
|
-
expect(wrapper.find('.ffe-card-base').children().first().getElement()).toEqual(children);
|
|
25
|
-
});
|
|
26
|
-
it('should render my custom element and custom class', function () {
|
|
27
|
-
var wrapper = getWrapper({
|
|
28
|
-
className: 'my-custom-class',
|
|
29
|
-
element: 'article'
|
|
30
|
-
});
|
|
31
|
-
expect(wrapper.find('article').exists()).toBe(true);
|
|
32
|
-
expect(wrapper.hasClass('my-custom-class')).toBe(true);
|
|
33
|
-
});
|
|
34
|
-
});
|
|
@@ -1,65 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var _react = _interopRequireDefault(require("react"));
|
|
4
|
-
|
|
5
|
-
var _enzyme = require("enzyme");
|
|
6
|
-
|
|
7
|
-
var _IconCard = _interopRequireDefault(require("./IconCard"));
|
|
8
|
-
|
|
9
|
-
var _sparegrisIkon = _interopRequireDefault(require("../../../ffe-icons-react/lib/sparegris-ikon"));
|
|
10
|
-
|
|
11
|
-
var _components = require("../components");
|
|
12
|
-
|
|
13
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
14
|
-
|
|
15
|
-
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); }
|
|
16
|
-
|
|
17
|
-
var getWrapper = function getWrapper(props) {
|
|
18
|
-
return (0, _enzyme.shallow)( /*#__PURE__*/_react.default.createElement(_IconCard.default, _extends({
|
|
19
|
-
icon: /*#__PURE__*/_react.default.createElement(_sparegrisIkon.default, null)
|
|
20
|
-
}, props)));
|
|
21
|
-
};
|
|
22
|
-
|
|
23
|
-
var children = /*#__PURE__*/_react.default.createElement("div", null, "Hello world");
|
|
24
|
-
|
|
25
|
-
describe('IconCard', function () {
|
|
26
|
-
it('should render correct class and contain a div with body class', function () {
|
|
27
|
-
var wrapper = getWrapper({
|
|
28
|
-
children: children
|
|
29
|
-
});
|
|
30
|
-
expect(wrapper.hasClass('ffe-icon-card')).toBe(true);
|
|
31
|
-
expect(wrapper.find('.ffe-icon-card__body').exists()).toBe(true);
|
|
32
|
-
expect(wrapper.find('.ffe-icon-card__body').children().first().getElement()).toEqual(children);
|
|
33
|
-
});
|
|
34
|
-
it('should render icon, with an added class', function () {
|
|
35
|
-
var wrapper = getWrapper({
|
|
36
|
-
icon: /*#__PURE__*/_react.default.createElement(_sparegrisIkon.default, {
|
|
37
|
-
className: "my-custom-class"
|
|
38
|
-
})
|
|
39
|
-
});
|
|
40
|
-
expect(wrapper.find(_sparegrisIkon.default).hasClass('ffe-icon-card__icon')).toBe(true);
|
|
41
|
-
expect(wrapper.find(_sparegrisIkon.default).hasClass('my-custom-class')).toBe(true);
|
|
42
|
-
});
|
|
43
|
-
it('should add modifying classes when modifiers are given', function () {
|
|
44
|
-
var wrapper = getWrapper({
|
|
45
|
-
condensed: true,
|
|
46
|
-
greyCharcoal: true
|
|
47
|
-
});
|
|
48
|
-
expect(wrapper.hasClass('ffe-icon-card--condensed')).toBe(true);
|
|
49
|
-
expect(wrapper.hasClass('ffe-icon-card--grey-charcoal')).toBe(true);
|
|
50
|
-
});
|
|
51
|
-
it('should render children as a function', function () {
|
|
52
|
-
var wrapper = getWrapper({
|
|
53
|
-
children: function children(Components) {
|
|
54
|
-
return /*#__PURE__*/_react.default.createElement(Components.Text, null, "Hello world");
|
|
55
|
-
}
|
|
56
|
-
});
|
|
57
|
-
expect(wrapper.find(_components.Text).exists()).toBe(true);
|
|
58
|
-
});
|
|
59
|
-
it('should render my custom class', function () {
|
|
60
|
-
var wrapper = getWrapper({
|
|
61
|
-
className: 'my-custom-class'
|
|
62
|
-
});
|
|
63
|
-
expect(wrapper.hasClass('my-custom-class')).toBe(true);
|
|
64
|
-
});
|
|
65
|
-
});
|
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var _react = _interopRequireDefault(require("react"));
|
|
4
|
-
|
|
5
|
-
var _enzyme = require("enzyme");
|
|
6
|
-
|
|
7
|
-
var _ImageCard = _interopRequireDefault(require("./ImageCard"));
|
|
8
|
-
|
|
9
|
-
var _components = require("../components");
|
|
10
|
-
|
|
11
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
12
|
-
|
|
13
|
-
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); }
|
|
14
|
-
|
|
15
|
-
var image = /*#__PURE__*/_react.default.createElement("img", {
|
|
16
|
-
alt: ""
|
|
17
|
-
});
|
|
18
|
-
|
|
19
|
-
var getWrapper = function getWrapper(props) {
|
|
20
|
-
return (0, _enzyme.shallow)( /*#__PURE__*/_react.default.createElement(_ImageCard.default, _extends({}, props, {
|
|
21
|
-
image: image
|
|
22
|
-
})));
|
|
23
|
-
};
|
|
24
|
-
|
|
25
|
-
var children = /*#__PURE__*/_react.default.createElement("div", null, "Hello world");
|
|
26
|
-
|
|
27
|
-
describe('ImageCard', function () {
|
|
28
|
-
it('should render correct class and contain a div with image class', function () {
|
|
29
|
-
var wrapper = getWrapper();
|
|
30
|
-
expect(wrapper.hasClass('ffe-image-card')).toBe(true);
|
|
31
|
-
expect(wrapper.find('div.ffe-image-card__image').exists()).toBe(true);
|
|
32
|
-
});
|
|
33
|
-
it('should render image and overlay alongside each other', function () {
|
|
34
|
-
var wrapper = getWrapper();
|
|
35
|
-
var imageEl = wrapper.find('.ffe-image-card__image');
|
|
36
|
-
expect(imageEl.children().first().hasClass('ffe-image-card__image__overlay')).toBe(true);
|
|
37
|
-
expect(imageEl.children().last().getElement()).toEqual(image);
|
|
38
|
-
});
|
|
39
|
-
it('should render children inside a div with body class', function () {
|
|
40
|
-
var wrapper = getWrapper({
|
|
41
|
-
children: children
|
|
42
|
-
});
|
|
43
|
-
expect(wrapper.find('.ffe-image-card__body').children().first().getElement()).toEqual(children);
|
|
44
|
-
});
|
|
45
|
-
it('should render children as a function', function () {
|
|
46
|
-
var wrapper = getWrapper({
|
|
47
|
-
children: function children(Components) {
|
|
48
|
-
return /*#__PURE__*/_react.default.createElement(Components.Text, null, "Hello world");
|
|
49
|
-
}
|
|
50
|
-
});
|
|
51
|
-
expect(wrapper.find(_components.Text).exists()).toBe(true);
|
|
52
|
-
});
|
|
53
|
-
it('should render my custom class', function () {
|
|
54
|
-
var wrapper = getWrapper({
|
|
55
|
-
className: 'my-custom-class'
|
|
56
|
-
});
|
|
57
|
-
expect(wrapper.hasClass('my-custom-class')).toBe(true);
|
|
58
|
-
});
|
|
59
|
-
});
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var _react = _interopRequireDefault(require("react"));
|
|
4
|
-
|
|
5
|
-
var _enzyme = require("enzyme");
|
|
6
|
-
|
|
7
|
-
var _TextCard = _interopRequireDefault(require("./TextCard"));
|
|
8
|
-
|
|
9
|
-
var _components = require("../components");
|
|
10
|
-
|
|
11
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
12
|
-
|
|
13
|
-
var getWrapper = function getWrapper(props) {
|
|
14
|
-
return (0, _enzyme.shallow)( /*#__PURE__*/_react.default.createElement(_TextCard.default, props));
|
|
15
|
-
};
|
|
16
|
-
|
|
17
|
-
var children = /*#__PURE__*/_react.default.createElement("div", null, "Hello world");
|
|
18
|
-
|
|
19
|
-
describe('TextCard', function () {
|
|
20
|
-
it('should render correct class and children', function () {
|
|
21
|
-
var wrapper = getWrapper({
|
|
22
|
-
children: children
|
|
23
|
-
});
|
|
24
|
-
expect(wrapper.hasClass('ffe-text-card')).toBe(true);
|
|
25
|
-
expect(wrapper.find('.ffe-text-card').children().first().getElement()).toEqual(children);
|
|
26
|
-
});
|
|
27
|
-
it('should render children as a function', function () {
|
|
28
|
-
var wrapper = getWrapper({
|
|
29
|
-
children: function children(Components) {
|
|
30
|
-
return /*#__PURE__*/_react.default.createElement(Components.Text, null, "Hello world");
|
|
31
|
-
}
|
|
32
|
-
});
|
|
33
|
-
expect(wrapper.find(_components.Text).exists()).toBe(true);
|
|
34
|
-
});
|
|
35
|
-
it('should render my custom class', function () {
|
|
36
|
-
var wrapper = getWrapper({
|
|
37
|
-
className: 'my-custom-class'
|
|
38
|
-
});
|
|
39
|
-
expect(wrapper.hasClass('my-custom-class')).toBe(true);
|
|
40
|
-
});
|
|
41
|
-
});
|