@sb1/ffe-grid-react 11.1.0 → 11.1.1
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/package.json +6 -8
- package/es/Grid.spec.js +0 -62
- package/es/GridCol.spec.js +0 -209
- package/es/GridRow.spec.js +0 -97
- package/es/InlineGrid.spec.js +0 -45
- package/lib/Grid.spec.js +0 -69
- package/lib/GridCol.spec.js +0 -217
- package/lib/GridRow.spec.js +0 -106
- package/lib/InlineGrid.spec.js +0 -52
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sb1/ffe-grid-react",
|
|
3
|
-
"version": "11.1.
|
|
3
|
+
"version": "11.1.1",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"author": "SpareBank1",
|
|
6
6
|
"files": [
|
|
@@ -17,11 +17,8 @@
|
|
|
17
17
|
"url": "ssh://git@github.com:SpareBank1/designsystem.git"
|
|
18
18
|
},
|
|
19
19
|
"scripts": {
|
|
20
|
-
"build": "
|
|
21
|
-
"
|
|
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,9 +26,10 @@
|
|
|
29
26
|
"setupTestFrameworkScriptFile": "../../test-setup.js"
|
|
30
27
|
},
|
|
31
28
|
"dependencies": {
|
|
32
|
-
"classnames": "^2.
|
|
29
|
+
"classnames": "^2.3.1"
|
|
33
30
|
},
|
|
34
31
|
"devDependencies": {
|
|
32
|
+
"@sb1/ffe-buildtool": "^0.1.0",
|
|
35
33
|
"enzyme": "^3.7.0",
|
|
36
34
|
"enzyme-adapter-react-16": "^1.7.0",
|
|
37
35
|
"jest": "^26.0.0",
|
|
@@ -45,5 +43,5 @@
|
|
|
45
43
|
"publishConfig": {
|
|
46
44
|
"access": "public"
|
|
47
45
|
},
|
|
48
|
-
"gitHead": "
|
|
46
|
+
"gitHead": "59eb2e12625e744f1a116c14a40cf69f1bbecdc6"
|
|
49
47
|
}
|
package/es/Grid.spec.js
DELETED
|
@@ -1,62 +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 { Grid } from '.';
|
|
6
|
-
var defaultProps = {
|
|
7
|
-
children: /*#__PURE__*/React.createElement("p", null, "blah")
|
|
8
|
-
};
|
|
9
|
-
|
|
10
|
-
var renderShallow = function renderShallow() {
|
|
11
|
-
var props = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
12
|
-
return shallow( /*#__PURE__*/React.createElement(Grid, _extends({}, defaultProps, props)));
|
|
13
|
-
};
|
|
14
|
-
|
|
15
|
-
describe('Grid', function () {
|
|
16
|
-
it('renders with default class and element', function () {
|
|
17
|
-
var el = renderShallow();
|
|
18
|
-
expect(el.prop('className')).toBe('ffe-grid');
|
|
19
|
-
expect(el.type()).toBe('div');
|
|
20
|
-
});
|
|
21
|
-
it('renders with custom class', function () {
|
|
22
|
-
var el = renderShallow({
|
|
23
|
-
className: 'custom-class'
|
|
24
|
-
});
|
|
25
|
-
expect(el.hasClass('custom-class')).toBe(true);
|
|
26
|
-
});
|
|
27
|
-
it('renders provided children node', function () {
|
|
28
|
-
var el = renderShallow();
|
|
29
|
-
expect(el.containsMatchingElement( /*#__PURE__*/React.createElement("p", null, "blah"))).toBe(true);
|
|
30
|
-
});
|
|
31
|
-
it('defaults to not setting the "--no-top-padding" modifier', function () {
|
|
32
|
-
var el = renderShallow();
|
|
33
|
-
expect(el.hasClass('ffe-grid--no-top-padding')).toBe(false);
|
|
34
|
-
});
|
|
35
|
-
it('sets the "--no-top-padding" modifier if "topPadding" prop is false', function () {
|
|
36
|
-
var el = renderShallow({
|
|
37
|
-
topPadding: false
|
|
38
|
-
});
|
|
39
|
-
expect(el.hasClass('ffe-grid--no-top-padding')).toBe(true);
|
|
40
|
-
});
|
|
41
|
-
it('sets the condensed modifier', function () {
|
|
42
|
-
var el = renderShallow({
|
|
43
|
-
condensed: true
|
|
44
|
-
});
|
|
45
|
-
expect(el.hasClass('ffe-grid')).toBe(true);
|
|
46
|
-
expect(el.hasClass('ffe-grid--condensed')).toBe(true);
|
|
47
|
-
});
|
|
48
|
-
it('preserves other attributes that are passed to it', function () {
|
|
49
|
-
var handler = jest.fn();
|
|
50
|
-
var el = renderShallow({
|
|
51
|
-
onClick: handler
|
|
52
|
-
});
|
|
53
|
-
el.simulate('click');
|
|
54
|
-
expect(handler).toHaveBeenCalledTimes(1);
|
|
55
|
-
});
|
|
56
|
-
it('can render a custom root element', function () {
|
|
57
|
-
var el = renderShallow({
|
|
58
|
-
element: 'section'
|
|
59
|
-
});
|
|
60
|
-
expect(el.type()).toBe('section');
|
|
61
|
-
});
|
|
62
|
-
});
|
package/es/GridCol.spec.js
DELETED
|
@@ -1,209 +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 { GridCol } from '.';
|
|
6
|
-
import backgroundColors from './background-colors';
|
|
7
|
-
var defaultProps = {
|
|
8
|
-
children: /*#__PURE__*/React.createElement("p", null, "blah")
|
|
9
|
-
};
|
|
10
|
-
|
|
11
|
-
var renderShallow = function renderShallow() {
|
|
12
|
-
var props = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
13
|
-
return shallow( /*#__PURE__*/React.createElement(GridCol, _extends({}, defaultProps, props)));
|
|
14
|
-
};
|
|
15
|
-
|
|
16
|
-
describe('GridCol', function () {
|
|
17
|
-
it('renders with custom class', function () {
|
|
18
|
-
var el = renderShallow({
|
|
19
|
-
className: 'custom-class'
|
|
20
|
-
});
|
|
21
|
-
expect(el.hasClass('custom-class')).toBe(true);
|
|
22
|
-
});
|
|
23
|
-
it('renders provided children node', function () {
|
|
24
|
-
var el = renderShallow();
|
|
25
|
-
expect(el.containsMatchingElement( /*#__PURE__*/React.createElement("p", null, "blah"))).toBe(true);
|
|
26
|
-
});
|
|
27
|
-
it('supports setting cols as a number', function () {
|
|
28
|
-
var el = renderShallow({
|
|
29
|
-
lg: 10
|
|
30
|
-
});
|
|
31
|
-
expect(el.hasClass('ffe-grid__col--lg-10')).toBe(true);
|
|
32
|
-
});
|
|
33
|
-
it('supports setting cols as a string', function () {
|
|
34
|
-
var el = renderShallow({
|
|
35
|
-
sm: '1'
|
|
36
|
-
});
|
|
37
|
-
expect(el.hasClass('ffe-grid__col--sm-1')).toBe(true);
|
|
38
|
-
});
|
|
39
|
-
it('supports setting cols as an object', function () {
|
|
40
|
-
var el = renderShallow({
|
|
41
|
-
md: {
|
|
42
|
-
cols: 4
|
|
43
|
-
}
|
|
44
|
-
});
|
|
45
|
-
expect(el.hasClass('ffe-grid__col--md-4')).toBe(true);
|
|
46
|
-
});
|
|
47
|
-
it('supports setting cols and offset', function () {
|
|
48
|
-
var el = renderShallow({
|
|
49
|
-
sm: {
|
|
50
|
-
cols: 4,
|
|
51
|
-
offset: '2'
|
|
52
|
-
}
|
|
53
|
-
});
|
|
54
|
-
expect(el.hasClass('ffe-grid__col--sm-4')).toBe(true);
|
|
55
|
-
expect(el.hasClass('ffe-grid__col--sm-offset-2')).toBe(true);
|
|
56
|
-
});
|
|
57
|
-
it('does not set an offset class if no offset is provided', function () {
|
|
58
|
-
var el = renderShallow({
|
|
59
|
-
lg: {
|
|
60
|
-
cols: 7
|
|
61
|
-
}
|
|
62
|
-
});
|
|
63
|
-
expect(el.prop('className')).not.toContain('offset');
|
|
64
|
-
});
|
|
65
|
-
it('sets the center modifier if the value is boolean true', function () {
|
|
66
|
-
var el = renderShallow({
|
|
67
|
-
center: true
|
|
68
|
-
});
|
|
69
|
-
expect(el.hasClass('ffe-grid__col--center')).toBe(true);
|
|
70
|
-
});
|
|
71
|
-
it('sets the center modifier if the value is boolean true', function () {
|
|
72
|
-
var el = renderShallow({
|
|
73
|
-
centerText: true
|
|
74
|
-
});
|
|
75
|
-
expect(el.hasClass('ffe-grid__col--center-text')).toBe(true);
|
|
76
|
-
});
|
|
77
|
-
it('sets the center modifier as a string', function () {
|
|
78
|
-
var el = renderShallow({
|
|
79
|
-
center: 'true'
|
|
80
|
-
});
|
|
81
|
-
expect(el.hasClass('ffe-grid__col--center')).toBe(true);
|
|
82
|
-
});
|
|
83
|
-
it('sets the center modifier if the value is truthy', function () {
|
|
84
|
-
var el = renderShallow({
|
|
85
|
-
center: 'wombats'
|
|
86
|
-
});
|
|
87
|
-
expect(el.hasClass('ffe-grid__col--center')).toBe(true);
|
|
88
|
-
});
|
|
89
|
-
it('does not set the center modifier if the value is boolean false', function () {
|
|
90
|
-
var el = renderShallow({
|
|
91
|
-
center: false
|
|
92
|
-
});
|
|
93
|
-
expect(el.hasClass('ffe-grid__col--center')).not.toBe(true);
|
|
94
|
-
});
|
|
95
|
-
it('sets the top modifier', function () {
|
|
96
|
-
var el = renderShallow({
|
|
97
|
-
top: true
|
|
98
|
-
});
|
|
99
|
-
expect(el.hasClass('ffe-grid__col--top')).toBe(true);
|
|
100
|
-
});
|
|
101
|
-
it('sets background color class if valid', function () {
|
|
102
|
-
backgroundColors.forEach(function (background) {
|
|
103
|
-
var el = renderShallow({
|
|
104
|
-
background: background
|
|
105
|
-
});
|
|
106
|
-
expect(el.hasClass("ffe-grid__col--bg-".concat(background))).toBe(true);
|
|
107
|
-
});
|
|
108
|
-
});
|
|
109
|
-
it('does not set background color class if not valid', function () {
|
|
110
|
-
var illegalBackgroundColors = ['ice-cream', 'log("hack")', '123456'];
|
|
111
|
-
illegalBackgroundColors.forEach(function (background) {
|
|
112
|
-
var el = renderShallow({
|
|
113
|
-
background: background
|
|
114
|
-
});
|
|
115
|
-
expect(el.hasClass("ffe-grid__col--bg-".concat(background))).toBe(false);
|
|
116
|
-
});
|
|
117
|
-
});
|
|
118
|
-
it('throws for removed background colours', function () {
|
|
119
|
-
expect(function () {
|
|
120
|
-
return renderShallow({
|
|
121
|
-
background: 'blue-cobalt'
|
|
122
|
-
});
|
|
123
|
-
}).toThrow('Support for the blue-cobalt background on <GridCol> has been removed, please see the CHANGELOG');
|
|
124
|
-
});
|
|
125
|
-
it('sets all the things o/', function () {
|
|
126
|
-
var el = renderShallow({
|
|
127
|
-
sm: {
|
|
128
|
-
cols: '6',
|
|
129
|
-
offset: 2
|
|
130
|
-
},
|
|
131
|
-
md: 8,
|
|
132
|
-
lg: {
|
|
133
|
-
cols: 2
|
|
134
|
-
},
|
|
135
|
-
center: true,
|
|
136
|
-
centerText: true,
|
|
137
|
-
bottom: true,
|
|
138
|
-
between: true,
|
|
139
|
-
horizontal: true,
|
|
140
|
-
reverse: true
|
|
141
|
-
});
|
|
142
|
-
expect(el.hasClass('ffe-grid__col--sm-6')).toBe(true);
|
|
143
|
-
expect(el.hasClass('ffe-grid__col--sm-offset-2')).toBe(true);
|
|
144
|
-
expect(el.hasClass('ffe-grid__col--md-8')).toBe(true);
|
|
145
|
-
expect(el.hasClass('ffe-grid__col--lg-2')).toBe(true);
|
|
146
|
-
expect(el.hasClass('ffe-grid__col--center')).toBe(true);
|
|
147
|
-
expect(el.hasClass('ffe-grid__col--center-text')).toBe(true);
|
|
148
|
-
expect(el.hasClass('ffe-grid__col--bottom')).toBe(true);
|
|
149
|
-
expect(el.hasClass('ffe-grid__col--between')).toBe(true);
|
|
150
|
-
expect(el.hasClass('ffe-grid__col--horizontal')).toBe(true);
|
|
151
|
-
expect(el.hasClass('ffe-grid__col--reverse')).toBe(true);
|
|
152
|
-
});
|
|
153
|
-
it('preserves other attributes that are passed to it', function () {
|
|
154
|
-
var handler = jest.fn();
|
|
155
|
-
var el = renderShallow({
|
|
156
|
-
onClick: handler
|
|
157
|
-
});
|
|
158
|
-
el.simulate('click');
|
|
159
|
-
expect(handler).toHaveBeenCalledTimes(1);
|
|
160
|
-
});
|
|
161
|
-
it('can render a custom root element', function () {
|
|
162
|
-
var el = renderShallow({
|
|
163
|
-
element: 'section'
|
|
164
|
-
});
|
|
165
|
-
expect(el.type()).toBe('section');
|
|
166
|
-
});
|
|
167
|
-
it('does not pass on known properties to its root element', function () {
|
|
168
|
-
var el = renderShallow({
|
|
169
|
-
center: true,
|
|
170
|
-
reverse: true
|
|
171
|
-
});
|
|
172
|
-
expect(el.props().center).toBe(undefined);
|
|
173
|
-
expect(el.props().reverse).toBe(undefined);
|
|
174
|
-
});
|
|
175
|
-
it('can render with offset 0 and columns 0', function () {
|
|
176
|
-
var el = renderShallow({
|
|
177
|
-
md: {
|
|
178
|
-
cols: 0,
|
|
179
|
-
offset: 0
|
|
180
|
-
}
|
|
181
|
-
});
|
|
182
|
-
expect(el.hasClass('ffe-grid__col--md-offset-0')).toBe(true);
|
|
183
|
-
expect(el.hasClass('ffe-grid__col--md-0')).toBe(true);
|
|
184
|
-
});
|
|
185
|
-
it('can render with offset 1 and columns 1', function () {
|
|
186
|
-
var el = renderShallow({
|
|
187
|
-
md: {
|
|
188
|
-
cols: 1,
|
|
189
|
-
offset: 1
|
|
190
|
-
}
|
|
191
|
-
});
|
|
192
|
-
expect(el.hasClass('ffe-grid__col--md-offset-1')).toBe(true);
|
|
193
|
-
expect(el.hasClass('ffe-grid__col--md-1')).toBe(true);
|
|
194
|
-
});
|
|
195
|
-
it('defaults to sm={12} if no dimensions are provided', function () {
|
|
196
|
-
var el = renderShallow();
|
|
197
|
-
expect(el.hasClass('ffe-grid__col--sm-12')).toBe(true);
|
|
198
|
-
});
|
|
199
|
-
it('defaults to not setting the "--no-bottom-padding" modifier', function () {
|
|
200
|
-
var el = renderShallow();
|
|
201
|
-
expect(el.hasClass('ffe-grid__col--no-bottom-padding')).toBe(false);
|
|
202
|
-
});
|
|
203
|
-
it('sets the "--no-bottom-padding" modifier if "bottomPadding" prop is false', function () {
|
|
204
|
-
var el = renderShallow({
|
|
205
|
-
bottomPadding: false
|
|
206
|
-
});
|
|
207
|
-
expect(el.hasClass('ffe-grid__col--no-bottom-padding')).toBe(true);
|
|
208
|
-
});
|
|
209
|
-
});
|
package/es/GridRow.spec.js
DELETED
|
@@ -1,97 +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 { GridRow, GridCol } from '.';
|
|
6
|
-
import backgroundColors from './background-colors';
|
|
7
|
-
var defaultProps = {
|
|
8
|
-
children: /*#__PURE__*/React.createElement("p", null, "blah")
|
|
9
|
-
};
|
|
10
|
-
|
|
11
|
-
var renderShallow = function renderShallow() {
|
|
12
|
-
var props = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
13
|
-
return shallow( /*#__PURE__*/React.createElement(GridRow, _extends({}, defaultProps, props)));
|
|
14
|
-
};
|
|
15
|
-
|
|
16
|
-
describe('GridRow', function () {
|
|
17
|
-
it('renders with default class and element', function () {
|
|
18
|
-
var el = renderShallow();
|
|
19
|
-
expect(el.prop('className')).toBe('ffe-grid__row');
|
|
20
|
-
expect(el.type()).toBe('div');
|
|
21
|
-
});
|
|
22
|
-
it('renders with custom class', function () {
|
|
23
|
-
var el = renderShallow({
|
|
24
|
-
className: 'custom-class'
|
|
25
|
-
});
|
|
26
|
-
expect(el.hasClass('custom-class')).toBe(true);
|
|
27
|
-
});
|
|
28
|
-
it('renders provided children node', function () {
|
|
29
|
-
var el = renderShallow();
|
|
30
|
-
expect(el.containsMatchingElement( /*#__PURE__*/React.createElement("p", null, "blah"))).toBe(true);
|
|
31
|
-
});
|
|
32
|
-
it('sets the reverse modifier', function () {
|
|
33
|
-
var el = renderShallow({
|
|
34
|
-
reverse: true
|
|
35
|
-
});
|
|
36
|
-
expect(el.hasClass('ffe-grid__row')).toBe(true);
|
|
37
|
-
expect(el.hasClass('ffe-grid__row--reverse')).toBe(true);
|
|
38
|
-
});
|
|
39
|
-
it('adds correct class for all valid background colors', function () {
|
|
40
|
-
var el = renderShallow();
|
|
41
|
-
backgroundColors.forEach(function (background) {
|
|
42
|
-
el.setProps({
|
|
43
|
-
background: background
|
|
44
|
-
});
|
|
45
|
-
expect(el.hasClass("ffe-grid__row--bg-".concat(background))).toBe(true);
|
|
46
|
-
});
|
|
47
|
-
});
|
|
48
|
-
it('does not add any background-class for invalid background colors', function () {
|
|
49
|
-
var el = renderShallow();
|
|
50
|
-
console.error = jest.fn();
|
|
51
|
-
['illegal', 'color values', 'are ignored'].forEach(function (background) {
|
|
52
|
-
el.setProps({
|
|
53
|
-
background: background
|
|
54
|
-
});
|
|
55
|
-
expect(el.hasClass("ffe-grid__row--bg-".concat(background))).toBe(false);
|
|
56
|
-
});
|
|
57
|
-
});
|
|
58
|
-
it('throws for removed background colours', function () {
|
|
59
|
-
expect(function () {
|
|
60
|
-
return renderShallow({
|
|
61
|
-
background: 'blue-cobalt'
|
|
62
|
-
});
|
|
63
|
-
}).toThrow('Support for the blue-cobalt background on <GridRow> has been removed, please see the CHANGELOG');
|
|
64
|
-
});
|
|
65
|
-
it('renders coloured rows with extra wrappers', function () {
|
|
66
|
-
backgroundColors.forEach(function (background) {
|
|
67
|
-
var el = renderShallow({
|
|
68
|
-
background: background,
|
|
69
|
-
children: /*#__PURE__*/React.createElement(GridCol, {
|
|
70
|
-
lg: 12
|
|
71
|
-
}, /*#__PURE__*/React.createElement("p", null, "blah"))
|
|
72
|
-
});
|
|
73
|
-
expect(el.childAt(0).hasClass('ffe-grid__row-wrapper')).toBe(true);
|
|
74
|
-
});
|
|
75
|
-
});
|
|
76
|
-
it('sets the topPadding modifier', function () {
|
|
77
|
-
var el = renderShallow({
|
|
78
|
-
topPadding: true
|
|
79
|
-
});
|
|
80
|
-
expect(el.hasClass('ffe-grid__row')).toBe(true);
|
|
81
|
-
expect(el.hasClass('ffe-grid__row--top-padding')).toBe(true);
|
|
82
|
-
});
|
|
83
|
-
it('preserves other attributes that are passed to it', function () {
|
|
84
|
-
var handler = jest.fn();
|
|
85
|
-
var el = renderShallow({
|
|
86
|
-
onClick: handler
|
|
87
|
-
});
|
|
88
|
-
el.simulate('click');
|
|
89
|
-
expect(handler).toHaveBeenCalledTimes(1);
|
|
90
|
-
});
|
|
91
|
-
it('can render a custom root element', function () {
|
|
92
|
-
var el = renderShallow({
|
|
93
|
-
element: 'section'
|
|
94
|
-
});
|
|
95
|
-
expect(el.type()).toBe('section');
|
|
96
|
-
});
|
|
97
|
-
});
|
package/es/InlineGrid.spec.js
DELETED
|
@@ -1,45 +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 { InlineGrid } from '.';
|
|
6
|
-
var defaultProps = {
|
|
7
|
-
children: /*#__PURE__*/React.createElement("p", null, "blah")
|
|
8
|
-
};
|
|
9
|
-
|
|
10
|
-
var renderShallow = function renderShallow() {
|
|
11
|
-
var props = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
12
|
-
return shallow( /*#__PURE__*/React.createElement(InlineGrid, _extends({}, defaultProps, props)));
|
|
13
|
-
};
|
|
14
|
-
|
|
15
|
-
describe('InlineGrid', function () {
|
|
16
|
-
it('renders with default class and element', function () {
|
|
17
|
-
var el = renderShallow();
|
|
18
|
-
expect(el.hasClass('ffe-grid--inline')).toBe(true);
|
|
19
|
-
expect(el.type()).toBe('div');
|
|
20
|
-
});
|
|
21
|
-
it('renders with custom class', function () {
|
|
22
|
-
var el = renderShallow({
|
|
23
|
-
className: 'custom-class'
|
|
24
|
-
});
|
|
25
|
-
expect(el.hasClass('custom-class')).toBe(true);
|
|
26
|
-
});
|
|
27
|
-
it('renders provided children node', function () {
|
|
28
|
-
var el = renderShallow();
|
|
29
|
-
expect(el.containsMatchingElement( /*#__PURE__*/React.createElement("p", null, "blah"))).toBe(true);
|
|
30
|
-
});
|
|
31
|
-
it('preserves other attributes that are passed to it', function () {
|
|
32
|
-
var handler = jest.fn();
|
|
33
|
-
var el = renderShallow({
|
|
34
|
-
onClick: handler
|
|
35
|
-
});
|
|
36
|
-
el.simulate('click');
|
|
37
|
-
expect(handler).toHaveBeenCalledTimes(1);
|
|
38
|
-
});
|
|
39
|
-
it('can render a custom root element', function () {
|
|
40
|
-
var el = renderShallow({
|
|
41
|
-
element: 'section'
|
|
42
|
-
});
|
|
43
|
-
expect(el.type()).toBe('section');
|
|
44
|
-
});
|
|
45
|
-
});
|
package/lib/Grid.spec.js
DELETED
|
@@ -1,69 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var _react = _interopRequireDefault(require("react"));
|
|
4
|
-
|
|
5
|
-
var _enzyme = require("enzyme");
|
|
6
|
-
|
|
7
|
-
var _ = require(".");
|
|
8
|
-
|
|
9
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
10
|
-
|
|
11
|
-
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); }
|
|
12
|
-
|
|
13
|
-
var defaultProps = {
|
|
14
|
-
children: /*#__PURE__*/_react.default.createElement("p", null, "blah")
|
|
15
|
-
};
|
|
16
|
-
|
|
17
|
-
var renderShallow = function renderShallow() {
|
|
18
|
-
var props = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
19
|
-
return (0, _enzyme.shallow)( /*#__PURE__*/_react.default.createElement(_.Grid, _extends({}, defaultProps, props)));
|
|
20
|
-
};
|
|
21
|
-
|
|
22
|
-
describe('Grid', function () {
|
|
23
|
-
it('renders with default class and element', function () {
|
|
24
|
-
var el = renderShallow();
|
|
25
|
-
expect(el.prop('className')).toBe('ffe-grid');
|
|
26
|
-
expect(el.type()).toBe('div');
|
|
27
|
-
});
|
|
28
|
-
it('renders with custom class', function () {
|
|
29
|
-
var el = renderShallow({
|
|
30
|
-
className: 'custom-class'
|
|
31
|
-
});
|
|
32
|
-
expect(el.hasClass('custom-class')).toBe(true);
|
|
33
|
-
});
|
|
34
|
-
it('renders provided children node', function () {
|
|
35
|
-
var el = renderShallow();
|
|
36
|
-
expect(el.containsMatchingElement( /*#__PURE__*/_react.default.createElement("p", null, "blah"))).toBe(true);
|
|
37
|
-
});
|
|
38
|
-
it('defaults to not setting the "--no-top-padding" modifier', function () {
|
|
39
|
-
var el = renderShallow();
|
|
40
|
-
expect(el.hasClass('ffe-grid--no-top-padding')).toBe(false);
|
|
41
|
-
});
|
|
42
|
-
it('sets the "--no-top-padding" modifier if "topPadding" prop is false', function () {
|
|
43
|
-
var el = renderShallow({
|
|
44
|
-
topPadding: false
|
|
45
|
-
});
|
|
46
|
-
expect(el.hasClass('ffe-grid--no-top-padding')).toBe(true);
|
|
47
|
-
});
|
|
48
|
-
it('sets the condensed modifier', function () {
|
|
49
|
-
var el = renderShallow({
|
|
50
|
-
condensed: true
|
|
51
|
-
});
|
|
52
|
-
expect(el.hasClass('ffe-grid')).toBe(true);
|
|
53
|
-
expect(el.hasClass('ffe-grid--condensed')).toBe(true);
|
|
54
|
-
});
|
|
55
|
-
it('preserves other attributes that are passed to it', function () {
|
|
56
|
-
var handler = jest.fn();
|
|
57
|
-
var el = renderShallow({
|
|
58
|
-
onClick: handler
|
|
59
|
-
});
|
|
60
|
-
el.simulate('click');
|
|
61
|
-
expect(handler).toHaveBeenCalledTimes(1);
|
|
62
|
-
});
|
|
63
|
-
it('can render a custom root element', function () {
|
|
64
|
-
var el = renderShallow({
|
|
65
|
-
element: 'section'
|
|
66
|
-
});
|
|
67
|
-
expect(el.type()).toBe('section');
|
|
68
|
-
});
|
|
69
|
-
});
|
package/lib/GridCol.spec.js
DELETED
|
@@ -1,217 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var _react = _interopRequireDefault(require("react"));
|
|
4
|
-
|
|
5
|
-
var _enzyme = require("enzyme");
|
|
6
|
-
|
|
7
|
-
var _ = require(".");
|
|
8
|
-
|
|
9
|
-
var _backgroundColors = _interopRequireDefault(require("./background-colors"));
|
|
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 defaultProps = {
|
|
16
|
-
children: /*#__PURE__*/_react.default.createElement("p", null, "blah")
|
|
17
|
-
};
|
|
18
|
-
|
|
19
|
-
var renderShallow = function renderShallow() {
|
|
20
|
-
var props = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
21
|
-
return (0, _enzyme.shallow)( /*#__PURE__*/_react.default.createElement(_.GridCol, _extends({}, defaultProps, props)));
|
|
22
|
-
};
|
|
23
|
-
|
|
24
|
-
describe('GridCol', function () {
|
|
25
|
-
it('renders with custom class', function () {
|
|
26
|
-
var el = renderShallow({
|
|
27
|
-
className: 'custom-class'
|
|
28
|
-
});
|
|
29
|
-
expect(el.hasClass('custom-class')).toBe(true);
|
|
30
|
-
});
|
|
31
|
-
it('renders provided children node', function () {
|
|
32
|
-
var el = renderShallow();
|
|
33
|
-
expect(el.containsMatchingElement( /*#__PURE__*/_react.default.createElement("p", null, "blah"))).toBe(true);
|
|
34
|
-
});
|
|
35
|
-
it('supports setting cols as a number', function () {
|
|
36
|
-
var el = renderShallow({
|
|
37
|
-
lg: 10
|
|
38
|
-
});
|
|
39
|
-
expect(el.hasClass('ffe-grid__col--lg-10')).toBe(true);
|
|
40
|
-
});
|
|
41
|
-
it('supports setting cols as a string', function () {
|
|
42
|
-
var el = renderShallow({
|
|
43
|
-
sm: '1'
|
|
44
|
-
});
|
|
45
|
-
expect(el.hasClass('ffe-grid__col--sm-1')).toBe(true);
|
|
46
|
-
});
|
|
47
|
-
it('supports setting cols as an object', function () {
|
|
48
|
-
var el = renderShallow({
|
|
49
|
-
md: {
|
|
50
|
-
cols: 4
|
|
51
|
-
}
|
|
52
|
-
});
|
|
53
|
-
expect(el.hasClass('ffe-grid__col--md-4')).toBe(true);
|
|
54
|
-
});
|
|
55
|
-
it('supports setting cols and offset', function () {
|
|
56
|
-
var el = renderShallow({
|
|
57
|
-
sm: {
|
|
58
|
-
cols: 4,
|
|
59
|
-
offset: '2'
|
|
60
|
-
}
|
|
61
|
-
});
|
|
62
|
-
expect(el.hasClass('ffe-grid__col--sm-4')).toBe(true);
|
|
63
|
-
expect(el.hasClass('ffe-grid__col--sm-offset-2')).toBe(true);
|
|
64
|
-
});
|
|
65
|
-
it('does not set an offset class if no offset is provided', function () {
|
|
66
|
-
var el = renderShallow({
|
|
67
|
-
lg: {
|
|
68
|
-
cols: 7
|
|
69
|
-
}
|
|
70
|
-
});
|
|
71
|
-
expect(el.prop('className')).not.toContain('offset');
|
|
72
|
-
});
|
|
73
|
-
it('sets the center modifier if the value is boolean true', function () {
|
|
74
|
-
var el = renderShallow({
|
|
75
|
-
center: true
|
|
76
|
-
});
|
|
77
|
-
expect(el.hasClass('ffe-grid__col--center')).toBe(true);
|
|
78
|
-
});
|
|
79
|
-
it('sets the center modifier if the value is boolean true', function () {
|
|
80
|
-
var el = renderShallow({
|
|
81
|
-
centerText: true
|
|
82
|
-
});
|
|
83
|
-
expect(el.hasClass('ffe-grid__col--center-text')).toBe(true);
|
|
84
|
-
});
|
|
85
|
-
it('sets the center modifier as a string', function () {
|
|
86
|
-
var el = renderShallow({
|
|
87
|
-
center: 'true'
|
|
88
|
-
});
|
|
89
|
-
expect(el.hasClass('ffe-grid__col--center')).toBe(true);
|
|
90
|
-
});
|
|
91
|
-
it('sets the center modifier if the value is truthy', function () {
|
|
92
|
-
var el = renderShallow({
|
|
93
|
-
center: 'wombats'
|
|
94
|
-
});
|
|
95
|
-
expect(el.hasClass('ffe-grid__col--center')).toBe(true);
|
|
96
|
-
});
|
|
97
|
-
it('does not set the center modifier if the value is boolean false', function () {
|
|
98
|
-
var el = renderShallow({
|
|
99
|
-
center: false
|
|
100
|
-
});
|
|
101
|
-
expect(el.hasClass('ffe-grid__col--center')).not.toBe(true);
|
|
102
|
-
});
|
|
103
|
-
it('sets the top modifier', function () {
|
|
104
|
-
var el = renderShallow({
|
|
105
|
-
top: true
|
|
106
|
-
});
|
|
107
|
-
expect(el.hasClass('ffe-grid__col--top')).toBe(true);
|
|
108
|
-
});
|
|
109
|
-
it('sets background color class if valid', function () {
|
|
110
|
-
_backgroundColors.default.forEach(function (background) {
|
|
111
|
-
var el = renderShallow({
|
|
112
|
-
background: background
|
|
113
|
-
});
|
|
114
|
-
expect(el.hasClass("ffe-grid__col--bg-".concat(background))).toBe(true);
|
|
115
|
-
});
|
|
116
|
-
});
|
|
117
|
-
it('does not set background color class if not valid', function () {
|
|
118
|
-
var illegalBackgroundColors = ['ice-cream', 'log("hack")', '123456'];
|
|
119
|
-
illegalBackgroundColors.forEach(function (background) {
|
|
120
|
-
var el = renderShallow({
|
|
121
|
-
background: background
|
|
122
|
-
});
|
|
123
|
-
expect(el.hasClass("ffe-grid__col--bg-".concat(background))).toBe(false);
|
|
124
|
-
});
|
|
125
|
-
});
|
|
126
|
-
it('throws for removed background colours', function () {
|
|
127
|
-
expect(function () {
|
|
128
|
-
return renderShallow({
|
|
129
|
-
background: 'blue-cobalt'
|
|
130
|
-
});
|
|
131
|
-
}).toThrow('Support for the blue-cobalt background on <GridCol> has been removed, please see the CHANGELOG');
|
|
132
|
-
});
|
|
133
|
-
it('sets all the things o/', function () {
|
|
134
|
-
var el = renderShallow({
|
|
135
|
-
sm: {
|
|
136
|
-
cols: '6',
|
|
137
|
-
offset: 2
|
|
138
|
-
},
|
|
139
|
-
md: 8,
|
|
140
|
-
lg: {
|
|
141
|
-
cols: 2
|
|
142
|
-
},
|
|
143
|
-
center: true,
|
|
144
|
-
centerText: true,
|
|
145
|
-
bottom: true,
|
|
146
|
-
between: true,
|
|
147
|
-
horizontal: true,
|
|
148
|
-
reverse: true
|
|
149
|
-
});
|
|
150
|
-
expect(el.hasClass('ffe-grid__col--sm-6')).toBe(true);
|
|
151
|
-
expect(el.hasClass('ffe-grid__col--sm-offset-2')).toBe(true);
|
|
152
|
-
expect(el.hasClass('ffe-grid__col--md-8')).toBe(true);
|
|
153
|
-
expect(el.hasClass('ffe-grid__col--lg-2')).toBe(true);
|
|
154
|
-
expect(el.hasClass('ffe-grid__col--center')).toBe(true);
|
|
155
|
-
expect(el.hasClass('ffe-grid__col--center-text')).toBe(true);
|
|
156
|
-
expect(el.hasClass('ffe-grid__col--bottom')).toBe(true);
|
|
157
|
-
expect(el.hasClass('ffe-grid__col--between')).toBe(true);
|
|
158
|
-
expect(el.hasClass('ffe-grid__col--horizontal')).toBe(true);
|
|
159
|
-
expect(el.hasClass('ffe-grid__col--reverse')).toBe(true);
|
|
160
|
-
});
|
|
161
|
-
it('preserves other attributes that are passed to it', function () {
|
|
162
|
-
var handler = jest.fn();
|
|
163
|
-
var el = renderShallow({
|
|
164
|
-
onClick: handler
|
|
165
|
-
});
|
|
166
|
-
el.simulate('click');
|
|
167
|
-
expect(handler).toHaveBeenCalledTimes(1);
|
|
168
|
-
});
|
|
169
|
-
it('can render a custom root element', function () {
|
|
170
|
-
var el = renderShallow({
|
|
171
|
-
element: 'section'
|
|
172
|
-
});
|
|
173
|
-
expect(el.type()).toBe('section');
|
|
174
|
-
});
|
|
175
|
-
it('does not pass on known properties to its root element', function () {
|
|
176
|
-
var el = renderShallow({
|
|
177
|
-
center: true,
|
|
178
|
-
reverse: true
|
|
179
|
-
});
|
|
180
|
-
expect(el.props().center).toBe(undefined);
|
|
181
|
-
expect(el.props().reverse).toBe(undefined);
|
|
182
|
-
});
|
|
183
|
-
it('can render with offset 0 and columns 0', function () {
|
|
184
|
-
var el = renderShallow({
|
|
185
|
-
md: {
|
|
186
|
-
cols: 0,
|
|
187
|
-
offset: 0
|
|
188
|
-
}
|
|
189
|
-
});
|
|
190
|
-
expect(el.hasClass('ffe-grid__col--md-offset-0')).toBe(true);
|
|
191
|
-
expect(el.hasClass('ffe-grid__col--md-0')).toBe(true);
|
|
192
|
-
});
|
|
193
|
-
it('can render with offset 1 and columns 1', function () {
|
|
194
|
-
var el = renderShallow({
|
|
195
|
-
md: {
|
|
196
|
-
cols: 1,
|
|
197
|
-
offset: 1
|
|
198
|
-
}
|
|
199
|
-
});
|
|
200
|
-
expect(el.hasClass('ffe-grid__col--md-offset-1')).toBe(true);
|
|
201
|
-
expect(el.hasClass('ffe-grid__col--md-1')).toBe(true);
|
|
202
|
-
});
|
|
203
|
-
it('defaults to sm={12} if no dimensions are provided', function () {
|
|
204
|
-
var el = renderShallow();
|
|
205
|
-
expect(el.hasClass('ffe-grid__col--sm-12')).toBe(true);
|
|
206
|
-
});
|
|
207
|
-
it('defaults to not setting the "--no-bottom-padding" modifier', function () {
|
|
208
|
-
var el = renderShallow();
|
|
209
|
-
expect(el.hasClass('ffe-grid__col--no-bottom-padding')).toBe(false);
|
|
210
|
-
});
|
|
211
|
-
it('sets the "--no-bottom-padding" modifier if "bottomPadding" prop is false', function () {
|
|
212
|
-
var el = renderShallow({
|
|
213
|
-
bottomPadding: false
|
|
214
|
-
});
|
|
215
|
-
expect(el.hasClass('ffe-grid__col--no-bottom-padding')).toBe(true);
|
|
216
|
-
});
|
|
217
|
-
});
|
package/lib/GridRow.spec.js
DELETED
|
@@ -1,106 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var _react = _interopRequireDefault(require("react"));
|
|
4
|
-
|
|
5
|
-
var _enzyme = require("enzyme");
|
|
6
|
-
|
|
7
|
-
var _ = require(".");
|
|
8
|
-
|
|
9
|
-
var _backgroundColors = _interopRequireDefault(require("./background-colors"));
|
|
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 defaultProps = {
|
|
16
|
-
children: /*#__PURE__*/_react.default.createElement("p", null, "blah")
|
|
17
|
-
};
|
|
18
|
-
|
|
19
|
-
var renderShallow = function renderShallow() {
|
|
20
|
-
var props = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
21
|
-
return (0, _enzyme.shallow)( /*#__PURE__*/_react.default.createElement(_.GridRow, _extends({}, defaultProps, props)));
|
|
22
|
-
};
|
|
23
|
-
|
|
24
|
-
describe('GridRow', function () {
|
|
25
|
-
it('renders with default class and element', function () {
|
|
26
|
-
var el = renderShallow();
|
|
27
|
-
expect(el.prop('className')).toBe('ffe-grid__row');
|
|
28
|
-
expect(el.type()).toBe('div');
|
|
29
|
-
});
|
|
30
|
-
it('renders with custom class', function () {
|
|
31
|
-
var el = renderShallow({
|
|
32
|
-
className: 'custom-class'
|
|
33
|
-
});
|
|
34
|
-
expect(el.hasClass('custom-class')).toBe(true);
|
|
35
|
-
});
|
|
36
|
-
it('renders provided children node', function () {
|
|
37
|
-
var el = renderShallow();
|
|
38
|
-
expect(el.containsMatchingElement( /*#__PURE__*/_react.default.createElement("p", null, "blah"))).toBe(true);
|
|
39
|
-
});
|
|
40
|
-
it('sets the reverse modifier', function () {
|
|
41
|
-
var el = renderShallow({
|
|
42
|
-
reverse: true
|
|
43
|
-
});
|
|
44
|
-
expect(el.hasClass('ffe-grid__row')).toBe(true);
|
|
45
|
-
expect(el.hasClass('ffe-grid__row--reverse')).toBe(true);
|
|
46
|
-
});
|
|
47
|
-
it('adds correct class for all valid background colors', function () {
|
|
48
|
-
var el = renderShallow();
|
|
49
|
-
|
|
50
|
-
_backgroundColors.default.forEach(function (background) {
|
|
51
|
-
el.setProps({
|
|
52
|
-
background: background
|
|
53
|
-
});
|
|
54
|
-
expect(el.hasClass("ffe-grid__row--bg-".concat(background))).toBe(true);
|
|
55
|
-
});
|
|
56
|
-
});
|
|
57
|
-
it('does not add any background-class for invalid background colors', function () {
|
|
58
|
-
var el = renderShallow();
|
|
59
|
-
console.error = jest.fn();
|
|
60
|
-
['illegal', 'color values', 'are ignored'].forEach(function (background) {
|
|
61
|
-
el.setProps({
|
|
62
|
-
background: background
|
|
63
|
-
});
|
|
64
|
-
expect(el.hasClass("ffe-grid__row--bg-".concat(background))).toBe(false);
|
|
65
|
-
});
|
|
66
|
-
});
|
|
67
|
-
it('throws for removed background colours', function () {
|
|
68
|
-
expect(function () {
|
|
69
|
-
return renderShallow({
|
|
70
|
-
background: 'blue-cobalt'
|
|
71
|
-
});
|
|
72
|
-
}).toThrow('Support for the blue-cobalt background on <GridRow> has been removed, please see the CHANGELOG');
|
|
73
|
-
});
|
|
74
|
-
it('renders coloured rows with extra wrappers', function () {
|
|
75
|
-
_backgroundColors.default.forEach(function (background) {
|
|
76
|
-
var el = renderShallow({
|
|
77
|
-
background: background,
|
|
78
|
-
children: /*#__PURE__*/_react.default.createElement(_.GridCol, {
|
|
79
|
-
lg: 12
|
|
80
|
-
}, /*#__PURE__*/_react.default.createElement("p", null, "blah"))
|
|
81
|
-
});
|
|
82
|
-
expect(el.childAt(0).hasClass('ffe-grid__row-wrapper')).toBe(true);
|
|
83
|
-
});
|
|
84
|
-
});
|
|
85
|
-
it('sets the topPadding modifier', function () {
|
|
86
|
-
var el = renderShallow({
|
|
87
|
-
topPadding: true
|
|
88
|
-
});
|
|
89
|
-
expect(el.hasClass('ffe-grid__row')).toBe(true);
|
|
90
|
-
expect(el.hasClass('ffe-grid__row--top-padding')).toBe(true);
|
|
91
|
-
});
|
|
92
|
-
it('preserves other attributes that are passed to it', function () {
|
|
93
|
-
var handler = jest.fn();
|
|
94
|
-
var el = renderShallow({
|
|
95
|
-
onClick: handler
|
|
96
|
-
});
|
|
97
|
-
el.simulate('click');
|
|
98
|
-
expect(handler).toHaveBeenCalledTimes(1);
|
|
99
|
-
});
|
|
100
|
-
it('can render a custom root element', function () {
|
|
101
|
-
var el = renderShallow({
|
|
102
|
-
element: 'section'
|
|
103
|
-
});
|
|
104
|
-
expect(el.type()).toBe('section');
|
|
105
|
-
});
|
|
106
|
-
});
|
package/lib/InlineGrid.spec.js
DELETED
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var _react = _interopRequireDefault(require("react"));
|
|
4
|
-
|
|
5
|
-
var _enzyme = require("enzyme");
|
|
6
|
-
|
|
7
|
-
var _ = require(".");
|
|
8
|
-
|
|
9
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
10
|
-
|
|
11
|
-
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); }
|
|
12
|
-
|
|
13
|
-
var defaultProps = {
|
|
14
|
-
children: /*#__PURE__*/_react.default.createElement("p", null, "blah")
|
|
15
|
-
};
|
|
16
|
-
|
|
17
|
-
var renderShallow = function renderShallow() {
|
|
18
|
-
var props = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
19
|
-
return (0, _enzyme.shallow)( /*#__PURE__*/_react.default.createElement(_.InlineGrid, _extends({}, defaultProps, props)));
|
|
20
|
-
};
|
|
21
|
-
|
|
22
|
-
describe('InlineGrid', function () {
|
|
23
|
-
it('renders with default class and element', function () {
|
|
24
|
-
var el = renderShallow();
|
|
25
|
-
expect(el.hasClass('ffe-grid--inline')).toBe(true);
|
|
26
|
-
expect(el.type()).toBe('div');
|
|
27
|
-
});
|
|
28
|
-
it('renders with custom class', function () {
|
|
29
|
-
var el = renderShallow({
|
|
30
|
-
className: 'custom-class'
|
|
31
|
-
});
|
|
32
|
-
expect(el.hasClass('custom-class')).toBe(true);
|
|
33
|
-
});
|
|
34
|
-
it('renders provided children node', function () {
|
|
35
|
-
var el = renderShallow();
|
|
36
|
-
expect(el.containsMatchingElement( /*#__PURE__*/_react.default.createElement("p", null, "blah"))).toBe(true);
|
|
37
|
-
});
|
|
38
|
-
it('preserves other attributes that are passed to it', function () {
|
|
39
|
-
var handler = jest.fn();
|
|
40
|
-
var el = renderShallow({
|
|
41
|
-
onClick: handler
|
|
42
|
-
});
|
|
43
|
-
el.simulate('click');
|
|
44
|
-
expect(handler).toHaveBeenCalledTimes(1);
|
|
45
|
-
});
|
|
46
|
-
it('can render a custom root element', function () {
|
|
47
|
-
var el = renderShallow({
|
|
48
|
-
element: 'section'
|
|
49
|
-
});
|
|
50
|
-
expect(el.type()).toBe('section');
|
|
51
|
-
});
|
|
52
|
-
});
|