mol_tree2 1.0.213 → 1.0.215
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/node.deps.json +1 -1
- package/node.js +13 -13
- package/node.js.map +1 -1
- package/node.mjs +13 -13
- package/node.mjs.map +1 -1
- package/node.test.js +245 -245
- package/node.test.js.map +1 -1
- package/package.json +1 -1
- package/web.deps.json +1 -1
- package/web.js +13 -13
- package/web.js.map +1 -1
- package/web.mjs +13 -13
- package/web.mjs.map +1 -1
- package/web.test.js +246 -246
- package/web.test.js.map +1 -1
package/node.test.js
CHANGED
|
@@ -1,4 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
"use strict";
|
|
3
|
+
Error.stackTraceLimit = 50;
|
|
4
|
+
var $;
|
|
5
|
+
(function ($) {
|
|
6
|
+
})($ || ($ = {}));
|
|
7
|
+
module.exports = $;
|
|
8
|
+
//mam.ts
|
|
9
|
+
;
|
|
2
10
|
"use strict"
|
|
3
11
|
|
|
4
12
|
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
@@ -11,14 +19,6 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
11
19
|
var $ = ( typeof module === 'object' ) ? ( module['export'+'s'] = globalThis ) : globalThis
|
|
12
20
|
$.$$ = $
|
|
13
21
|
|
|
14
|
-
;
|
|
15
|
-
"use strict";
|
|
16
|
-
Error.stackTraceLimit = 50;
|
|
17
|
-
var $;
|
|
18
|
-
(function ($) {
|
|
19
|
-
})($ || ($ = {}));
|
|
20
|
-
module.exports = $;
|
|
21
|
-
//mam.ts
|
|
22
22
|
;
|
|
23
23
|
"use strict";
|
|
24
24
|
var $;
|
|
@@ -1311,16 +1311,6 @@ var $;
|
|
|
1311
1311
|
;
|
|
1312
1312
|
"use strict";
|
|
1313
1313
|
var $;
|
|
1314
|
-
(function ($) {
|
|
1315
|
-
function $mol_test_complete() {
|
|
1316
|
-
process.exit(0);
|
|
1317
|
-
}
|
|
1318
|
-
$.$mol_test_complete = $mol_test_complete;
|
|
1319
|
-
})($ || ($ = {}));
|
|
1320
|
-
//mol/test/test.node.test.ts
|
|
1321
|
-
;
|
|
1322
|
-
"use strict";
|
|
1323
|
-
var $;
|
|
1324
1314
|
(function ($_1) {
|
|
1325
1315
|
function $mol_test(set) {
|
|
1326
1316
|
for (let name in set) {
|
|
@@ -1408,6 +1398,16 @@ var $;
|
|
|
1408
1398
|
;
|
|
1409
1399
|
"use strict";
|
|
1410
1400
|
var $;
|
|
1401
|
+
(function ($) {
|
|
1402
|
+
function $mol_test_complete() {
|
|
1403
|
+
process.exit(0);
|
|
1404
|
+
}
|
|
1405
|
+
$.$mol_test_complete = $mol_test_complete;
|
|
1406
|
+
})($ || ($ = {}));
|
|
1407
|
+
//mol/test/test.node.test.ts
|
|
1408
|
+
;
|
|
1409
|
+
"use strict";
|
|
1410
|
+
var $;
|
|
1411
1411
|
(function ($) {
|
|
1412
1412
|
})($ || ($ = {}));
|
|
1413
1413
|
//mol/dom/context/context.ts
|
|
@@ -1673,9 +1673,6 @@ var $;
|
|
|
1673
1673
|
//mol/dom/render/children/children.ts
|
|
1674
1674
|
;
|
|
1675
1675
|
"use strict";
|
|
1676
|
-
//mol/type/partial/deep/deep.ts
|
|
1677
|
-
;
|
|
1678
|
-
"use strict";
|
|
1679
1676
|
//mol/type/error/error.ts
|
|
1680
1677
|
;
|
|
1681
1678
|
"use strict";
|
|
@@ -1691,97 +1688,10 @@ var $;
|
|
|
1691
1688
|
//mol/type/equals/equals.test.ts
|
|
1692
1689
|
;
|
|
1693
1690
|
"use strict";
|
|
1694
|
-
//mol/type/partial/deep/deep.
|
|
1691
|
+
//mol/type/partial/deep/deep.ts
|
|
1695
1692
|
;
|
|
1696
1693
|
"use strict";
|
|
1697
|
-
|
|
1698
|
-
(function ($) {
|
|
1699
|
-
$mol_test({
|
|
1700
|
-
'Make empty div'() {
|
|
1701
|
-
$mol_assert_equal(($mol_jsx("div", null)).outerHTML, '<div></div>');
|
|
1702
|
-
},
|
|
1703
|
-
'Define native field'() {
|
|
1704
|
-
const dom = $mol_jsx("input", { value: '123' });
|
|
1705
|
-
$mol_assert_equal(dom.outerHTML, '<input value="123">');
|
|
1706
|
-
$mol_assert_equal(dom.value, '123');
|
|
1707
|
-
},
|
|
1708
|
-
'Define classes'() {
|
|
1709
|
-
const dom = $mol_jsx("div", { class: 'foo bar' });
|
|
1710
|
-
$mol_assert_equal(dom.outerHTML, '<div class="foo bar"></div>');
|
|
1711
|
-
},
|
|
1712
|
-
'Define styles'() {
|
|
1713
|
-
const dom = $mol_jsx("div", { style: { color: 'red' } });
|
|
1714
|
-
$mol_assert_equal(dom.outerHTML, '<div style="color: red;"></div>');
|
|
1715
|
-
},
|
|
1716
|
-
'Define dataset'() {
|
|
1717
|
-
const dom = $mol_jsx("div", { dataset: { foo: 'bar' } });
|
|
1718
|
-
$mol_assert_equal(dom.outerHTML, '<div data-foo="bar"></div>');
|
|
1719
|
-
},
|
|
1720
|
-
'Define attributes'() {
|
|
1721
|
-
const dom = $mol_jsx("div", { lang: "ru", hidden: true });
|
|
1722
|
-
$mol_assert_equal(dom.outerHTML, '<div lang="ru" hidden=""></div>');
|
|
1723
|
-
},
|
|
1724
|
-
'Define child nodes'() {
|
|
1725
|
-
const dom = $mol_jsx("div", null,
|
|
1726
|
-
"hello",
|
|
1727
|
-
$mol_jsx("strong", null, "world"),
|
|
1728
|
-
"!");
|
|
1729
|
-
$mol_assert_equal(dom.outerHTML, '<div>hello<strong>world</strong>!</div>');
|
|
1730
|
-
},
|
|
1731
|
-
'Function as component'() {
|
|
1732
|
-
const Button = (props, target) => {
|
|
1733
|
-
return $mol_jsx("button", { title: props.hint }, target());
|
|
1734
|
-
};
|
|
1735
|
-
const dom = $mol_jsx(Button, { id: "foo", hint: "click me" }, () => 'hey!');
|
|
1736
|
-
$mol_assert_equal(dom.outerHTML, '<button id="foo" title="click me" class="Button">hey!</button>');
|
|
1737
|
-
},
|
|
1738
|
-
'Nested guid generation'() {
|
|
1739
|
-
const Foo = () => {
|
|
1740
|
-
return $mol_jsx("div", null,
|
|
1741
|
-
$mol_jsx(Bar, { id: "bar" },
|
|
1742
|
-
$mol_jsx("img", { id: "icon" })));
|
|
1743
|
-
};
|
|
1744
|
-
const Bar = (props, icon) => {
|
|
1745
|
-
return $mol_jsx("span", null,
|
|
1746
|
-
icon,
|
|
1747
|
-
$mol_jsx("i", { id: "label" }));
|
|
1748
|
-
};
|
|
1749
|
-
const dom = $mol_jsx(Foo, { id: "foo" });
|
|
1750
|
-
$mol_assert_equal(dom.outerHTML, '<div id="foo" class="Foo"><span id="foo/bar" class="Foo_bar Bar"><img id="foo/icon" class="Foo_icon"><i id="foo/bar/label" class="Foo_bar_label Bar_label"></i></span></div>');
|
|
1751
|
-
},
|
|
1752
|
-
'Fail on non unique ids'() {
|
|
1753
|
-
const App = () => {
|
|
1754
|
-
return $mol_jsx("div", null,
|
|
1755
|
-
$mol_jsx("span", { id: "bar" }),
|
|
1756
|
-
$mol_jsx("span", { id: "bar" }));
|
|
1757
|
-
};
|
|
1758
|
-
$mol_assert_fail(() => $mol_jsx(App, { id: "foo" }), 'JSX already has tag with id "foo/bar"');
|
|
1759
|
-
},
|
|
1760
|
-
'Owner based guid generationn'() {
|
|
1761
|
-
const Foo = () => {
|
|
1762
|
-
return $mol_jsx("div", null,
|
|
1763
|
-
$mol_jsx(Bar, { id: "middle", icon: () => $mol_jsx("img", { id: "icon" }) }));
|
|
1764
|
-
};
|
|
1765
|
-
const Bar = (props) => {
|
|
1766
|
-
return $mol_jsx("span", null, props.icon());
|
|
1767
|
-
};
|
|
1768
|
-
const dom = $mol_jsx(Foo, { id: "app" });
|
|
1769
|
-
$mol_assert_equal(dom.outerHTML, '<div id="app" class="Foo"><span id="app/middle" class="Foo_middle Bar"><img id="app/icon" class="Foo_icon"></span></div>');
|
|
1770
|
-
},
|
|
1771
|
-
'Fail on same ids from different caller'() {
|
|
1772
|
-
const Foo = () => {
|
|
1773
|
-
return $mol_jsx("div", null,
|
|
1774
|
-
$mol_jsx("img", { id: "icon" }),
|
|
1775
|
-
$mol_jsx(Bar, { id: "bar", icon: () => $mol_jsx("img", { id: "icon" }) }));
|
|
1776
|
-
};
|
|
1777
|
-
const Bar = (props) => {
|
|
1778
|
-
return $mol_jsx("span", null, props.icon());
|
|
1779
|
-
};
|
|
1780
|
-
$mol_assert_fail(() => $mol_jsx(Foo, { id: "foo" }), 'JSX already has tag with id "foo/icon"');
|
|
1781
|
-
},
|
|
1782
|
-
});
|
|
1783
|
-
})($ || ($ = {}));
|
|
1784
|
-
//mol/jsx/jsx.test.tsx
|
|
1694
|
+
//mol/type/partial/deep/deep.test.ts
|
|
1785
1695
|
;
|
|
1786
1696
|
"use strict";
|
|
1787
1697
|
var $;
|
|
@@ -1908,97 +1818,91 @@ var $;
|
|
|
1908
1818
|
var $;
|
|
1909
1819
|
(function ($) {
|
|
1910
1820
|
$mol_test({
|
|
1911
|
-
'
|
|
1912
|
-
$
|
|
1913
|
-
$mol_assert_ok($mol_compare_deep(undefined, undefined));
|
|
1914
|
-
$mol_assert_not($mol_compare_deep(undefined, null));
|
|
1915
|
-
$mol_assert_not($mol_compare_deep({}, null));
|
|
1916
|
-
},
|
|
1917
|
-
'number'() {
|
|
1918
|
-
$mol_assert_ok($mol_compare_deep(1, 1));
|
|
1919
|
-
$mol_assert_ok($mol_compare_deep(Number.NaN, Number.NaN));
|
|
1920
|
-
$mol_assert_not($mol_compare_deep(1, 2));
|
|
1921
|
-
$mol_assert_ok($mol_compare_deep(Object(1), Object(1)));
|
|
1922
|
-
$mol_assert_not($mol_compare_deep(Object(1), Object(2)));
|
|
1821
|
+
'Make empty div'() {
|
|
1822
|
+
$mol_assert_equal(($mol_jsx("div", null)).outerHTML, '<div></div>');
|
|
1923
1823
|
},
|
|
1924
|
-
'
|
|
1925
|
-
$
|
|
1926
|
-
$
|
|
1927
|
-
$
|
|
1928
|
-
$mol_assert_not($mol_compare_deep({}, { a: undefined }));
|
|
1929
|
-
$mol_assert_ok($mol_compare_deep({ a: 1, b: 2 }, { b: 2, a: 1 }));
|
|
1930
|
-
$mol_assert_ok($mol_compare_deep({ a: { b: 1 } }, { a: { b: 1 } }));
|
|
1824
|
+
'Define native field'() {
|
|
1825
|
+
const dom = $mol_jsx("input", { value: '123' });
|
|
1826
|
+
$mol_assert_equal(dom.outerHTML, '<input value="123">');
|
|
1827
|
+
$mol_assert_equal(dom.value, '123');
|
|
1931
1828
|
},
|
|
1932
|
-
'
|
|
1933
|
-
$
|
|
1934
|
-
$
|
|
1935
|
-
$mol_assert_not($mol_compare_deep([1, 2], [1, 3]));
|
|
1936
|
-
$mol_assert_not($mol_compare_deep([1, 2,], [1, 3, undefined]));
|
|
1829
|
+
'Define classes'() {
|
|
1830
|
+
const dom = $mol_jsx("div", { class: 'foo bar' });
|
|
1831
|
+
$mol_assert_equal(dom.outerHTML, '<div class="foo bar"></div>');
|
|
1937
1832
|
},
|
|
1938
|
-
'
|
|
1939
|
-
|
|
1940
|
-
|
|
1941
|
-
$mol_assert_not($mol_compare_deep(new Thing, new Thing));
|
|
1942
|
-
$mol_assert_not($mol_compare_deep(() => 1, () => 1));
|
|
1943
|
-
$mol_assert_not($mol_compare_deep(new RangeError('Test error'), new RangeError('Test error')));
|
|
1833
|
+
'Define styles'() {
|
|
1834
|
+
const dom = $mol_jsx("div", { style: { color: 'red' } });
|
|
1835
|
+
$mol_assert_equal(dom.outerHTML, '<div style="color: red;"></div>');
|
|
1944
1836
|
},
|
|
1945
|
-
'
|
|
1946
|
-
const
|
|
1947
|
-
|
|
1948
|
-
const b = { foo: {} };
|
|
1949
|
-
b['self'] = b;
|
|
1950
|
-
$mol_assert_ok($mol_compare_deep(a, b));
|
|
1837
|
+
'Define dataset'() {
|
|
1838
|
+
const dom = $mol_jsx("div", { dataset: { foo: 'bar' } });
|
|
1839
|
+
$mol_assert_equal(dom.outerHTML, '<div data-foo="bar"></div>');
|
|
1951
1840
|
},
|
|
1952
|
-
'
|
|
1953
|
-
$
|
|
1954
|
-
$
|
|
1841
|
+
'Define attributes'() {
|
|
1842
|
+
const dom = $mol_jsx("div", { lang: "ru", hidden: true });
|
|
1843
|
+
$mol_assert_equal(dom.outerHTML, '<div lang="ru" hidden=""></div>');
|
|
1955
1844
|
},
|
|
1956
|
-
'
|
|
1957
|
-
$
|
|
1958
|
-
|
|
1959
|
-
|
|
1845
|
+
'Define child nodes'() {
|
|
1846
|
+
const dom = $mol_jsx("div", null,
|
|
1847
|
+
"hello",
|
|
1848
|
+
$mol_jsx("strong", null, "world"),
|
|
1849
|
+
"!");
|
|
1850
|
+
$mol_assert_equal(dom.outerHTML, '<div>hello<strong>world</strong>!</div>');
|
|
1960
1851
|
},
|
|
1961
|
-
'
|
|
1962
|
-
|
|
1963
|
-
|
|
1964
|
-
|
|
1965
|
-
$
|
|
1852
|
+
'Function as component'() {
|
|
1853
|
+
const Button = (props, target) => {
|
|
1854
|
+
return $mol_jsx("button", { title: props.hint }, target());
|
|
1855
|
+
};
|
|
1856
|
+
const dom = $mol_jsx(Button, { id: "foo", hint: "click me" }, () => 'hey!');
|
|
1857
|
+
$mol_assert_equal(dom.outerHTML, '<button id="foo" title="click me" class="Button">hey!</button>');
|
|
1966
1858
|
},
|
|
1967
|
-
'
|
|
1968
|
-
|
|
1969
|
-
|
|
1970
|
-
|
|
1971
|
-
|
|
1972
|
-
|
|
1859
|
+
'Nested guid generation'() {
|
|
1860
|
+
const Foo = () => {
|
|
1861
|
+
return $mol_jsx("div", null,
|
|
1862
|
+
$mol_jsx(Bar, { id: "bar" },
|
|
1863
|
+
$mol_jsx("img", { id: "icon" })));
|
|
1864
|
+
};
|
|
1865
|
+
const Bar = (props, icon) => {
|
|
1866
|
+
return $mol_jsx("span", null,
|
|
1867
|
+
icon,
|
|
1868
|
+
$mol_jsx("i", { id: "label" }));
|
|
1869
|
+
};
|
|
1870
|
+
const dom = $mol_jsx(Foo, { id: "foo" });
|
|
1871
|
+
$mol_assert_equal(dom.outerHTML, '<div id="foo" class="Foo"><span id="foo/bar" class="Foo_bar Bar"><img id="foo/icon" class="Foo_icon"><i id="foo/bar/label" class="Foo_bar_label Bar_label"></i></span></div>');
|
|
1973
1872
|
},
|
|
1974
|
-
'
|
|
1975
|
-
|
|
1976
|
-
|
|
1977
|
-
|
|
1873
|
+
'Fail on non unique ids'() {
|
|
1874
|
+
const App = () => {
|
|
1875
|
+
return $mol_jsx("div", null,
|
|
1876
|
+
$mol_jsx("span", { id: "bar" }),
|
|
1877
|
+
$mol_jsx("span", { id: "bar" }));
|
|
1878
|
+
};
|
|
1879
|
+
$mol_assert_fail(() => $mol_jsx(App, { id: "foo" }), 'JSX already has tag with id "foo/bar"');
|
|
1978
1880
|
},
|
|
1979
|
-
'
|
|
1980
|
-
|
|
1981
|
-
|
|
1982
|
-
|
|
1881
|
+
'Owner based guid generationn'() {
|
|
1882
|
+
const Foo = () => {
|
|
1883
|
+
return $mol_jsx("div", null,
|
|
1884
|
+
$mol_jsx(Bar, { id: "middle", icon: () => $mol_jsx("img", { id: "icon" }) }));
|
|
1885
|
+
};
|
|
1886
|
+
const Bar = (props) => {
|
|
1887
|
+
return $mol_jsx("span", null, props.icon());
|
|
1888
|
+
};
|
|
1889
|
+
const dom = $mol_jsx(Foo, { id: "app" });
|
|
1890
|
+
$mol_assert_equal(dom.outerHTML, '<div id="app" class="Foo"><span id="app/middle" class="Foo_middle Bar"><img id="app/icon" class="Foo_icon"></span></div>');
|
|
1983
1891
|
},
|
|
1984
|
-
'
|
|
1985
|
-
|
|
1986
|
-
|
|
1987
|
-
|
|
1988
|
-
|
|
1989
|
-
|
|
1990
|
-
|
|
1991
|
-
|
|
1992
|
-
|
|
1993
|
-
|
|
1994
|
-
}
|
|
1995
|
-
}
|
|
1996
|
-
$mol_assert_ok($mol_compare_deep(new User('Jin'), new User('Jin')));
|
|
1997
|
-
$mol_assert_not($mol_compare_deep(new User('Jin'), new User('John')));
|
|
1892
|
+
'Fail on same ids from different caller'() {
|
|
1893
|
+
const Foo = () => {
|
|
1894
|
+
return $mol_jsx("div", null,
|
|
1895
|
+
$mol_jsx("img", { id: "icon" }),
|
|
1896
|
+
$mol_jsx(Bar, { id: "bar", icon: () => $mol_jsx("img", { id: "icon" }) }));
|
|
1897
|
+
};
|
|
1898
|
+
const Bar = (props) => {
|
|
1899
|
+
return $mol_jsx("span", null, props.icon());
|
|
1900
|
+
};
|
|
1901
|
+
$mol_assert_fail(() => $mol_jsx(Foo, { id: "foo" }), 'JSX already has tag with id "foo/icon"');
|
|
1998
1902
|
},
|
|
1999
1903
|
});
|
|
2000
1904
|
})($ || ($ = {}));
|
|
2001
|
-
//mol/
|
|
1905
|
+
//mol/jsx/jsx.test.tsx
|
|
2002
1906
|
;
|
|
2003
1907
|
"use strict";
|
|
2004
1908
|
var $;
|
|
@@ -2127,6 +2031,102 @@ var $;
|
|
|
2127
2031
|
;
|
|
2128
2032
|
"use strict";
|
|
2129
2033
|
var $;
|
|
2034
|
+
(function ($) {
|
|
2035
|
+
$mol_test({
|
|
2036
|
+
'nulls & undefineds'() {
|
|
2037
|
+
$mol_assert_ok($mol_compare_deep(null, null));
|
|
2038
|
+
$mol_assert_ok($mol_compare_deep(undefined, undefined));
|
|
2039
|
+
$mol_assert_not($mol_compare_deep(undefined, null));
|
|
2040
|
+
$mol_assert_not($mol_compare_deep({}, null));
|
|
2041
|
+
},
|
|
2042
|
+
'number'() {
|
|
2043
|
+
$mol_assert_ok($mol_compare_deep(1, 1));
|
|
2044
|
+
$mol_assert_ok($mol_compare_deep(Number.NaN, Number.NaN));
|
|
2045
|
+
$mol_assert_not($mol_compare_deep(1, 2));
|
|
2046
|
+
$mol_assert_ok($mol_compare_deep(Object(1), Object(1)));
|
|
2047
|
+
$mol_assert_not($mol_compare_deep(Object(1), Object(2)));
|
|
2048
|
+
},
|
|
2049
|
+
'POJO'() {
|
|
2050
|
+
$mol_assert_ok($mol_compare_deep({}, {}));
|
|
2051
|
+
$mol_assert_not($mol_compare_deep({ a: 1 }, { b: 2 }));
|
|
2052
|
+
$mol_assert_not($mol_compare_deep({ a: 1 }, { a: 2 }));
|
|
2053
|
+
$mol_assert_not($mol_compare_deep({}, { a: undefined }));
|
|
2054
|
+
$mol_assert_ok($mol_compare_deep({ a: 1, b: 2 }, { b: 2, a: 1 }));
|
|
2055
|
+
$mol_assert_ok($mol_compare_deep({ a: { b: 1 } }, { a: { b: 1 } }));
|
|
2056
|
+
},
|
|
2057
|
+
'Array'() {
|
|
2058
|
+
$mol_assert_ok($mol_compare_deep([], []));
|
|
2059
|
+
$mol_assert_ok($mol_compare_deep([1, [2]], [1, [2]]));
|
|
2060
|
+
$mol_assert_not($mol_compare_deep([1, 2], [1, 3]));
|
|
2061
|
+
$mol_assert_not($mol_compare_deep([1, 2,], [1, 3, undefined]));
|
|
2062
|
+
},
|
|
2063
|
+
'Non POJO are different'() {
|
|
2064
|
+
class Thing extends Object {
|
|
2065
|
+
}
|
|
2066
|
+
$mol_assert_not($mol_compare_deep(new Thing, new Thing));
|
|
2067
|
+
$mol_assert_not($mol_compare_deep(() => 1, () => 1));
|
|
2068
|
+
$mol_assert_not($mol_compare_deep(new RangeError('Test error'), new RangeError('Test error')));
|
|
2069
|
+
},
|
|
2070
|
+
'same POJOs with cyclic reference'() {
|
|
2071
|
+
const a = { foo: {} };
|
|
2072
|
+
a['self'] = a;
|
|
2073
|
+
const b = { foo: {} };
|
|
2074
|
+
b['self'] = b;
|
|
2075
|
+
$mol_assert_ok($mol_compare_deep(a, b));
|
|
2076
|
+
},
|
|
2077
|
+
'Date'() {
|
|
2078
|
+
$mol_assert_ok($mol_compare_deep(new Date(12345), new Date(12345)));
|
|
2079
|
+
$mol_assert_not($mol_compare_deep(new Date(12345), new Date(12346)));
|
|
2080
|
+
},
|
|
2081
|
+
'RegExp'() {
|
|
2082
|
+
$mol_assert_ok($mol_compare_deep(/\x22/mig, /\x22/mig));
|
|
2083
|
+
$mol_assert_not($mol_compare_deep(/\x22/mig, /\x21/mig));
|
|
2084
|
+
$mol_assert_not($mol_compare_deep(/\x22/mig, /\x22/mg));
|
|
2085
|
+
},
|
|
2086
|
+
'Error'() {
|
|
2087
|
+
$mol_assert_not($mol_compare_deep(new Error('xxx'), new Error('xxx')));
|
|
2088
|
+
const fail = (message) => new Error(message);
|
|
2089
|
+
$mol_assert_ok($mol_compare_deep(...['xxx', 'xxx'].map(msg => new Error(msg))));
|
|
2090
|
+
$mol_assert_not($mol_compare_deep(...['xxx', 'yyy'].map(msg => new Error(msg))));
|
|
2091
|
+
},
|
|
2092
|
+
'Map'() {
|
|
2093
|
+
$mol_assert_ok($mol_compare_deep(new Map, new Map));
|
|
2094
|
+
$mol_assert_ok($mol_compare_deep(new Map([[1, [2]]]), new Map([[1, [2]]])));
|
|
2095
|
+
$mol_assert_ok($mol_compare_deep(new Map([[[1], 2]]), new Map([[[1], 2]])));
|
|
2096
|
+
$mol_assert_not($mol_compare_deep(new Map([[1, 2]]), new Map([[1, 3]])));
|
|
2097
|
+
$mol_assert_not($mol_compare_deep(new Map([[[1], 2]]), new Map([[[3], 2]])));
|
|
2098
|
+
},
|
|
2099
|
+
'Set'() {
|
|
2100
|
+
$mol_assert_ok($mol_compare_deep(new Set, new Set));
|
|
2101
|
+
$mol_assert_ok($mol_compare_deep(new Set([1, [2]]), new Set([1, [2]])));
|
|
2102
|
+
$mol_assert_not($mol_compare_deep(new Set([1]), new Set([2])));
|
|
2103
|
+
},
|
|
2104
|
+
'Uint8Array'() {
|
|
2105
|
+
$mol_assert_ok($mol_compare_deep(new Uint8Array, new Uint8Array));
|
|
2106
|
+
$mol_assert_ok($mol_compare_deep(new Uint8Array([0]), new Uint8Array([0])));
|
|
2107
|
+
$mol_assert_not($mol_compare_deep(new Uint8Array([0]), new Uint8Array([1])));
|
|
2108
|
+
},
|
|
2109
|
+
'Custom comparator'() {
|
|
2110
|
+
class User {
|
|
2111
|
+
name;
|
|
2112
|
+
rand;
|
|
2113
|
+
constructor(name, rand = Math.random()) {
|
|
2114
|
+
this.name = name;
|
|
2115
|
+
this.rand = rand;
|
|
2116
|
+
}
|
|
2117
|
+
[Symbol.toPrimitive](mode) {
|
|
2118
|
+
return this.name;
|
|
2119
|
+
}
|
|
2120
|
+
}
|
|
2121
|
+
$mol_assert_ok($mol_compare_deep(new User('Jin'), new User('Jin')));
|
|
2122
|
+
$mol_assert_not($mol_compare_deep(new User('Jin'), new User('John')));
|
|
2123
|
+
},
|
|
2124
|
+
});
|
|
2125
|
+
})($ || ($ = {}));
|
|
2126
|
+
//mol/compare/deep/deep.test.tsx
|
|
2127
|
+
;
|
|
2128
|
+
"use strict";
|
|
2129
|
+
var $;
|
|
2130
2130
|
(function ($) {
|
|
2131
2131
|
function $mol_dom_serialize(node) {
|
|
2132
2132
|
const serializer = new $mol_dom_context.XMLSerializer;
|
|
@@ -2818,64 +2818,6 @@ var $;
|
|
|
2818
2818
|
;
|
|
2819
2819
|
"use strict";
|
|
2820
2820
|
var $;
|
|
2821
|
-
(function ($_1) {
|
|
2822
|
-
$mol_test({
|
|
2823
|
-
'inserting'($) {
|
|
2824
|
-
$mol_assert_equal($.$mol_tree2_from_string('a b c d\n')
|
|
2825
|
-
.insert($mol_tree2.struct('x'), 'a', 'b', 'c')
|
|
2826
|
-
.toString(), 'a b x\n');
|
|
2827
|
-
$mol_assert_equal($.$mol_tree2_from_string('a b\n')
|
|
2828
|
-
.insert($mol_tree2.struct('x'), 'a', 'b', 'c', 'd')
|
|
2829
|
-
.toString(), 'a b c x\n');
|
|
2830
|
-
$mol_assert_equal($.$mol_tree2_from_string('a b c d\n')
|
|
2831
|
-
.insert($mol_tree2.struct('x'), 0, 0, 0)
|
|
2832
|
-
.toString(), 'a b x\n');
|
|
2833
|
-
$mol_assert_equal($.$mol_tree2_from_string('a b\n')
|
|
2834
|
-
.insert($mol_tree2.struct('x'), 0, 0, 0, 0)
|
|
2835
|
-
.toString(), 'a b \\\n\tx\n');
|
|
2836
|
-
$mol_assert_equal($.$mol_tree2_from_string('a b c d\n')
|
|
2837
|
-
.insert($mol_tree2.struct('x'), null, null, null)
|
|
2838
|
-
.toString(), 'a b x\n');
|
|
2839
|
-
$mol_assert_equal($.$mol_tree2_from_string('a b\n')
|
|
2840
|
-
.insert($mol_tree2.struct('x'), null, null, null, null)
|
|
2841
|
-
.toString(), 'a b \\\n\tx\n');
|
|
2842
|
-
},
|
|
2843
|
-
'deleting'($) {
|
|
2844
|
-
$mol_assert_equal($.$mol_tree2_from_string('a b c d\n')
|
|
2845
|
-
.insert(null, 'a', 'b', 'c')
|
|
2846
|
-
.toString(), 'a b\n');
|
|
2847
|
-
$mol_assert_equal($.$mol_tree2_from_string('a b c d\n')
|
|
2848
|
-
.insert(null, 0, 0, 0)
|
|
2849
|
-
.toString(), 'a b\n');
|
|
2850
|
-
},
|
|
2851
|
-
'hack'($) {
|
|
2852
|
-
const res = $.$mol_tree2_from_string(`foo bar xxx\n`)
|
|
2853
|
-
.hack({
|
|
2854
|
-
'bar': (input, belt) => [input.struct('777', input.hack(belt))],
|
|
2855
|
-
});
|
|
2856
|
-
$mol_assert_equal(res.toString(), 'foo 777 xxx\n');
|
|
2857
|
-
},
|
|
2858
|
-
});
|
|
2859
|
-
})($ || ($ = {}));
|
|
2860
|
-
//mol/tree2/tree2.test.ts
|
|
2861
|
-
;
|
|
2862
|
-
"use strict";
|
|
2863
|
-
var $;
|
|
2864
|
-
(function ($) {
|
|
2865
|
-
$mol_test({
|
|
2866
|
-
'fromJSON'() {
|
|
2867
|
-
$mol_assert_equal($mol_tree2_from_json([]).toString(), '/\n');
|
|
2868
|
-
$mol_assert_equal($mol_tree2_from_json([false, true]).toString(), '/\n\tfalse\n\ttrue\n');
|
|
2869
|
-
$mol_assert_equal($mol_tree2_from_json([0, 1, 2.3]).toString(), '/\n\t0\n\t1\n\t2.3\n');
|
|
2870
|
-
$mol_assert_equal($mol_tree2_from_json(['', 'foo', 'bar\nbaz']).toString(), '/\n\t\\\n\t\\foo\n\t\\\n\t\t\\bar\n\t\t\\baz\n');
|
|
2871
|
-
$mol_assert_equal($mol_tree2_from_json({ 'foo': false, 'bar\nbaz': 'lol' }).toString(), '*\n\tfoo false\n\t\\\n\t\t\\bar\n\t\t\\baz\n\t\t\\lol\n');
|
|
2872
|
-
},
|
|
2873
|
-
});
|
|
2874
|
-
})($ || ($ = {}));
|
|
2875
|
-
//mol/tree2/from/json/json.test.ts
|
|
2876
|
-
;
|
|
2877
|
-
"use strict";
|
|
2878
|
-
var $;
|
|
2879
2821
|
(function ($_1) {
|
|
2880
2822
|
$mol_test({
|
|
2881
2823
|
'tree parsing'($) {
|
|
@@ -2939,6 +2881,64 @@ var $;
|
|
|
2939
2881
|
//mol/tree2/from/string/string.test.ts
|
|
2940
2882
|
;
|
|
2941
2883
|
"use strict";
|
|
2884
|
+
var $;
|
|
2885
|
+
(function ($_1) {
|
|
2886
|
+
$mol_test({
|
|
2887
|
+
'inserting'($) {
|
|
2888
|
+
$mol_assert_equal($.$mol_tree2_from_string('a b c d\n')
|
|
2889
|
+
.insert($mol_tree2.struct('x'), 'a', 'b', 'c')
|
|
2890
|
+
.toString(), 'a b x\n');
|
|
2891
|
+
$mol_assert_equal($.$mol_tree2_from_string('a b\n')
|
|
2892
|
+
.insert($mol_tree2.struct('x'), 'a', 'b', 'c', 'd')
|
|
2893
|
+
.toString(), 'a b c x\n');
|
|
2894
|
+
$mol_assert_equal($.$mol_tree2_from_string('a b c d\n')
|
|
2895
|
+
.insert($mol_tree2.struct('x'), 0, 0, 0)
|
|
2896
|
+
.toString(), 'a b x\n');
|
|
2897
|
+
$mol_assert_equal($.$mol_tree2_from_string('a b\n')
|
|
2898
|
+
.insert($mol_tree2.struct('x'), 0, 0, 0, 0)
|
|
2899
|
+
.toString(), 'a b \\\n\tx\n');
|
|
2900
|
+
$mol_assert_equal($.$mol_tree2_from_string('a b c d\n')
|
|
2901
|
+
.insert($mol_tree2.struct('x'), null, null, null)
|
|
2902
|
+
.toString(), 'a b x\n');
|
|
2903
|
+
$mol_assert_equal($.$mol_tree2_from_string('a b\n')
|
|
2904
|
+
.insert($mol_tree2.struct('x'), null, null, null, null)
|
|
2905
|
+
.toString(), 'a b \\\n\tx\n');
|
|
2906
|
+
},
|
|
2907
|
+
'deleting'($) {
|
|
2908
|
+
$mol_assert_equal($.$mol_tree2_from_string('a b c d\n')
|
|
2909
|
+
.insert(null, 'a', 'b', 'c')
|
|
2910
|
+
.toString(), 'a b\n');
|
|
2911
|
+
$mol_assert_equal($.$mol_tree2_from_string('a b c d\n')
|
|
2912
|
+
.insert(null, 0, 0, 0)
|
|
2913
|
+
.toString(), 'a b\n');
|
|
2914
|
+
},
|
|
2915
|
+
'hack'($) {
|
|
2916
|
+
const res = $.$mol_tree2_from_string(`foo bar xxx\n`)
|
|
2917
|
+
.hack({
|
|
2918
|
+
'bar': (input, belt) => [input.struct('777', input.hack(belt))],
|
|
2919
|
+
});
|
|
2920
|
+
$mol_assert_equal(res.toString(), 'foo 777 xxx\n');
|
|
2921
|
+
},
|
|
2922
|
+
});
|
|
2923
|
+
})($ || ($ = {}));
|
|
2924
|
+
//mol/tree2/tree2.test.ts
|
|
2925
|
+
;
|
|
2926
|
+
"use strict";
|
|
2927
|
+
var $;
|
|
2928
|
+
(function ($) {
|
|
2929
|
+
$mol_test({
|
|
2930
|
+
'fromJSON'() {
|
|
2931
|
+
$mol_assert_equal($mol_tree2_from_json([]).toString(), '/\n');
|
|
2932
|
+
$mol_assert_equal($mol_tree2_from_json([false, true]).toString(), '/\n\tfalse\n\ttrue\n');
|
|
2933
|
+
$mol_assert_equal($mol_tree2_from_json([0, 1, 2.3]).toString(), '/\n\t0\n\t1\n\t2.3\n');
|
|
2934
|
+
$mol_assert_equal($mol_tree2_from_json(['', 'foo', 'bar\nbaz']).toString(), '/\n\t\\\n\t\\foo\n\t\\\n\t\t\\bar\n\t\t\\baz\n');
|
|
2935
|
+
$mol_assert_equal($mol_tree2_from_json({ 'foo': false, 'bar\nbaz': 'lol' }).toString(), '*\n\tfoo false\n\t\\\n\t\t\\bar\n\t\t\\baz\n\t\t\\lol\n');
|
|
2936
|
+
},
|
|
2937
|
+
});
|
|
2938
|
+
})($ || ($ = {}));
|
|
2939
|
+
//mol/tree2/from/json/json.test.ts
|
|
2940
|
+
;
|
|
2941
|
+
"use strict";
|
|
2942
2942
|
//mol/type/unary/unary.ts
|
|
2943
2943
|
;
|
|
2944
2944
|
"use strict";
|