@reltio/components 1.4.1909 → 1.4.1911
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/cjs/ProfileBand/ProfileBand.js +1 -1
- package/cjs/ProfileResizablePanes/ProfileResizablePanes.spec.js +113 -68
- package/cjs/ResizablePanes/ResizablePanes.d.ts +3 -2
- package/cjs/ResizablePanes/ResizablePanes.js +83 -16
- package/cjs/ResizablePanes/ResizablePanes.test.js +289 -0
- package/cjs/ResizablePanes/styles.d.ts +1 -1
- package/cjs/ResizablePanes/styles.js +47 -38
- package/cjs/SimpleMatchRulesBlock/SimpleMatchRulesBlock.js +1 -1
- package/cjs/SimpleMatchRulesBlock/SimpleMatchRulesBlock.test.js +1 -1
- package/cjs/index.d.ts +1 -1
- package/cjs/index.js +2 -1
- package/cjs/test-utils/index.d.ts +1 -0
- package/cjs/test-utils/index.js +15 -1
- package/esm/ProfileBand/ProfileBand.js +1 -1
- package/esm/ProfileResizablePanes/ProfileResizablePanes.spec.js +113 -68
- package/esm/ResizablePanes/ResizablePanes.d.ts +3 -2
- package/esm/ResizablePanes/ResizablePanes.js +84 -17
- package/esm/ResizablePanes/ResizablePanes.test.js +284 -0
- package/esm/ResizablePanes/styles.d.ts +1 -1
- package/esm/ResizablePanes/styles.js +47 -38
- package/esm/SimpleMatchRulesBlock/SimpleMatchRulesBlock.js +1 -1
- package/esm/SimpleMatchRulesBlock/SimpleMatchRulesBlock.test.js +1 -1
- package/esm/index.d.ts +1 -1
- package/esm/index.js +1 -1
- package/esm/test-utils/index.d.ts +1 -0
- package/esm/test-utils/index.js +13 -0
- package/package.json +3 -3
- package/cjs/ResizablePanes/ResizablePanes.spec.js +0 -192
- package/esm/ResizablePanes/ResizablePanes.spec.js +0 -164
- /package/cjs/ResizablePanes/{ResizablePanes.spec.d.ts → ResizablePanes.test.d.ts} +0 -0
- /package/esm/ResizablePanes/{ResizablePanes.spec.d.ts → ResizablePanes.test.d.ts} +0 -0
|
@@ -1,192 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __assign = (this && this.__assign) || function () {
|
|
3
|
-
__assign = Object.assign || function(t) {
|
|
4
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
5
|
-
s = arguments[i];
|
|
6
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
7
|
-
t[p] = s[p];
|
|
8
|
-
}
|
|
9
|
-
return t;
|
|
10
|
-
};
|
|
11
|
-
return __assign.apply(this, arguments);
|
|
12
|
-
};
|
|
13
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
14
|
-
if (k2 === undefined) k2 = k;
|
|
15
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
16
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
17
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
18
|
-
}
|
|
19
|
-
Object.defineProperty(o, k2, desc);
|
|
20
|
-
}) : (function(o, m, k, k2) {
|
|
21
|
-
if (k2 === undefined) k2 = k;
|
|
22
|
-
o[k2] = m[k];
|
|
23
|
-
}));
|
|
24
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
25
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
26
|
-
}) : function(o, v) {
|
|
27
|
-
o["default"] = v;
|
|
28
|
-
});
|
|
29
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
30
|
-
if (mod && mod.__esModule) return mod;
|
|
31
|
-
var result = {};
|
|
32
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
33
|
-
__setModuleDefault(result, mod);
|
|
34
|
-
return result;
|
|
35
|
-
};
|
|
36
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
37
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
38
|
-
};
|
|
39
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
40
|
-
var react_1 = __importDefault(require("react"));
|
|
41
|
-
var enzyme_1 = require("enzyme");
|
|
42
|
-
var react_split_pane_1 = __importDefault(require("react-split-pane"));
|
|
43
|
-
var mdmSdk = __importStar(require("@reltio/mdm-sdk"));
|
|
44
|
-
var ResizablePanes_1 = require("./ResizablePanes");
|
|
45
|
-
jest.mock('@reltio/mdm-sdk');
|
|
46
|
-
var PANE_ANIMATION_STYLE = { transition: 'height 195ms cubic-bezier(0.4, 0, 0.6, 1) 0ms' };
|
|
47
|
-
describe('ResizablePanes tests', function () {
|
|
48
|
-
var defaultProps = {
|
|
49
|
-
orientation: 'horizontal',
|
|
50
|
-
size: '50%',
|
|
51
|
-
allowResize: true,
|
|
52
|
-
defaultSize: '45%',
|
|
53
|
-
minSize: 40,
|
|
54
|
-
maxSize: 400
|
|
55
|
-
};
|
|
56
|
-
it('should render main parts', function () {
|
|
57
|
-
var props = __assign({}, defaultProps);
|
|
58
|
-
var component = (0, enzyme_1.shallow)(react_1.default.createElement(ResizablePanes_1.ResizablePanes, __assign({}, props),
|
|
59
|
-
react_1.default.createElement("div", null),
|
|
60
|
-
react_1.default.createElement("div", null)));
|
|
61
|
-
var splitPane = component.find(react_split_pane_1.default);
|
|
62
|
-
expect(splitPane.length).toBe(1);
|
|
63
|
-
expect(splitPane.prop('split')).toBe(props.orientation);
|
|
64
|
-
expect(splitPane.prop('size')).toBe(props.size);
|
|
65
|
-
expect(splitPane.prop('allowResize')).toBe(props.allowResize);
|
|
66
|
-
expect(splitPane.prop('defaultSize')).toBe(props.defaultSize);
|
|
67
|
-
expect(splitPane.prop('minSize')).toBe(props.minSize);
|
|
68
|
-
expect(splitPane.prop('maxSize')).toBe(props.maxSize);
|
|
69
|
-
});
|
|
70
|
-
it('should enable pane animations by default', function () {
|
|
71
|
-
var props = __assign({}, defaultProps);
|
|
72
|
-
var component = (0, enzyme_1.shallow)(react_1.default.createElement(ResizablePanes_1.ResizablePanes, __assign({}, props),
|
|
73
|
-
react_1.default.createElement("div", null),
|
|
74
|
-
react_1.default.createElement("div", null)));
|
|
75
|
-
var splitPane = component.find(react_split_pane_1.default);
|
|
76
|
-
expect(splitPane.length).toBe(1);
|
|
77
|
-
expect(splitPane.prop('pane1Style')).toEqual(PANE_ANIMATION_STYLE);
|
|
78
|
-
});
|
|
79
|
-
it('should disable pane animations onDragStarted', function () {
|
|
80
|
-
var props = __assign({}, defaultProps);
|
|
81
|
-
var component = (0, enzyme_1.shallow)(react_1.default.createElement(ResizablePanes_1.ResizablePanes, __assign({}, props),
|
|
82
|
-
react_1.default.createElement("div", null),
|
|
83
|
-
react_1.default.createElement("div", null)));
|
|
84
|
-
component.find(react_split_pane_1.default).prop('onDragStarted')();
|
|
85
|
-
expect(component.find(react_split_pane_1.default).prop('pane1Style')).toBeUndefined();
|
|
86
|
-
});
|
|
87
|
-
it('should enable pane animations onDragFinished', function () {
|
|
88
|
-
var props = __assign({}, defaultProps);
|
|
89
|
-
var component = (0, enzyme_1.shallow)(react_1.default.createElement(ResizablePanes_1.ResizablePanes, __assign({}, props),
|
|
90
|
-
react_1.default.createElement("div", null),
|
|
91
|
-
react_1.default.createElement("div", null)));
|
|
92
|
-
component.find(react_split_pane_1.default).prop('onDragStarted')();
|
|
93
|
-
expect(component.find(react_split_pane_1.default).prop('pane1Style')).toBeUndefined();
|
|
94
|
-
component.find(react_split_pane_1.default).prop('onDragFinished')();
|
|
95
|
-
expect(component.find(react_split_pane_1.default).prop('pane1Style')).toEqual(PANE_ANIMATION_STYLE);
|
|
96
|
-
});
|
|
97
|
-
it('should call onChange prop with debounce on SplitPane onChange', function () {
|
|
98
|
-
var props = __assign(__assign({}, defaultProps), { onChange: jest.fn() });
|
|
99
|
-
var debounceSpy = jest.spyOn(mdmSdk, 'debounce').mockImplementation(function (func) { return func; });
|
|
100
|
-
var component = (0, enzyme_1.mount)(react_1.default.createElement(ResizablePanes_1.ResizablePanes, __assign({}, props),
|
|
101
|
-
react_1.default.createElement("div", null),
|
|
102
|
-
react_1.default.createElement("div", null)));
|
|
103
|
-
var containerEl = component.find('.container').getDOMNode();
|
|
104
|
-
jest.spyOn(containerEl, 'clientHeight', 'get').mockReturnValue(1000);
|
|
105
|
-
component.find(react_split_pane_1.default).prop('onChange')(100);
|
|
106
|
-
expect(debounceSpy).toHaveBeenCalled();
|
|
107
|
-
expect(props.onChange).toHaveBeenCalledWith({
|
|
108
|
-
isMaxSize: false,
|
|
109
|
-
isMinSize: false,
|
|
110
|
-
percentageSize: '10%',
|
|
111
|
-
size: 100
|
|
112
|
-
});
|
|
113
|
-
});
|
|
114
|
-
it('should call onChange prop with correct isMaxSize for positive props.maxSize', function () {
|
|
115
|
-
var props = __assign(__assign({}, defaultProps), { maxSize: 500, onChange: jest.fn() });
|
|
116
|
-
var debounceSpy = jest.spyOn(mdmSdk, 'debounce').mockImplementation(function (func) { return func; });
|
|
117
|
-
var component = (0, enzyme_1.mount)(react_1.default.createElement(ResizablePanes_1.ResizablePanes, __assign({}, props),
|
|
118
|
-
react_1.default.createElement("div", null),
|
|
119
|
-
react_1.default.createElement("div", null)));
|
|
120
|
-
var containerEl = component.find('.container').getDOMNode();
|
|
121
|
-
jest.spyOn(containerEl, 'clientHeight', 'get').mockReturnValue(1000);
|
|
122
|
-
component.find(react_split_pane_1.default).prop('onChange')(props.maxSize);
|
|
123
|
-
expect(debounceSpy).toHaveBeenCalled();
|
|
124
|
-
expect(props.onChange).toHaveBeenCalledWith({
|
|
125
|
-
isMaxSize: true,
|
|
126
|
-
isMinSize: false,
|
|
127
|
-
percentageSize: '50%',
|
|
128
|
-
size: 500
|
|
129
|
-
});
|
|
130
|
-
});
|
|
131
|
-
it('should call onChange prop with correct isMaxSize for negative props.maxSize', function () {
|
|
132
|
-
var props = __assign(__assign({}, defaultProps), { maxSize: -200, onChange: jest.fn() });
|
|
133
|
-
var debounceSpy = jest.spyOn(mdmSdk, 'debounce').mockImplementation(function (func) { return func; });
|
|
134
|
-
var component = (0, enzyme_1.mount)(react_1.default.createElement(ResizablePanes_1.ResizablePanes, __assign({}, props),
|
|
135
|
-
react_1.default.createElement("div", null),
|
|
136
|
-
react_1.default.createElement("div", null)));
|
|
137
|
-
var containerEl = component.find('.container').getDOMNode();
|
|
138
|
-
jest.spyOn(containerEl, 'clientHeight', 'get').mockReturnValue(1000);
|
|
139
|
-
component.find(react_split_pane_1.default).prop('onChange')(800);
|
|
140
|
-
expect(debounceSpy).toHaveBeenCalled();
|
|
141
|
-
expect(props.onChange).toHaveBeenCalledWith({
|
|
142
|
-
isMaxSize: true,
|
|
143
|
-
isMinSize: false,
|
|
144
|
-
percentageSize: '80%',
|
|
145
|
-
size: 800
|
|
146
|
-
});
|
|
147
|
-
});
|
|
148
|
-
it('should call onChange prop with correct isMaxSize for "0" props.maxSize', function () {
|
|
149
|
-
var props = __assign(__assign({}, defaultProps), { maxSize: 0, onChange: jest.fn() });
|
|
150
|
-
var debounceSpy = jest.spyOn(mdmSdk, 'debounce').mockImplementation(function (func) { return func; });
|
|
151
|
-
var component = (0, enzyme_1.mount)(react_1.default.createElement(ResizablePanes_1.ResizablePanes, __assign({}, props),
|
|
152
|
-
react_1.default.createElement("div", null),
|
|
153
|
-
react_1.default.createElement("div", null)));
|
|
154
|
-
var containerEl = component.find('.container').getDOMNode();
|
|
155
|
-
jest.spyOn(containerEl, 'clientHeight', 'get').mockReturnValue(1000);
|
|
156
|
-
component.find(react_split_pane_1.default).prop('onChange')(1000);
|
|
157
|
-
expect(debounceSpy).toHaveBeenCalled();
|
|
158
|
-
expect(props.onChange).toHaveBeenCalledWith({
|
|
159
|
-
isMaxSize: true,
|
|
160
|
-
isMinSize: false,
|
|
161
|
-
percentageSize: '100%',
|
|
162
|
-
size: 1000
|
|
163
|
-
});
|
|
164
|
-
});
|
|
165
|
-
it('should call onChange prop with correct isMinSize for positive props.minSize', function () {
|
|
166
|
-
var props = __assign(__assign({}, defaultProps), { minSize: 60, onChange: jest.fn() });
|
|
167
|
-
var debounceSpy = jest.spyOn(mdmSdk, 'debounce').mockImplementation(function (func) { return func; });
|
|
168
|
-
var component = (0, enzyme_1.mount)(react_1.default.createElement(ResizablePanes_1.ResizablePanes, __assign({}, props),
|
|
169
|
-
react_1.default.createElement("div", null),
|
|
170
|
-
react_1.default.createElement("div", null)));
|
|
171
|
-
var containerEl = component.find('.container').getDOMNode();
|
|
172
|
-
jest.spyOn(containerEl, 'clientHeight', 'get').mockReturnValue(1000);
|
|
173
|
-
component.find(react_split_pane_1.default).prop('onChange')(props.minSize);
|
|
174
|
-
expect(debounceSpy).toHaveBeenCalled();
|
|
175
|
-
expect(props.onChange).toHaveBeenCalledWith({
|
|
176
|
-
isMaxSize: false,
|
|
177
|
-
isMinSize: true,
|
|
178
|
-
percentageSize: '6%',
|
|
179
|
-
size: 60
|
|
180
|
-
});
|
|
181
|
-
});
|
|
182
|
-
it('should apply negative size correctly', function () {
|
|
183
|
-
var props = __assign(__assign({}, defaultProps), { size: -40 });
|
|
184
|
-
var component = (0, enzyme_1.mount)(react_1.default.createElement(ResizablePanes_1.ResizablePanes, __assign({}, props),
|
|
185
|
-
react_1.default.createElement("div", null),
|
|
186
|
-
react_1.default.createElement("div", null)));
|
|
187
|
-
var containerEl = component.find('.container').getDOMNode();
|
|
188
|
-
jest.spyOn(containerEl, 'clientHeight', 'get').mockReturnValue(1000);
|
|
189
|
-
component.setProps(__assign({}, props));
|
|
190
|
-
expect(component.find(react_split_pane_1.default).prop('size')).toBe(1000 - 40);
|
|
191
|
-
});
|
|
192
|
-
});
|
|
@@ -1,164 +0,0 @@
|
|
|
1
|
-
var __assign = (this && this.__assign) || function () {
|
|
2
|
-
__assign = Object.assign || function(t) {
|
|
3
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
4
|
-
s = arguments[i];
|
|
5
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
6
|
-
t[p] = s[p];
|
|
7
|
-
}
|
|
8
|
-
return t;
|
|
9
|
-
};
|
|
10
|
-
return __assign.apply(this, arguments);
|
|
11
|
-
};
|
|
12
|
-
import React from 'react';
|
|
13
|
-
import { mount, shallow } from 'enzyme';
|
|
14
|
-
import SplitPane from 'react-split-pane';
|
|
15
|
-
import * as mdmSdk from '@reltio/mdm-sdk';
|
|
16
|
-
import { ResizablePanes } from './ResizablePanes';
|
|
17
|
-
jest.mock('@reltio/mdm-sdk');
|
|
18
|
-
var PANE_ANIMATION_STYLE = { transition: 'height 195ms cubic-bezier(0.4, 0, 0.6, 1) 0ms' };
|
|
19
|
-
describe('ResizablePanes tests', function () {
|
|
20
|
-
var defaultProps = {
|
|
21
|
-
orientation: 'horizontal',
|
|
22
|
-
size: '50%',
|
|
23
|
-
allowResize: true,
|
|
24
|
-
defaultSize: '45%',
|
|
25
|
-
minSize: 40,
|
|
26
|
-
maxSize: 400
|
|
27
|
-
};
|
|
28
|
-
it('should render main parts', function () {
|
|
29
|
-
var props = __assign({}, defaultProps);
|
|
30
|
-
var component = shallow(React.createElement(ResizablePanes, __assign({}, props),
|
|
31
|
-
React.createElement("div", null),
|
|
32
|
-
React.createElement("div", null)));
|
|
33
|
-
var splitPane = component.find(SplitPane);
|
|
34
|
-
expect(splitPane.length).toBe(1);
|
|
35
|
-
expect(splitPane.prop('split')).toBe(props.orientation);
|
|
36
|
-
expect(splitPane.prop('size')).toBe(props.size);
|
|
37
|
-
expect(splitPane.prop('allowResize')).toBe(props.allowResize);
|
|
38
|
-
expect(splitPane.prop('defaultSize')).toBe(props.defaultSize);
|
|
39
|
-
expect(splitPane.prop('minSize')).toBe(props.minSize);
|
|
40
|
-
expect(splitPane.prop('maxSize')).toBe(props.maxSize);
|
|
41
|
-
});
|
|
42
|
-
it('should enable pane animations by default', function () {
|
|
43
|
-
var props = __assign({}, defaultProps);
|
|
44
|
-
var component = shallow(React.createElement(ResizablePanes, __assign({}, props),
|
|
45
|
-
React.createElement("div", null),
|
|
46
|
-
React.createElement("div", null)));
|
|
47
|
-
var splitPane = component.find(SplitPane);
|
|
48
|
-
expect(splitPane.length).toBe(1);
|
|
49
|
-
expect(splitPane.prop('pane1Style')).toEqual(PANE_ANIMATION_STYLE);
|
|
50
|
-
});
|
|
51
|
-
it('should disable pane animations onDragStarted', function () {
|
|
52
|
-
var props = __assign({}, defaultProps);
|
|
53
|
-
var component = shallow(React.createElement(ResizablePanes, __assign({}, props),
|
|
54
|
-
React.createElement("div", null),
|
|
55
|
-
React.createElement("div", null)));
|
|
56
|
-
component.find(SplitPane).prop('onDragStarted')();
|
|
57
|
-
expect(component.find(SplitPane).prop('pane1Style')).toBeUndefined();
|
|
58
|
-
});
|
|
59
|
-
it('should enable pane animations onDragFinished', function () {
|
|
60
|
-
var props = __assign({}, defaultProps);
|
|
61
|
-
var component = shallow(React.createElement(ResizablePanes, __assign({}, props),
|
|
62
|
-
React.createElement("div", null),
|
|
63
|
-
React.createElement("div", null)));
|
|
64
|
-
component.find(SplitPane).prop('onDragStarted')();
|
|
65
|
-
expect(component.find(SplitPane).prop('pane1Style')).toBeUndefined();
|
|
66
|
-
component.find(SplitPane).prop('onDragFinished')();
|
|
67
|
-
expect(component.find(SplitPane).prop('pane1Style')).toEqual(PANE_ANIMATION_STYLE);
|
|
68
|
-
});
|
|
69
|
-
it('should call onChange prop with debounce on SplitPane onChange', function () {
|
|
70
|
-
var props = __assign(__assign({}, defaultProps), { onChange: jest.fn() });
|
|
71
|
-
var debounceSpy = jest.spyOn(mdmSdk, 'debounce').mockImplementation(function (func) { return func; });
|
|
72
|
-
var component = mount(React.createElement(ResizablePanes, __assign({}, props),
|
|
73
|
-
React.createElement("div", null),
|
|
74
|
-
React.createElement("div", null)));
|
|
75
|
-
var containerEl = component.find('.container').getDOMNode();
|
|
76
|
-
jest.spyOn(containerEl, 'clientHeight', 'get').mockReturnValue(1000);
|
|
77
|
-
component.find(SplitPane).prop('onChange')(100);
|
|
78
|
-
expect(debounceSpy).toHaveBeenCalled();
|
|
79
|
-
expect(props.onChange).toHaveBeenCalledWith({
|
|
80
|
-
isMaxSize: false,
|
|
81
|
-
isMinSize: false,
|
|
82
|
-
percentageSize: '10%',
|
|
83
|
-
size: 100
|
|
84
|
-
});
|
|
85
|
-
});
|
|
86
|
-
it('should call onChange prop with correct isMaxSize for positive props.maxSize', function () {
|
|
87
|
-
var props = __assign(__assign({}, defaultProps), { maxSize: 500, onChange: jest.fn() });
|
|
88
|
-
var debounceSpy = jest.spyOn(mdmSdk, 'debounce').mockImplementation(function (func) { return func; });
|
|
89
|
-
var component = mount(React.createElement(ResizablePanes, __assign({}, props),
|
|
90
|
-
React.createElement("div", null),
|
|
91
|
-
React.createElement("div", null)));
|
|
92
|
-
var containerEl = component.find('.container').getDOMNode();
|
|
93
|
-
jest.spyOn(containerEl, 'clientHeight', 'get').mockReturnValue(1000);
|
|
94
|
-
component.find(SplitPane).prop('onChange')(props.maxSize);
|
|
95
|
-
expect(debounceSpy).toHaveBeenCalled();
|
|
96
|
-
expect(props.onChange).toHaveBeenCalledWith({
|
|
97
|
-
isMaxSize: true,
|
|
98
|
-
isMinSize: false,
|
|
99
|
-
percentageSize: '50%',
|
|
100
|
-
size: 500
|
|
101
|
-
});
|
|
102
|
-
});
|
|
103
|
-
it('should call onChange prop with correct isMaxSize for negative props.maxSize', function () {
|
|
104
|
-
var props = __assign(__assign({}, defaultProps), { maxSize: -200, onChange: jest.fn() });
|
|
105
|
-
var debounceSpy = jest.spyOn(mdmSdk, 'debounce').mockImplementation(function (func) { return func; });
|
|
106
|
-
var component = mount(React.createElement(ResizablePanes, __assign({}, props),
|
|
107
|
-
React.createElement("div", null),
|
|
108
|
-
React.createElement("div", null)));
|
|
109
|
-
var containerEl = component.find('.container').getDOMNode();
|
|
110
|
-
jest.spyOn(containerEl, 'clientHeight', 'get').mockReturnValue(1000);
|
|
111
|
-
component.find(SplitPane).prop('onChange')(800);
|
|
112
|
-
expect(debounceSpy).toHaveBeenCalled();
|
|
113
|
-
expect(props.onChange).toHaveBeenCalledWith({
|
|
114
|
-
isMaxSize: true,
|
|
115
|
-
isMinSize: false,
|
|
116
|
-
percentageSize: '80%',
|
|
117
|
-
size: 800
|
|
118
|
-
});
|
|
119
|
-
});
|
|
120
|
-
it('should call onChange prop with correct isMaxSize for "0" props.maxSize', function () {
|
|
121
|
-
var props = __assign(__assign({}, defaultProps), { maxSize: 0, onChange: jest.fn() });
|
|
122
|
-
var debounceSpy = jest.spyOn(mdmSdk, 'debounce').mockImplementation(function (func) { return func; });
|
|
123
|
-
var component = mount(React.createElement(ResizablePanes, __assign({}, props),
|
|
124
|
-
React.createElement("div", null),
|
|
125
|
-
React.createElement("div", null)));
|
|
126
|
-
var containerEl = component.find('.container').getDOMNode();
|
|
127
|
-
jest.spyOn(containerEl, 'clientHeight', 'get').mockReturnValue(1000);
|
|
128
|
-
component.find(SplitPane).prop('onChange')(1000);
|
|
129
|
-
expect(debounceSpy).toHaveBeenCalled();
|
|
130
|
-
expect(props.onChange).toHaveBeenCalledWith({
|
|
131
|
-
isMaxSize: true,
|
|
132
|
-
isMinSize: false,
|
|
133
|
-
percentageSize: '100%',
|
|
134
|
-
size: 1000
|
|
135
|
-
});
|
|
136
|
-
});
|
|
137
|
-
it('should call onChange prop with correct isMinSize for positive props.minSize', function () {
|
|
138
|
-
var props = __assign(__assign({}, defaultProps), { minSize: 60, onChange: jest.fn() });
|
|
139
|
-
var debounceSpy = jest.spyOn(mdmSdk, 'debounce').mockImplementation(function (func) { return func; });
|
|
140
|
-
var component = mount(React.createElement(ResizablePanes, __assign({}, props),
|
|
141
|
-
React.createElement("div", null),
|
|
142
|
-
React.createElement("div", null)));
|
|
143
|
-
var containerEl = component.find('.container').getDOMNode();
|
|
144
|
-
jest.spyOn(containerEl, 'clientHeight', 'get').mockReturnValue(1000);
|
|
145
|
-
component.find(SplitPane).prop('onChange')(props.minSize);
|
|
146
|
-
expect(debounceSpy).toHaveBeenCalled();
|
|
147
|
-
expect(props.onChange).toHaveBeenCalledWith({
|
|
148
|
-
isMaxSize: false,
|
|
149
|
-
isMinSize: true,
|
|
150
|
-
percentageSize: '6%',
|
|
151
|
-
size: 60
|
|
152
|
-
});
|
|
153
|
-
});
|
|
154
|
-
it('should apply negative size correctly', function () {
|
|
155
|
-
var props = __assign(__assign({}, defaultProps), { size: -40 });
|
|
156
|
-
var component = mount(React.createElement(ResizablePanes, __assign({}, props),
|
|
157
|
-
React.createElement("div", null),
|
|
158
|
-
React.createElement("div", null)));
|
|
159
|
-
var containerEl = component.find('.container').getDOMNode();
|
|
160
|
-
jest.spyOn(containerEl, 'clientHeight', 'get').mockReturnValue(1000);
|
|
161
|
-
component.setProps(__assign({}, props));
|
|
162
|
-
expect(component.find(SplitPane).prop('size')).toBe(1000 - 40);
|
|
163
|
-
});
|
|
164
|
-
});
|
|
File without changes
|
|
File without changes
|