@sb1/ffe-grid-react 10.1.5 → 11.1.2
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/Grid.js +3 -1
- package/es/GridCol.js +8 -6
- package/es/GridRow.js +4 -2
- package/es/InlineGrid.js +3 -1
- package/es/background-colors.js +2 -2
- package/lib/Grid.js +3 -1
- package/lib/GridCol.js +10 -8
- package/lib/GridRow.js +7 -5
- package/lib/InlineGrid.js +3 -1
- package/lib/background-colors.js +2 -2
- package/lib/index.js +4 -4
- package/package.json +6 -8
- package/types/index.d.ts +7 -9
- package/CHANGELOG.md +0 -534
- 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/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
|
-
});
|