Skip to content

Commit c74443b

Browse files
committed
mjs
1 parent 6ba1f03 commit c74443b

File tree

10 files changed

+401
-19
lines changed

10 files changed

+401
-19
lines changed
Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
// Generated by ReScript, PLEASE EDIT WITH CARE
2+
3+
import * as Primitive_option from "rescript/lib/es6/Primitive_option.js";
4+
5+
let Root = {};
6+
7+
let Client = {
8+
Root: Root
9+
};
10+
11+
function getString(formData, name) {
12+
let value = formData.get(name);
13+
if (!(value == null) && typeof value === "string") {
14+
return Primitive_option.some(value);
15+
}
16+
17+
}
18+
19+
function getFile(formData, name) {
20+
let value = formData.get(name);
21+
if (!(value == null) && typeof value !== "string") {
22+
return Primitive_option.some(value);
23+
}
24+
25+
}
26+
27+
function getAll(t, string) {
28+
return t.getAll(string).map(value => {
29+
if (typeof value === "string") {
30+
return {
31+
TAG: "String",
32+
_0: value
33+
};
34+
} else {
35+
return {
36+
TAG: "File",
37+
_0: value
38+
};
39+
}
40+
});
41+
}
42+
43+
let FormData = {
44+
getString: getString,
45+
getFile: getFile,
46+
getAll: getAll
47+
};
48+
49+
let Ref = {};
50+
51+
let Style;
52+
53+
export {
54+
Client,
55+
FormData,
56+
Ref,
57+
Style,
58+
}
59+
/* No side effect */

tests/dependencies/rescript-react/src/ReactDOM.res.js

Lines changed: 0 additions & 19 deletions
This file was deleted.
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
// Generated by ReScript, PLEASE EDIT WITH CARE
2+
/* This output is empty. Its source's type definitions, externals and/or unused code got optimized away. */
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
// Generated by ReScript, PLEASE EDIT WITH CARE
2+
/* This output is empty. Its source's type definitions, externals and/or unused code got optimized away. */
Lines changed: 100 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,100 @@
1+
// Generated by ReScript, PLEASE EDIT WITH CARE
2+
3+
import * as Primitive_option from "rescript/lib/es6/Primitive_option.js";
4+
import * as TestUtils from "react-dom/test-utils";
5+
6+
function act(func) {
7+
let reactFunc = () => {
8+
func();
9+
};
10+
TestUtils.act(reactFunc);
11+
}
12+
13+
function actAsync(func) {
14+
return TestUtils.act(() => func());
15+
}
16+
17+
function changeWithValue(element, value) {
18+
let event = {
19+
target: {
20+
value: value
21+
}
22+
};
23+
TestUtils.Simulate.change(element, event);
24+
}
25+
26+
function changeWithChecked(element, value) {
27+
let event = {
28+
target: {
29+
checked: value
30+
}
31+
};
32+
TestUtils.Simulate.change(element, event);
33+
}
34+
35+
let Simulate = {
36+
changeWithValue: changeWithValue,
37+
changeWithChecked: changeWithChecked
38+
};
39+
40+
function findBySelector(element, selector) {
41+
return element.querySelector(selector);
42+
}
43+
44+
function findByAllSelector(element, selector) {
45+
return Array.from(element.querySelectorAll(selector));
46+
}
47+
48+
function findBySelectorAndTextContent(element, selector, content) {
49+
return Array.from(element.querySelectorAll(selector)).find(node => node.textContent === content);
50+
}
51+
52+
function findBySelectorAndPartialTextContent(element, selector, content) {
53+
return Array.from(element.querySelectorAll(selector)).find(node => node.textContent.includes(content));
54+
}
55+
56+
let DOM = {
57+
findBySelector: findBySelector,
58+
findByAllSelector: findByAllSelector,
59+
findBySelectorAndTextContent: findBySelectorAndTextContent,
60+
findBySelectorAndPartialTextContent: findBySelectorAndPartialTextContent
61+
};
62+
63+
function prepareContainer(container, param) {
64+
let containerElement = document.createElement("div");
65+
let body = document.body;
66+
if (body !== undefined) {
67+
Primitive_option.valFromOption(body).appendChild(containerElement);
68+
}
69+
container.contents = Primitive_option.some(containerElement);
70+
}
71+
72+
function cleanupContainer(container, param) {
73+
let contents = container.contents;
74+
if (contents !== undefined) {
75+
Primitive_option.valFromOption(contents).remove();
76+
}
77+
container.contents = undefined;
78+
}
79+
80+
function getContainer(container) {
81+
let contents = container.contents;
82+
if (contents !== undefined) {
83+
return Primitive_option.valFromOption(contents);
84+
}
85+
throw {
86+
RE_EXN_ID: "Not_found",
87+
Error: new Error()
88+
};
89+
}
90+
91+
export {
92+
act,
93+
actAsync,
94+
Simulate,
95+
DOM,
96+
prepareContainer,
97+
cleanupContainer,
98+
getContainer,
99+
}
100+
/* react-dom/test-utils Not a pure module */
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
// Generated by ReScript, PLEASE EDIT WITH CARE
2+
3+
import * as React from "react";
4+
5+
let noOp = (function (_x) {});
6+
7+
let reactComponentClass = React.Component;
8+
9+
noOp(reactComponentClass);
10+
11+
var ErrorBoundary = (function (Component) {
12+
function ErrorBoundary(props) {
13+
Component.call(this);
14+
this.state = { error: undefined };
15+
}
16+
ErrorBoundary.prototype = Object.create(Component.prototype);
17+
ErrorBoundary.prototype.componentDidCatch = function (error, info) {
18+
this.setState({ error: { error: error, info: info } });
19+
};
20+
ErrorBoundary.prototype.render = function () {
21+
return this.state.error != undefined
22+
? this.props.fallback(this.state.error)
23+
: this.props.children;
24+
};
25+
return ErrorBoundary;
26+
})(reactComponentClass);
27+
;
28+
29+
function make(prim0, prim1) {
30+
return ErrorBoundary(prim0, prim1);
31+
}
32+
33+
export {
34+
make,
35+
}
36+
/* reactComponentClass Not a pure module */

0 commit comments

Comments
 (0)