cx 26.0.14 → 26.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/build/ui/VDOM.d.ts +1 -20
- package/build/ui/VDOM.js +1 -3
- package/build/ui/Widget.d.ts +1 -1
- package/build/ui/Widget.js +0 -5
- package/build/ui/app/startAppLoop.js +2 -10
- package/build/util/Component.js +5 -0
- package/build/util/test/createTestRenderer.d.ts +3 -1
- package/build/util/test/createTestRenderer.js +8 -2
- package/build/widgets/form/Checkbox.d.ts +0 -1
- package/build/widgets/form/Checkbox.js +1 -0
- package/build/widgets/form/ColorField.d.ts +0 -1
- package/build/widgets/form/ColorField.js +2 -2
- package/build/widgets/form/DateTimeField.d.ts +0 -2
- package/build/widgets/form/DateTimeField.js +1 -0
- package/build/widgets/form/DateTimePicker.d.ts +0 -2
- package/build/widgets/form/DateTimePicker.js +1 -0
- package/build/widgets/form/Radio.d.ts +0 -1
- package/build/widgets/form/Slider.js +9 -1
- package/build/widgets/form/Switch.d.ts +0 -1
- package/build/widgets/form/Switch.js +1 -1
- package/build/widgets/form/Wheel.d.ts +0 -1
- package/build/widgets/grid/Grid.d.ts +0 -2
- package/build/widgets/grid/GridCellEditor.js +3 -1
- package/build/widgets/icons/calendar.js +4 -3
- package/build/widgets/icons/check.js +2 -2
- package/build/widgets/icons/clear.js +2 -2
- package/build/widgets/icons/close.js +2 -2
- package/build/widgets/icons/cx.js +2 -2
- package/build/widgets/icons/drop-down.js +2 -2
- package/build/widgets/icons/file.js +2 -2
- package/build/widgets/icons/folder-open.js +2 -2
- package/build/widgets/icons/folder.js +2 -2
- package/build/widgets/icons/forward.js +2 -2
- package/build/widgets/icons/loading.js +2 -2
- package/build/widgets/icons/menu.js +2 -2
- package/build/widgets/icons/pixel-picker.js +2 -2
- package/build/widgets/icons/search.js +2 -2
- package/build/widgets/icons/sort-asc.js +2 -2
- package/build/widgets/icons/square.js +2 -2
- package/build/widgets/overlay/Overlay.d.ts +3 -0
- package/build/widgets/overlay/Overlay.js +3 -2
- package/dist/manifest.js +867 -867
- package/dist/ui.js +4 -18
- package/dist/util.js +4 -0
- package/dist/widgets.js +395 -319
- package/package.json +11 -8
- package/src/charts/Chart.ts +108 -108
- package/src/core.d.ts +182 -182
- package/src/data/Expression.spec.ts +229 -229
- package/src/data/Expression.ts +233 -233
- package/src/data/Grouper.ts +158 -158
- package/src/data/Selector.ts +10 -10
- package/src/data/StringTemplate.spec.ts +132 -132
- package/src/data/StructuredSelector.ts +146 -146
- package/src/data/ZoomIntoPropertyView.spec.ts +64 -64
- package/src/data/comparer.ts +78 -78
- package/src/data/computable.spec.ts +87 -87
- package/src/data/createStructuredSelector.ts +62 -62
- package/src/data/getAccessor.spec.ts +11 -11
- package/src/data/getAccessor.ts +74 -74
- package/src/data/getSelector.spec.ts +43 -43
- package/src/data/getSelector.ts +66 -66
- package/src/data/ops/filter.spec.ts +35 -35
- package/src/data/ops/filter.ts +9 -9
- package/src/data/ops/merge.ts +13 -13
- package/src/data/ops/removeTreeNodes.spec.ts +37 -37
- package/src/data/ops/updateArray.spec.ts +69 -69
- package/src/data/ops/updateArray.ts +31 -31
- package/src/data/test-types.ts +7 -7
- package/src/hooks/invokeCallback.spec.tsx +4 -4
- package/src/hooks/resolveCallback.spec.tsx +4 -4
- package/src/hooks/store.spec.tsx +15 -15
- package/src/hooks/useTrigger.spec.tsx +16 -10
- package/src/hooks/useTrigger.ts +26 -26
- package/src/index.scss +6 -6
- package/src/jsx-runtime.ts +79 -79
- package/src/svg/BoundedObject.ts +101 -101
- package/src/svg/util/Rect.ts +105 -105
- package/src/ui/CSS.ts +87 -87
- package/src/ui/CSSHelper.ts +17 -17
- package/src/ui/ContentResolver.spec.tsx +31 -29
- package/src/ui/Controller.spec.tsx +47 -39
- package/src/ui/Culture.ts +159 -159
- package/src/ui/Cx.spec.tsx +10 -8
- package/src/ui/DataProxy.spec.tsx +18 -18
- package/src/ui/Instance.ts +866 -866
- package/src/ui/IsolatedScope.spec.tsx +16 -9
- package/src/ui/Prop.ts +140 -140
- package/src/ui/PureContainer.spec.tsx +20 -18
- package/src/ui/RenderingContext.ts +99 -99
- package/src/ui/Repeater.spec.tsx +8 -6
- package/src/ui/Rescope.spec.tsx +13 -13
- package/src/ui/Restate.spec.tsx +31 -27
- package/src/ui/StructuredInstanceDataAccessor.ts +32 -32
- package/src/ui/VDOM.ts +1 -34
- package/src/ui/Widget.tsx +0 -7
- package/src/ui/adapter/TreeAdapter.spec.ts +76 -76
- package/src/ui/adapter/TreeAdapter.ts +185 -185
- package/src/ui/app/History.ts +133 -133
- package/src/ui/app/Url.spec.ts +50 -50
- package/src/ui/app/startAppLoop.tsx +5 -9
- package/src/ui/app/startHotAppLoop.ts +41 -41
- package/src/ui/createFunctionalComponent.spec.tsx +20 -18
- package/src/ui/layout/ContentPlaceholder.spec.tsx +46 -34
- package/src/ui/layout/FirstVisibleChildLayout.spec.tsx +31 -19
- package/src/ui/layout/FirstVisibleChildLayout.ts +60 -60
- package/src/ui/selection/PropertySelection.ts +87 -87
- package/src/util/Component.spec.ts +30 -0
- package/src/util/Component.ts +301 -296
- package/src/util/Console.ts +13 -13
- package/src/util/DOM.ts +88 -88
- package/src/util/hasKey.ts +18 -18
- package/src/util/index.ts +55 -55
- package/src/util/isArray.ts +3 -3
- package/src/util/isDefined.ts +3 -3
- package/src/util/isString.ts +3 -3
- package/src/util/test/createTestRenderer.tsx +9 -2
- package/src/widgets/AccessorBindings.spec.tsx +4 -4
- package/src/widgets/DocumentTitle.ts +95 -95
- package/src/widgets/HtmlElement.spec.tsx +6 -6
- package/src/widgets/ReactElementWrapper.spec.tsx +37 -37
- package/src/widgets/autoFocus.ts +9 -9
- package/src/widgets/cx.ts +63 -63
- package/src/widgets/form/Checkbox.tsx +0 -1
- package/src/widgets/form/ColorField.tsx +15 -12
- package/src/widgets/form/DateTimeField.tsx +0 -2
- package/src/widgets/form/DateTimePicker.tsx +0 -2
- package/src/widgets/form/Radio.tsx +0 -1
- package/src/widgets/form/Slider.tsx +12 -4
- package/src/widgets/form/Switch.tsx +2 -3
- package/src/widgets/form/ValidationGroup.spec.tsx +12 -12
- package/src/widgets/form/Wheel.tsx +0 -1
- package/src/widgets/grid/Grid.tsx +0 -1
- package/src/widgets/grid/GridCellEditor.tsx +7 -1
- package/src/widgets/icons/calendar.tsx +20 -15
- package/src/widgets/icons/check.tsx +2 -1
- package/src/widgets/icons/clear.tsx +2 -1
- package/src/widgets/icons/close.tsx +2 -2
- package/src/widgets/icons/cx.tsx +2 -1
- package/src/widgets/icons/drop-down.tsx +2 -1
- package/src/widgets/icons/file.tsx +2 -1
- package/src/widgets/icons/folder-open.tsx +2 -1
- package/src/widgets/icons/folder.tsx +2 -1
- package/src/widgets/icons/forward.tsx +2 -1
- package/src/widgets/icons/loading.tsx +2 -1
- package/src/widgets/icons/menu.tsx +2 -1
- package/src/widgets/icons/pixel-picker.tsx +2 -2
- package/src/widgets/icons/search.tsx +2 -1
- package/src/widgets/icons/sort-asc.tsx +2 -1
- package/src/widgets/icons/square.tsx +2 -1
- package/src/widgets/nav/Route.spec.tsx +2 -2
- package/src/widgets/overlay/Overlay.tsx +5 -1
- package/src/widgets/overlay/captureMouse.ts +195 -195
- package/src/widgets/overlay/createHotPromiseWindowFactory.ts +71 -71
- package/src/widgets/overlay/index.d.ts +11 -11
- package/src/widgets/overlay/tooltip-ops.ts +173 -173
- package/build/data/ArrayElementView.spec.d.ts +0 -1
- package/build/data/ArrayElementView.spec.js +0 -81
- package/build/data/Binding.spec.d.ts +0 -1
- package/build/data/Binding.spec.js +0 -61
- package/build/data/Expression.spec.d.ts +0 -1
- package/build/data/Expression.spec.js +0 -196
- package/build/data/Grouper.spec.d.ts +0 -1
- package/build/data/Grouper.spec.js +0 -48
- package/build/data/Ref.spec.d.ts +0 -1
- package/build/data/Ref.spec.js +0 -72
- package/build/data/Store.spec.d.ts +0 -1
- package/build/data/Store.spec.js +0 -19
- package/build/data/StoreRef.spec.d.ts +0 -1
- package/build/data/StoreRef.spec.js +0 -22
- package/build/data/StringTemplate.spec.d.ts +0 -1
- package/build/data/StringTemplate.spec.js +0 -112
- package/build/data/StructuredSelector.spec.d.ts +0 -1
- package/build/data/StructuredSelector.spec.js +0 -102
- package/build/data/View.spec.d.ts +0 -1
- package/build/data/View.spec.js +0 -44
- package/build/data/ZoomIntoPropertyView.spec.d.ts +0 -1
- package/build/data/ZoomIntoPropertyView.spec.js +0 -54
- package/build/data/comparer.spec.d.ts +0 -1
- package/build/data/comparer.spec.js +0 -50
- package/build/data/computable.spec.d.ts +0 -1
- package/build/data/computable.spec.js +0 -56
- package/build/data/createAccessorModelProxy.spec.d.ts +0 -1
- package/build/data/createAccessorModelProxy.spec.js +0 -30
- package/build/data/createStructuredSelector.spec.d.ts +0 -1
- package/build/data/createStructuredSelector.spec.js +0 -42
- package/build/data/diff/diffs.spec.d.ts +0 -1
- package/build/data/diff/diffs.spec.js +0 -45
- package/build/data/getAccessor.spec.d.ts +0 -1
- package/build/data/getAccessor.spec.js +0 -10
- package/build/data/getSelector.spec.d.ts +0 -1
- package/build/data/getSelector.spec.js +0 -36
- package/build/data/ops/append.spec.d.ts +0 -1
- package/build/data/ops/append.spec.js +0 -24
- package/build/data/ops/filter.spec.d.ts +0 -1
- package/build/data/ops/filter.spec.js +0 -25
- package/build/data/ops/findTreeNode.spec.d.ts +0 -1
- package/build/data/ops/findTreeNode.spec.js +0 -20
- package/build/data/ops/merge.spec.d.ts +0 -1
- package/build/data/ops/merge.spec.js +0 -23
- package/build/data/ops/removeTreeNodes.spec.d.ts +0 -1
- package/build/data/ops/removeTreeNodes.spec.js +0 -35
- package/build/data/ops/updateArray.spec.d.ts +0 -1
- package/build/data/ops/updateArray.spec.js +0 -33
- package/build/data/ops/updateTree.spec.d.ts +0 -1
- package/build/data/ops/updateTree.spec.js +0 -44
- package/build/hooks/invokeCallback.spec.d.ts +0 -1
- package/build/hooks/invokeCallback.spec.js +0 -44
- package/build/hooks/resolveCallback.spec.d.ts +0 -1
- package/build/hooks/resolveCallback.spec.js +0 -35
- package/build/hooks/store.spec.d.ts +0 -1
- package/build/hooks/store.spec.js +0 -48
- package/build/hooks/useTrigger.spec.d.ts +0 -1
- package/build/hooks/useTrigger.spec.js +0 -59
- package/build/ui/Controller.spec.d.ts +0 -1
- package/build/ui/Controller.spec.js +0 -247
- package/build/ui/Cx.spec.d.ts +0 -1
- package/build/ui/Cx.spec.js +0 -153
- package/build/ui/DataProxy.spec.d.ts +0 -1
- package/build/ui/DataProxy.spec.js +0 -208
- package/build/ui/IsolatedScope.spec.d.ts +0 -1
- package/build/ui/IsolatedScope.spec.js +0 -42
- package/build/ui/PureContainer.spec.d.ts +0 -1
- package/build/ui/PureContainer.spec.js +0 -149
- package/build/ui/Repeater.spec.d.ts +0 -1
- package/build/ui/Repeater.spec.js +0 -109
- package/build/ui/Rescope.spec.d.ts +0 -1
- package/build/ui/Rescope.spec.js +0 -134
- package/build/ui/Restate.spec.d.ts +0 -1
- package/build/ui/Restate.spec.js +0 -257
- package/build/ui/adapter/ArrayAdapter.spec.d.ts +0 -1
- package/build/ui/adapter/ArrayAdapter.spec.js +0 -44
- package/build/ui/adapter/TreeAdapter.spec.d.ts +0 -1
- package/build/ui/adapter/TreeAdapter.spec.js +0 -71
- package/build/ui/app/Url.spec.d.ts +0 -1
- package/build/ui/app/Url.spec.js +0 -43
- package/build/ui/createFunctionalComponent.spec.d.ts +0 -1
- package/build/ui/createFunctionalComponent.spec.js +0 -272
- package/build/ui/layout/ContentPlaceholder.spec.d.ts +0 -1
- package/build/ui/layout/ContentPlaceholder.spec.js +0 -333
- package/build/ui/layout/FirstVisibleChildLayout.spec.d.ts +0 -1
- package/build/ui/layout/FirstVisibleChildLayout.spec.js +0 -101
- package/build/util/Format.spec.d.ts +0 -1
- package/build/util/Format.spec.js +0 -58
- package/build/util/TraversalStack.spec.d.ts +0 -1
- package/build/util/TraversalStack.spec.js +0 -43
- package/build/util/date/upperBoundCheck.spec.d.ts +0 -1
- package/build/util/date/upperBoundCheck.spec.js +0 -22
- package/build/util/getSearchQueryPredicate.spec.d.ts +0 -1
- package/build/util/getSearchQueryPredicate.spec.js +0 -33
- package/build/util/isValidIdentifierName.spec.d.ts +0 -1
- package/build/util/isValidIdentifierName.spec.js +0 -28
- package/build/util/routeAppend.spec.d.ts +0 -1
- package/build/util/routeAppend.spec.js +0 -14
- package/build/widgets/AccessorBindings.spec.d.ts +0 -1
- package/build/widgets/AccessorBindings.spec.js +0 -40
- package/build/widgets/HtmlElement.spec.d.ts +0 -1
- package/build/widgets/HtmlElement.spec.js +0 -38
- package/build/widgets/form/ValidationGroup.spec.d.ts +0 -1
- package/build/widgets/form/ValidationGroup.spec.js +0 -62
- package/build/widgets/nav/Route.spec.d.ts +0 -1
- package/build/widgets/nav/Route.spec.js +0 -15
- package/dist/manifest.d.ts +0 -1443
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import { Store } from "../data/Store";
|
|
2
2
|
import assert from "assert";
|
|
3
|
-
import { createTestRenderer } from "../util/test/createTestRenderer";
|
|
3
|
+
import { createTestRenderer, act } from "../util/test/createTestRenderer";
|
|
4
4
|
import { VDOM } from "../ui/Widget";
|
|
5
|
-
import { act } from "react-test-renderer";
|
|
6
5
|
import {
|
|
7
6
|
ReactFunctionComponent,
|
|
8
7
|
ReactCounterComponent,
|
|
@@ -17,7 +16,7 @@ import { createAccessorModelProxy } from "../data/createAccessorModelProxy";
|
|
|
17
16
|
import { ReactElementWrapper } from "./ReactElementWrapper";
|
|
18
17
|
|
|
19
18
|
describe("ReactElementWrapper", () => {
|
|
20
|
-
it("renders React components as tag", () => {
|
|
19
|
+
it("renders React components as tag", async () => {
|
|
21
20
|
class MyReactComponent extends VDOM.Component<any> {
|
|
22
21
|
render() {
|
|
23
22
|
return VDOM.createElement("div", { className: "my-component" }, this.props.children);
|
|
@@ -26,7 +25,7 @@ describe("ReactElementWrapper", () => {
|
|
|
26
25
|
|
|
27
26
|
let store = new Store();
|
|
28
27
|
|
|
29
|
-
const component = createTestRenderer(
|
|
28
|
+
const component = await createTestRenderer(
|
|
30
29
|
store,
|
|
31
30
|
<cx>
|
|
32
31
|
<MyReactComponent>
|
|
@@ -42,10 +41,10 @@ describe("ReactElementWrapper", () => {
|
|
|
42
41
|
assert(tree.children && tree.children.length === 1, "Expected one child");
|
|
43
42
|
});
|
|
44
43
|
|
|
45
|
-
it("renders React function components with props", () => {
|
|
44
|
+
it("renders React function components with props", async () => {
|
|
46
45
|
let store = new Store();
|
|
47
46
|
|
|
48
|
-
const component = createTestRenderer(
|
|
47
|
+
const component = await createTestRenderer(
|
|
49
48
|
store,
|
|
50
49
|
<cx>
|
|
51
50
|
<ReactFunctionComponent title="Test Title">
|
|
@@ -69,10 +68,10 @@ describe("ReactElementWrapper", () => {
|
|
|
69
68
|
assert.equal(contentDiv.props.className, "content");
|
|
70
69
|
});
|
|
71
70
|
|
|
72
|
-
it("renders React function components with hooks", () => {
|
|
71
|
+
it("renders React function components with hooks", async () => {
|
|
73
72
|
let store = new Store();
|
|
74
73
|
|
|
75
|
-
const component = createTestRenderer(
|
|
74
|
+
const component = await createTestRenderer(
|
|
76
75
|
store,
|
|
77
76
|
<cx>
|
|
78
77
|
<ReactCounterComponent initialCount={5} />
|
|
@@ -94,10 +93,10 @@ describe("ReactElementWrapper", () => {
|
|
|
94
93
|
assert.equal(button.type, "button");
|
|
95
94
|
});
|
|
96
95
|
|
|
97
|
-
it("renders React class components with props", () => {
|
|
96
|
+
it("renders React class components with props", async () => {
|
|
98
97
|
let store = new Store();
|
|
99
98
|
|
|
100
|
-
const component = createTestRenderer(
|
|
99
|
+
const component = await createTestRenderer(
|
|
101
100
|
store,
|
|
102
101
|
<cx>
|
|
103
102
|
<ReactClassComponent label="Test Label">
|
|
@@ -122,10 +121,10 @@ describe("ReactElementWrapper", () => {
|
|
|
122
121
|
assert.equal(bodyDiv.props.className, "body");
|
|
123
122
|
});
|
|
124
123
|
|
|
125
|
-
it("renders React PureComponent", () => {
|
|
124
|
+
it("renders React PureComponent", async () => {
|
|
126
125
|
let store = new Store();
|
|
127
126
|
|
|
128
|
-
const component = createTestRenderer(
|
|
127
|
+
const component = await createTestRenderer(
|
|
129
128
|
store,
|
|
130
129
|
<cx>
|
|
131
130
|
<ReactPureComponent value="Pure Value" />
|
|
@@ -139,11 +138,11 @@ describe("ReactElementWrapper", () => {
|
|
|
139
138
|
assert.deepEqual(tree.children, ["Pure Value"]);
|
|
140
139
|
});
|
|
141
140
|
|
|
142
|
-
it("renders React function component with useRef and useEffect", () => {
|
|
141
|
+
it("renders React function component with useRef and useEffect", async () => {
|
|
143
142
|
let store = new Store();
|
|
144
143
|
let mountedElement: HTMLDivElement | null = null;
|
|
145
144
|
|
|
146
|
-
const component = createTestRenderer(
|
|
145
|
+
const component = await createTestRenderer(
|
|
147
146
|
store,
|
|
148
147
|
<cx>
|
|
149
148
|
<ReactRefEffectComponent
|
|
@@ -161,20 +160,17 @@ describe("ReactElementWrapper", () => {
|
|
|
161
160
|
assert.deepEqual(tree.children, ["Component with ref and effect"]);
|
|
162
161
|
});
|
|
163
162
|
|
|
164
|
-
it("renders React function component with useEffect that updates state", () => {
|
|
163
|
+
it("renders React function component with useEffect that updates state", async () => {
|
|
165
164
|
let store = new Store();
|
|
166
|
-
let component: ReturnType<typeof createTestRenderer>;
|
|
167
165
|
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
<
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
);
|
|
175
|
-
});
|
|
166
|
+
const component = await createTestRenderer(
|
|
167
|
+
store,
|
|
168
|
+
<cx>
|
|
169
|
+
<ReactEffectStateComponent value="Test" />
|
|
170
|
+
</cx>,
|
|
171
|
+
);
|
|
176
172
|
|
|
177
|
-
let tree = component
|
|
173
|
+
let tree = component.toJSON();
|
|
178
174
|
assert(tree && !Array.isArray(tree), "Expected single element");
|
|
179
175
|
assert.equal(tree.type, "div");
|
|
180
176
|
assert.equal(tree.props.className, "react-effect-state-component");
|
|
@@ -187,7 +183,7 @@ describe("ReactElementWrapper", () => {
|
|
|
187
183
|
assert.deepEqual(processedSpan.children, ["Processed: Test"]);
|
|
188
184
|
});
|
|
189
185
|
|
|
190
|
-
it("translates CxJS accessor bindings to React component props", () => {
|
|
186
|
+
it("translates CxJS accessor bindings to React component props", async () => {
|
|
191
187
|
interface StoreModel {
|
|
192
188
|
text: string;
|
|
193
189
|
count: number;
|
|
@@ -219,7 +215,7 @@ describe("ReactElementWrapper", () => {
|
|
|
219
215
|
},
|
|
220
216
|
});
|
|
221
217
|
|
|
222
|
-
const component = createTestRenderer(store, widget);
|
|
218
|
+
const component = await createTestRenderer(store, widget);
|
|
223
219
|
|
|
224
220
|
let tree = component.toJSON();
|
|
225
221
|
assert(tree && !Array.isArray(tree), "Expected single element");
|
|
@@ -238,7 +234,7 @@ describe("ReactElementWrapper", () => {
|
|
|
238
234
|
assert.deepEqual(tagsSpan.children, ["a, b, c"]);
|
|
239
235
|
});
|
|
240
236
|
|
|
241
|
-
it("supports visible prop on React components", () => {
|
|
237
|
+
it("supports visible prop on React components", async () => {
|
|
242
238
|
interface StoreModel {
|
|
243
239
|
show: boolean;
|
|
244
240
|
}
|
|
@@ -251,7 +247,7 @@ describe("ReactElementWrapper", () => {
|
|
|
251
247
|
},
|
|
252
248
|
});
|
|
253
249
|
|
|
254
|
-
const component = createTestRenderer(
|
|
250
|
+
const component = await createTestRenderer(
|
|
255
251
|
store,
|
|
256
252
|
<cx>
|
|
257
253
|
<div>
|
|
@@ -268,13 +264,15 @@ describe("ReactElementWrapper", () => {
|
|
|
268
264
|
assert.equal((tree.children![0] as any).type, "span");
|
|
269
265
|
|
|
270
266
|
// Update store to make component visible
|
|
271
|
-
|
|
267
|
+
await act(async () => {
|
|
268
|
+
store.set("show", true);
|
|
269
|
+
});
|
|
272
270
|
let tree2 = component.toJSON();
|
|
273
271
|
assert(tree2 && !Array.isArray(tree2), "Expected single element");
|
|
274
272
|
assert.equal(tree2.children!.length, 2, "Expected both children to be visible");
|
|
275
273
|
});
|
|
276
274
|
|
|
277
|
-
it("supports controller prop on React components", () => {
|
|
275
|
+
it("supports controller prop on React components", async () => {
|
|
278
276
|
let controllerInitialized = false;
|
|
279
277
|
|
|
280
278
|
class TestController extends Controller {
|
|
@@ -295,7 +293,7 @@ describe("ReactElementWrapper", () => {
|
|
|
295
293
|
},
|
|
296
294
|
});
|
|
297
295
|
|
|
298
|
-
const component = createTestRenderer(
|
|
296
|
+
const component = await createTestRenderer(
|
|
299
297
|
store,
|
|
300
298
|
<cx>
|
|
301
299
|
<ReactPropsComponent text={$store.text} count={10} enabled={true} controller={TestController} />
|
|
@@ -310,7 +308,7 @@ describe("ReactElementWrapper", () => {
|
|
|
310
308
|
assert.deepEqual(textSpan.children, ["Controller Test"]);
|
|
311
309
|
});
|
|
312
310
|
|
|
313
|
-
it("updates React component when bound store data changes", () => {
|
|
311
|
+
it("updates React component when bound store data changes", async () => {
|
|
314
312
|
interface StoreModel {
|
|
315
313
|
text: string;
|
|
316
314
|
count: number;
|
|
@@ -327,7 +325,7 @@ describe("ReactElementWrapper", () => {
|
|
|
327
325
|
},
|
|
328
326
|
});
|
|
329
327
|
|
|
330
|
-
const component = createTestRenderer(
|
|
328
|
+
const component = await createTestRenderer(
|
|
331
329
|
store,
|
|
332
330
|
<cx>
|
|
333
331
|
<ReactPropsComponent text={$store.text} count={$store.count} enabled={$store.enabled} />
|
|
@@ -340,9 +338,11 @@ describe("ReactElementWrapper", () => {
|
|
|
340
338
|
assert.deepEqual(tree1.children[2].children, ["no"]);
|
|
341
339
|
|
|
342
340
|
// Update store
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
341
|
+
await act(async () => {
|
|
342
|
+
store.set("text", "Updated");
|
|
343
|
+
store.set("count", 99);
|
|
344
|
+
store.set("enabled", true);
|
|
345
|
+
});
|
|
346
346
|
|
|
347
347
|
let tree2 = component.toJSON() as any;
|
|
348
348
|
assert.deepEqual(tree2.children[0].children, ["Updated"]);
|
package/src/widgets/autoFocus.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { FocusManager } from "../ui/FocusManager";
|
|
2
|
-
import { isTouchEvent } from "../util/isTouchEvent";
|
|
3
|
-
|
|
4
|
-
export function autoFocus(el: HTMLElement | undefined | null, component: any): void {
|
|
5
|
-
let data = component.props.data || component.props.instance.data;
|
|
6
|
-
let autoFocusValue = el && data.autoFocus;
|
|
7
|
-
if (autoFocusValue && autoFocusValue != component.autoFocusValue && !isTouchEvent()) FocusManager.focus(el!);
|
|
8
|
-
component.autoFocusValue = autoFocusValue;
|
|
9
|
-
}
|
|
1
|
+
import { FocusManager } from "../ui/FocusManager";
|
|
2
|
+
import { isTouchEvent } from "../util/isTouchEvent";
|
|
3
|
+
|
|
4
|
+
export function autoFocus(el: HTMLElement | undefined | null, component: any): void {
|
|
5
|
+
let data = component.props.data || component.props.instance.data;
|
|
6
|
+
let autoFocusValue = el && data.autoFocus;
|
|
7
|
+
if (autoFocusValue && autoFocusValue != component.autoFocusValue && !isTouchEvent()) FocusManager.focus(el!);
|
|
8
|
+
component.autoFocusValue = autoFocusValue;
|
|
9
|
+
}
|
package/src/widgets/cx.ts
CHANGED
|
@@ -1,63 +1,63 @@
|
|
|
1
|
-
import { HtmlElement } from "./HtmlElement";
|
|
2
|
-
import { VDOM } from "../ui/Widget";
|
|
3
|
-
import { createComponentFactory, isComponentFactory } from "../util/Component";
|
|
4
|
-
import { createFunctionalComponent } from "../ui/createFunctionalComponent";
|
|
5
|
-
import { isString } from "../util/isString";
|
|
6
|
-
import { isNumber } from "../util/isNumber";
|
|
7
|
-
import { isFunction } from "../util/isFunction";
|
|
8
|
-
import { isUndefined } from "../util/isUndefined";
|
|
9
|
-
import { isArray } from "../util/isArray";
|
|
10
|
-
|
|
11
|
-
import { flattenProps } from "../ui/flattenProps";
|
|
12
|
-
|
|
13
|
-
let htmlFactoryCache: Record<string, any> = {};
|
|
14
|
-
|
|
15
|
-
function getHtmlElementFactory(tagName: string): any {
|
|
16
|
-
let factory = htmlFactoryCache[tagName];
|
|
17
|
-
if (factory) return factory;
|
|
18
|
-
return (htmlFactoryCache[tagName] = createComponentFactory(
|
|
19
|
-
() => {},
|
|
20
|
-
(config: any) => HtmlElement.create(HtmlElement, { tag: tagName }, flattenProps(config)),
|
|
21
|
-
{ tag: tagName },
|
|
22
|
-
));
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
export function cx(typeName: any, props?: any, ...children: any[]): any {
|
|
26
|
-
if (isArray(typeName)) return typeName;
|
|
27
|
-
|
|
28
|
-
if (isFunction(typeName) && isUndefined(props))
|
|
29
|
-
return createFunctionalComponent((config: any) => typeName(flattenProps(config)));
|
|
30
|
-
|
|
31
|
-
if (typeName.type || typeName.$type) return typeName;
|
|
32
|
-
|
|
33
|
-
if (children && children.length == 0) children = [];
|
|
34
|
-
|
|
35
|
-
if (children && children.length == 1) children = children[0];
|
|
36
|
-
|
|
37
|
-
if (typeName == "cx") return children;
|
|
38
|
-
|
|
39
|
-
if (typeName == "react") return react(children);
|
|
40
|
-
|
|
41
|
-
if (isString(typeName) && typeName[0] == typeName[0].toLowerCase()) typeName = getHtmlElementFactory(typeName);
|
|
42
|
-
|
|
43
|
-
return {
|
|
44
|
-
$type: typeName,
|
|
45
|
-
$props: props,
|
|
46
|
-
jsxAttributes: props && Object.keys(props),
|
|
47
|
-
children,
|
|
48
|
-
};
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
export function react(config: any): any {
|
|
52
|
-
if (!config || isString(config) || isNumber(config) || VDOM.isValidElement(config)) return config;
|
|
53
|
-
|
|
54
|
-
if (isArray(config)) return config.map(react);
|
|
55
|
-
|
|
56
|
-
let type = config.$type;
|
|
57
|
-
|
|
58
|
-
if (isComponentFactory(type) && type.$meta && type.$meta.tag) type = type.$meta.tag;
|
|
59
|
-
|
|
60
|
-
if (isArray(config.children)) return VDOM.createElement(type, config.$props, ...config.children.map(react));
|
|
61
|
-
|
|
62
|
-
return VDOM.createElement(type, config.$props, react(config.children));
|
|
63
|
-
}
|
|
1
|
+
import { HtmlElement } from "./HtmlElement";
|
|
2
|
+
import { VDOM } from "../ui/Widget";
|
|
3
|
+
import { createComponentFactory, isComponentFactory } from "../util/Component";
|
|
4
|
+
import { createFunctionalComponent } from "../ui/createFunctionalComponent";
|
|
5
|
+
import { isString } from "../util/isString";
|
|
6
|
+
import { isNumber } from "../util/isNumber";
|
|
7
|
+
import { isFunction } from "../util/isFunction";
|
|
8
|
+
import { isUndefined } from "../util/isUndefined";
|
|
9
|
+
import { isArray } from "../util/isArray";
|
|
10
|
+
|
|
11
|
+
import { flattenProps } from "../ui/flattenProps";
|
|
12
|
+
|
|
13
|
+
let htmlFactoryCache: Record<string, any> = {};
|
|
14
|
+
|
|
15
|
+
function getHtmlElementFactory(tagName: string): any {
|
|
16
|
+
let factory = htmlFactoryCache[tagName];
|
|
17
|
+
if (factory) return factory;
|
|
18
|
+
return (htmlFactoryCache[tagName] = createComponentFactory(
|
|
19
|
+
() => {},
|
|
20
|
+
(config: any) => HtmlElement.create(HtmlElement, { tag: tagName }, flattenProps(config)),
|
|
21
|
+
{ tag: tagName },
|
|
22
|
+
));
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export function cx(typeName: any, props?: any, ...children: any[]): any {
|
|
26
|
+
if (isArray(typeName)) return typeName;
|
|
27
|
+
|
|
28
|
+
if (isFunction(typeName) && isUndefined(props))
|
|
29
|
+
return createFunctionalComponent((config: any) => typeName(flattenProps(config)));
|
|
30
|
+
|
|
31
|
+
if (typeName.type || typeName.$type) return typeName;
|
|
32
|
+
|
|
33
|
+
if (children && children.length == 0) children = [];
|
|
34
|
+
|
|
35
|
+
if (children && children.length == 1) children = children[0];
|
|
36
|
+
|
|
37
|
+
if (typeName == "cx") return children;
|
|
38
|
+
|
|
39
|
+
if (typeName == "react") return react(children);
|
|
40
|
+
|
|
41
|
+
if (isString(typeName) && typeName[0] == typeName[0].toLowerCase()) typeName = getHtmlElementFactory(typeName);
|
|
42
|
+
|
|
43
|
+
return {
|
|
44
|
+
$type: typeName,
|
|
45
|
+
$props: props,
|
|
46
|
+
jsxAttributes: props && Object.keys(props),
|
|
47
|
+
children,
|
|
48
|
+
};
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
export function react(config: any): any {
|
|
52
|
+
if (!config || isString(config) || isNumber(config) || VDOM.isValidElement(config)) return config;
|
|
53
|
+
|
|
54
|
+
if (isArray(config)) return config.map(react);
|
|
55
|
+
|
|
56
|
+
let type = config.$type;
|
|
57
|
+
|
|
58
|
+
if (isComponentFactory(type) && type.$meta && type.$meta.tag) type = type.$meta.tag;
|
|
59
|
+
|
|
60
|
+
if (isArray(config.children)) return VDOM.createElement(type, config.$props, ...config.children.map(react));
|
|
61
|
+
|
|
62
|
+
return VDOM.createElement(type, config.$props, react(config.children));
|
|
63
|
+
}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
/** @jsxImportSource react */
|
|
2
2
|
|
|
3
|
-
import * as React from "react";
|
|
4
3
|
import { Cx } from "../../ui/Cx";
|
|
5
4
|
import { DropdownInstance, DropdownWidgetProps, Instance } from "../../ui/Instance";
|
|
6
5
|
import type { RenderingContext } from "../../ui/RenderingContext";
|
|
@@ -49,7 +48,10 @@ export interface ColorFieldConfig extends FieldConfig {
|
|
|
49
48
|
onValidate?: string | ((value: string, instance: Instance, validationParams: Record<string, unknown>) => unknown);
|
|
50
49
|
}
|
|
51
50
|
|
|
52
|
-
export class ColorFieldInstance<F extends ColorField = ColorField>
|
|
51
|
+
export class ColorFieldInstance<F extends ColorField = ColorField>
|
|
52
|
+
extends FieldInstance<F>
|
|
53
|
+
implements DropdownWidgetProps
|
|
54
|
+
{
|
|
53
55
|
lastDropdown?: Instance;
|
|
54
56
|
dropdownOpen?: boolean;
|
|
55
57
|
selectedIndex?: number;
|
|
@@ -231,10 +233,7 @@ class ColorInput extends VDOM.Component<ColorInputProps, ColorInputState> {
|
|
|
231
233
|
|
|
232
234
|
let insideButton;
|
|
233
235
|
if (!data.readOnly && !data.disabled) {
|
|
234
|
-
if (
|
|
235
|
-
showClear &&
|
|
236
|
-
(((!data.required || alwaysShowClear) && !data.empty) || instance.state?.inputError)
|
|
237
|
-
)
|
|
236
|
+
if (showClear && (((!data.required || alwaysShowClear) && !data.empty) || instance.state?.inputError))
|
|
238
237
|
insideButton = (
|
|
239
238
|
<div
|
|
240
239
|
className={CSS.element(baseClass, "clear")}
|
|
@@ -301,14 +300,18 @@ class ColorInput extends VDOM.Component<ColorInputProps, ColorInputState> {
|
|
|
301
300
|
type="text"
|
|
302
301
|
className={CSS.expand(CSS.element(baseClass, "input"), data.inputClass)}
|
|
303
302
|
style={data.inputStyle as React.CSSProperties}
|
|
304
|
-
defaultValue={this.trim(data.value as string || "")}
|
|
303
|
+
defaultValue={this.trim((data.value as string) || "")}
|
|
305
304
|
disabled={data.disabled as boolean}
|
|
306
305
|
readOnly={data.readOnly as boolean}
|
|
307
306
|
tabIndex={data.tabIndex as number}
|
|
308
307
|
placeholder={data.placeholder as string}
|
|
309
|
-
{...data.inputAttrs as Record<string, any>}
|
|
310
|
-
onInput={(e: React.ChangeEvent<HTMLInputElement>) =>
|
|
311
|
-
|
|
308
|
+
{...(data.inputAttrs as Record<string, any>)}
|
|
309
|
+
onInput={(e: React.ChangeEvent<HTMLInputElement>) =>
|
|
310
|
+
this.onChange((e.target as HTMLInputElement).value, "input")
|
|
311
|
+
}
|
|
312
|
+
onChange={(e: React.ChangeEvent<HTMLInputElement>) =>
|
|
313
|
+
this.onChange((e.target as HTMLInputElement).value, "change")
|
|
314
|
+
}
|
|
312
315
|
onKeyDown={(e: React.KeyboardEvent<HTMLInputElement>) => this.onKeyDown(e)}
|
|
313
316
|
onBlur={(e: React.FocusEvent<HTMLInputElement>) => {
|
|
314
317
|
this.onBlur(e);
|
|
@@ -355,7 +358,7 @@ class ColorInput extends VDOM.Component<ColorInputProps, ColorInputState> {
|
|
|
355
358
|
let { instance } = this.props;
|
|
356
359
|
let { widget } = instance;
|
|
357
360
|
const colorFieldWidget = widget as ColorField;
|
|
358
|
-
|
|
361
|
+
|
|
359
362
|
if (colorFieldWidget.trackFocus) {
|
|
360
363
|
this.setState({
|
|
361
364
|
focus: true,
|
|
@@ -430,7 +433,7 @@ class ColorInput extends VDOM.Component<ColorInputProps, ColorInputState> {
|
|
|
430
433
|
UNSAFE_componentWillReceiveProps(props: ColorInputProps): void {
|
|
431
434
|
let { data, instance } = props;
|
|
432
435
|
let { state } = instance;
|
|
433
|
-
let nv = this.trim(data.value as string || "");
|
|
436
|
+
let nv = this.trim((data.value as string) || "");
|
|
434
437
|
if (nv != this.input.value && (this.data.value != data.value || !state?.inputError)) {
|
|
435
438
|
this.input.value = nv;
|
|
436
439
|
instance.setState({
|
|
@@ -7,7 +7,6 @@ import { tooltipMouseMove, tooltipMouseLeave } from "../overlay/tooltip-ops";
|
|
|
7
7
|
import { stopPropagation } from "../../util/eventCallbacks";
|
|
8
8
|
import { KeyCode } from "../../util/KeyCode";
|
|
9
9
|
import { isUndefined } from "../../util/isUndefined";
|
|
10
|
-
import * as React from "react";
|
|
11
10
|
import { BooleanProp, Prop, StringProp } from "../../ui/Prop";
|
|
12
11
|
|
|
13
12
|
export interface RadioConfig extends FieldConfig {
|
|
@@ -247,7 +247,9 @@ class SliderComponent extends VDOM.Component<SliderComponentProps, SliderCompone
|
|
|
247
247
|
style={data.style}
|
|
248
248
|
id={data.id}
|
|
249
249
|
onClick={(e: React.MouseEvent) => this.onClick(e)}
|
|
250
|
-
ref={(el: HTMLDivElement | null) =>
|
|
250
|
+
ref={(el: HTMLDivElement | null) => {
|
|
251
|
+
this.dom.el = el || undefined;
|
|
252
|
+
}}
|
|
251
253
|
onMouseMove={(e: React.MouseEvent) => tooltipMouseMove(e, ...getFieldTooltip(instance))}
|
|
252
254
|
onMouseLeave={(e: React.MouseEvent) => tooltipMouseLeave(e, ...getFieldTooltip(instance))}
|
|
253
255
|
>
|
|
@@ -257,7 +259,9 @@ class SliderComponent extends VDOM.Component<SliderComponentProps, SliderCompone
|
|
|
257
259
|
<div
|
|
258
260
|
key="space"
|
|
259
261
|
className={CSS.element(baseClass, "space")}
|
|
260
|
-
ref={(c: HTMLDivElement | null) =>
|
|
262
|
+
ref={(c: HTMLDivElement | null) => {
|
|
263
|
+
this.dom.range = c || undefined;
|
|
264
|
+
}}
|
|
261
265
|
>
|
|
262
266
|
{widget.showFrom && (
|
|
263
267
|
<div
|
|
@@ -271,7 +275,9 @@ class SliderComponent extends VDOM.Component<SliderComponentProps, SliderCompone
|
|
|
271
275
|
}
|
|
272
276
|
onMouseLeave={(e: React.MouseEvent) => this.onHandleMouseLeave(e, "from")}
|
|
273
277
|
onTouchStart={(e: React.TouchEvent) => this.onHandleMouseDown(e, "from")}
|
|
274
|
-
ref={(c: HTMLDivElement | null) =>
|
|
278
|
+
ref={(c: HTMLDivElement | null) => {
|
|
279
|
+
this.dom.from = c || undefined;
|
|
280
|
+
}}
|
|
275
281
|
/>
|
|
276
282
|
)}
|
|
277
283
|
{widget.showTo && (
|
|
@@ -286,7 +292,9 @@ class SliderComponent extends VDOM.Component<SliderComponentProps, SliderCompone
|
|
|
286
292
|
}
|
|
287
293
|
onMouseLeave={(e: React.MouseEvent) => this.onHandleMouseLeave(e, "to")}
|
|
288
294
|
onTouchStart={(e: React.TouchEvent) => this.onHandleMouseDown(e, "to")}
|
|
289
|
-
ref={(c: HTMLDivElement | null) =>
|
|
295
|
+
ref={(c: HTMLDivElement | null) => {
|
|
296
|
+
this.dom.to = c || undefined;
|
|
297
|
+
}}
|
|
290
298
|
/>
|
|
291
299
|
)}
|
|
292
300
|
</div>
|
|
@@ -8,7 +8,6 @@ import { Field, FieldConfig, getFieldTooltip, FieldInstance } from "./Field";
|
|
|
8
8
|
import { tooltipMouseMove, tooltipMouseLeave } from "../overlay/tooltip-ops";
|
|
9
9
|
import { preventFocus } from "../../ui/FocusManager";
|
|
10
10
|
import { isDefined } from "../../util/isDefined";
|
|
11
|
-
import * as React from "react";
|
|
12
11
|
import { BooleanProp, StringProp, StyleProp } from "../../ui/Prop";
|
|
13
12
|
|
|
14
13
|
export interface SwitchConfig extends FieldConfig {
|
|
@@ -72,7 +71,7 @@ export class Switch extends Field<SwitchConfig> {
|
|
|
72
71
|
structured: true,
|
|
73
72
|
},
|
|
74
73
|
},
|
|
75
|
-
...args
|
|
74
|
+
...args,
|
|
76
75
|
);
|
|
77
76
|
}
|
|
78
77
|
|
|
@@ -116,7 +115,7 @@ export class Switch extends Field<SwitchConfig> {
|
|
|
116
115
|
className={data.classNames}
|
|
117
116
|
style={data.style}
|
|
118
117
|
id={data.id}
|
|
119
|
-
tabIndex={data.disabled ? undefined : (
|
|
118
|
+
tabIndex={data.disabled ? undefined : (data.tabIndex as number) || 0}
|
|
120
119
|
onMouseDown={(e: React.MouseEvent) => {
|
|
121
120
|
e.stopPropagation();
|
|
122
121
|
if (!this.focusOnMouseDown) preventFocus(e);
|
|
@@ -7,7 +7,7 @@ import { createTestRenderer } from "../../util/test/createTestRenderer";
|
|
|
7
7
|
import assert from "assert";
|
|
8
8
|
|
|
9
9
|
describe("ValidationGroup", () => {
|
|
10
|
-
it("performs validation and sets the flags", () => {
|
|
10
|
+
it("performs validation and sets the flags", async () => {
|
|
11
11
|
let widget = (
|
|
12
12
|
<cx>
|
|
13
13
|
<ValidationGroup invalid={bind("invalid")} valid={bind("valid")}>
|
|
@@ -19,7 +19,7 @@ describe("ValidationGroup", () => {
|
|
|
19
19
|
|
|
20
20
|
let store = new Store();
|
|
21
21
|
|
|
22
|
-
const component = createTestRenderer(store, widget);
|
|
22
|
+
const component = await createTestRenderer(store, widget);
|
|
23
23
|
|
|
24
24
|
let tree = component.toJSON();
|
|
25
25
|
assert(tree && !Array.isArray(tree));
|
|
@@ -28,7 +28,7 @@ describe("ValidationGroup", () => {
|
|
|
28
28
|
assert.equal(store.get("valid"), false);
|
|
29
29
|
});
|
|
30
30
|
|
|
31
|
-
it("nested validation works", () => {
|
|
31
|
+
it("nested validation works", async () => {
|
|
32
32
|
let widget = (
|
|
33
33
|
<cx>
|
|
34
34
|
<div>
|
|
@@ -46,7 +46,7 @@ describe("ValidationGroup", () => {
|
|
|
46
46
|
|
|
47
47
|
let store = new Store();
|
|
48
48
|
|
|
49
|
-
const component = createTestRenderer(store, widget);
|
|
49
|
+
const component = await createTestRenderer(store, widget);
|
|
50
50
|
|
|
51
51
|
let tree = component.toJSON();
|
|
52
52
|
assert.equal(store.get("invalid"), true);
|
|
@@ -54,7 +54,7 @@ describe("ValidationGroup", () => {
|
|
|
54
54
|
assert.equal(store.get("invalid2"), false);
|
|
55
55
|
});
|
|
56
56
|
|
|
57
|
-
it("isolated validation group does not affect the parent", () => {
|
|
57
|
+
it("isolated validation group does not affect the parent", async () => {
|
|
58
58
|
let widget = (
|
|
59
59
|
<cx>
|
|
60
60
|
<div>
|
|
@@ -72,7 +72,7 @@ describe("ValidationGroup", () => {
|
|
|
72
72
|
|
|
73
73
|
let store = new Store();
|
|
74
74
|
|
|
75
|
-
const component = createTestRenderer(store, widget);
|
|
75
|
+
const component = await createTestRenderer(store, widget);
|
|
76
76
|
|
|
77
77
|
let tree = component.toJSON();
|
|
78
78
|
assert.equal(store.get("invalid"), false);
|
|
@@ -80,7 +80,7 @@ describe("ValidationGroup", () => {
|
|
|
80
80
|
assert.equal(store.get("invalid2"), false);
|
|
81
81
|
});
|
|
82
82
|
|
|
83
|
-
it("visited flag is propagated into nested validation groups", () => {
|
|
83
|
+
it("visited flag is propagated into nested validation groups", async () => {
|
|
84
84
|
let visited = false;
|
|
85
85
|
|
|
86
86
|
let widget = (
|
|
@@ -101,13 +101,13 @@ describe("ValidationGroup", () => {
|
|
|
101
101
|
|
|
102
102
|
let store = new Store();
|
|
103
103
|
|
|
104
|
-
const component = createTestRenderer(store, widget);
|
|
104
|
+
const component = await createTestRenderer(store, widget);
|
|
105
105
|
|
|
106
106
|
let tree = component.toJSON();
|
|
107
107
|
assert(visited);
|
|
108
108
|
});
|
|
109
109
|
|
|
110
|
-
it("disabled flag can be overruled by the field props", () => {
|
|
110
|
+
it("disabled flag can be overruled by the field props", async () => {
|
|
111
111
|
let widget = (
|
|
112
112
|
<cx>
|
|
113
113
|
<div>
|
|
@@ -120,13 +120,13 @@ describe("ValidationGroup", () => {
|
|
|
120
120
|
|
|
121
121
|
let store = new Store();
|
|
122
122
|
|
|
123
|
-
const component = createTestRenderer(store, widget);
|
|
123
|
+
const component = await createTestRenderer(store, widget);
|
|
124
124
|
|
|
125
125
|
let tree = component.toJSON();
|
|
126
126
|
assert.equal(store.get("invalid"), true);
|
|
127
127
|
});
|
|
128
128
|
|
|
129
|
-
it("strict flag is used to enforce disabled flag", () => {
|
|
129
|
+
it("strict flag is used to enforce disabled flag", async () => {
|
|
130
130
|
let widget = (
|
|
131
131
|
<cx>
|
|
132
132
|
<div>
|
|
@@ -139,7 +139,7 @@ describe("ValidationGroup", () => {
|
|
|
139
139
|
|
|
140
140
|
let store = new Store();
|
|
141
141
|
|
|
142
|
-
const component = createTestRenderer(store, widget);
|
|
142
|
+
const component = await createTestRenderer(store, widget);
|
|
143
143
|
|
|
144
144
|
let tree = component.toJSON();
|
|
145
145
|
assert.equal(store.get("invalid"), false);
|
|
@@ -8,7 +8,6 @@ import { addEventListenerWithOptions } from "../../util";
|
|
|
8
8
|
import type { RenderingContext } from "../../ui/RenderingContext";
|
|
9
9
|
import type { Instance } from "../../ui/Instance";
|
|
10
10
|
import type { CSS } from "../../ui/CSS";
|
|
11
|
-
import * as React from "react";
|
|
12
11
|
import { Prop, StructuredProp } from "../../ui/Prop";
|
|
13
12
|
|
|
14
13
|
export interface WheelConfig extends PureContainerConfig {
|