@schukai/monster 4.141.3 → 4.142.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/package.json +1 -1
- package/source/components/datatable/pagination.mjs +9 -3
- package/source/components/form/control-bar.mjs +55 -35
- package/source/components/form/select.mjs +190 -38
- package/source/components/form/style/control-bar.pcss +13 -0
- package/source/components/form/style/select.pcss +6 -0
- package/source/components/form/stylesheet/control-bar.mjs +1 -1
- package/source/components/form/stylesheet/select.mjs +1 -1
- package/source/components/form/util/floating-layout-queue.mjs +228 -0
- package/source/components/form/util/floating-ui.mjs +47 -8
- package/source/components/layout/panel.mjs +65 -12
- package/source/components/layout/split-panel.mjs +62 -47
- package/test/cases/components/form/button-bar.mjs +114 -2
- package/test/cases/components/form/select.mjs +488 -1
- package/test/cases/components/layout/panel.mjs +87 -73
- package/test/cases/components/layout/slit-panel.mjs +121 -73
|
@@ -1,83 +1,97 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import {chaiDom} from "../../../util/chai-dom.mjs";
|
|
4
|
-
import {initJSDOM} from "../../../util/jsdom.mjs";
|
|
1
|
+
import * as chai from "chai";
|
|
2
|
+
import { getGlobal } from "../../../../source/types/global.mjs";
|
|
3
|
+
import { chaiDom } from "../../../util/chai-dom.mjs";
|
|
4
|
+
import { initJSDOM } from "../../../util/jsdom.mjs";
|
|
5
5
|
|
|
6
|
-
|
|
6
|
+
const expect = chai.expect;
|
|
7
7
|
chai.use(chaiDom);
|
|
8
8
|
|
|
9
9
|
const global = getGlobal();
|
|
10
10
|
|
|
11
|
-
|
|
12
11
|
// language=html
|
|
13
|
-
|
|
12
|
+
const html1 = `
|
|
14
13
|
<monster-panel id="my-panel">
|
|
15
|
-
|
|
14
|
+
|
|
16
15
|
</monster-panel>
|
|
17
16
|
`;
|
|
18
17
|
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
18
|
+
describe("SplitScreen", () => {
|
|
19
|
+
before((done) => {
|
|
20
|
+
initJSDOM().then(() => {
|
|
21
|
+
import("element-internals-polyfill").catch((e) => done(e));
|
|
22
|
+
|
|
23
|
+
const promises = [];
|
|
24
|
+
|
|
25
|
+
if (!global.crypto) {
|
|
26
|
+
promises.push(
|
|
27
|
+
import("@peculiar/webcrypto").then((m) => {
|
|
28
|
+
const Crypto = m.Crypto;
|
|
29
|
+
global.crypto = new Crypto();
|
|
30
|
+
}),
|
|
31
|
+
);
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
promises.push(import("../../../../source/components/layout/panel.mjs"));
|
|
35
|
+
|
|
36
|
+
Promise.all(promises)
|
|
37
|
+
.then(() => {
|
|
38
|
+
done();
|
|
39
|
+
})
|
|
40
|
+
.catch((e) => done(e));
|
|
41
|
+
});
|
|
42
|
+
});
|
|
43
|
+
|
|
44
|
+
describe("document.createElement()", () => {
|
|
45
|
+
afterEach(() => {
|
|
46
|
+
const mocks = document.getElementById("mocks");
|
|
47
|
+
mocks.innerHTML = "";
|
|
48
|
+
});
|
|
49
|
+
|
|
50
|
+
it("should have buttons and SplitScreen", (done) => {
|
|
51
|
+
const mocks = document.getElementById("mocks");
|
|
52
|
+
mocks.innerHTML = html1;
|
|
53
|
+
|
|
54
|
+
setTimeout(() => {
|
|
55
|
+
try {
|
|
56
|
+
const splitScreen = document.getElementById("my-panel");
|
|
57
|
+
expect(splitScreen).is.instanceof(HTMLElement);
|
|
58
|
+
|
|
59
|
+
setTimeout(() => {
|
|
60
|
+
const div = splitScreen.shadowRoot.querySelector("div");
|
|
61
|
+
expect(div.hasChildNodes()).to.be.true;
|
|
62
|
+
done();
|
|
63
|
+
}, 100);
|
|
64
|
+
} catch (e) {
|
|
65
|
+
return done(e);
|
|
66
|
+
}
|
|
67
|
+
}, 0);
|
|
68
|
+
});
|
|
69
|
+
|
|
70
|
+
it("should expose and apply the calculated maximum height", (done) => {
|
|
71
|
+
const mocks = document.getElementById("mocks");
|
|
72
|
+
mocks.innerHTML = html1;
|
|
73
|
+
|
|
74
|
+
setTimeout(() => {
|
|
75
|
+
try {
|
|
76
|
+
const panel = document.getElementById("my-panel");
|
|
77
|
+
panel.setOption("heightAdjustment", 8);
|
|
78
|
+
panel.getBoundingClientRect = () => ({ top: 120 });
|
|
79
|
+
|
|
80
|
+
Object.defineProperty(window, "innerHeight", {
|
|
81
|
+
value: 720,
|
|
82
|
+
configurable: true,
|
|
83
|
+
});
|
|
84
|
+
|
|
85
|
+
const height = panel.getMaximumHeight();
|
|
86
|
+
|
|
87
|
+
expect(height).to.equal(608);
|
|
88
|
+
expect(panel.recalculateHeight()).to.equal(panel);
|
|
89
|
+
expect(panel.style.height).to.equal("608px");
|
|
90
|
+
done();
|
|
91
|
+
} catch (e) {
|
|
92
|
+
return done(e);
|
|
93
|
+
}
|
|
94
|
+
}, 0);
|
|
95
|
+
});
|
|
96
|
+
});
|
|
97
|
+
});
|
|
@@ -1,83 +1,131 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import {chaiDom} from "../../../util/chai-dom.mjs";
|
|
4
|
-
import {initJSDOM} from "../../../util/jsdom.mjs";
|
|
1
|
+
import * as chai from "chai";
|
|
2
|
+
import { getGlobal } from "../../../../source/types/global.mjs";
|
|
3
|
+
import { chaiDom } from "../../../util/chai-dom.mjs";
|
|
4
|
+
import { initJSDOM } from "../../../util/jsdom.mjs";
|
|
5
5
|
|
|
6
|
-
|
|
6
|
+
const expect = chai.expect;
|
|
7
7
|
chai.use(chaiDom);
|
|
8
8
|
|
|
9
9
|
const global = getGlobal();
|
|
10
10
|
|
|
11
|
-
|
|
12
11
|
// language=html
|
|
13
|
-
|
|
12
|
+
const html1 = `
|
|
14
13
|
<monster-split-panel id="my-split-panel">
|
|
15
|
-
|
|
14
|
+
|
|
16
15
|
</monster-split-panel>
|
|
17
16
|
`;
|
|
18
17
|
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
18
|
+
describe("SplitScreen", () => {
|
|
19
|
+
before((done) => {
|
|
20
|
+
initJSDOM().then(() => {
|
|
21
|
+
import("element-internals-polyfill").catch((e) => done(e));
|
|
22
|
+
|
|
23
|
+
const promises = [];
|
|
24
|
+
|
|
25
|
+
if (!global.crypto) {
|
|
26
|
+
promises.push(
|
|
27
|
+
import("@peculiar/webcrypto").then((m) => {
|
|
28
|
+
const Crypto = m.Crypto;
|
|
29
|
+
global.crypto = new Crypto();
|
|
30
|
+
}),
|
|
31
|
+
);
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
promises.push(
|
|
35
|
+
import("../../../../source/components/layout/split-panel.mjs"),
|
|
36
|
+
);
|
|
37
|
+
|
|
38
|
+
Promise.all(promises)
|
|
39
|
+
.then(() => {
|
|
40
|
+
done();
|
|
41
|
+
})
|
|
42
|
+
.catch((e) => done(e));
|
|
43
|
+
});
|
|
44
|
+
});
|
|
45
|
+
|
|
46
|
+
describe("document.createElement()", () => {
|
|
47
|
+
afterEach(() => {
|
|
48
|
+
const mocks = document.getElementById("mocks");
|
|
49
|
+
mocks.innerHTML = "";
|
|
50
|
+
});
|
|
51
|
+
|
|
52
|
+
it("should have buttons and SplitScreen", (done) => {
|
|
53
|
+
const mocks = document.getElementById("mocks");
|
|
54
|
+
mocks.innerHTML = html1;
|
|
55
|
+
|
|
56
|
+
setTimeout(() => {
|
|
57
|
+
try {
|
|
58
|
+
const splitScreen = document.getElementById("my-split-panel");
|
|
59
|
+
expect(splitScreen).is.instanceof(HTMLElement);
|
|
60
|
+
|
|
61
|
+
setTimeout(() => {
|
|
62
|
+
const div = splitScreen.shadowRoot.querySelector("div");
|
|
63
|
+
expect(div.hasChildNodes()).to.be.true;
|
|
64
|
+
done();
|
|
65
|
+
}, 100);
|
|
66
|
+
} catch (e) {
|
|
67
|
+
return done(e);
|
|
68
|
+
}
|
|
69
|
+
}, 0);
|
|
70
|
+
});
|
|
71
|
+
|
|
72
|
+
it("should use the configured dragger width for vertical panel dimensions", (done) => {
|
|
73
|
+
const mocks = document.getElementById("mocks");
|
|
74
|
+
mocks.innerHTML = html1;
|
|
75
|
+
|
|
76
|
+
setTimeout(() => {
|
|
77
|
+
try {
|
|
78
|
+
const splitPanel = document.getElementById("my-split-panel");
|
|
79
|
+
const dragger = splitPanel.shadowRoot.querySelector(
|
|
80
|
+
"[data-monster-role=dragger]",
|
|
81
|
+
);
|
|
82
|
+
const startPanel = splitPanel.shadowRoot.querySelector(
|
|
83
|
+
"[data-monster-role=startPanel]",
|
|
84
|
+
);
|
|
85
|
+
const endPanel = splitPanel.shadowRoot.querySelector(
|
|
86
|
+
"[data-monster-role=endPanel]",
|
|
87
|
+
);
|
|
88
|
+
|
|
89
|
+
dragger.style.setProperty("--monster-dragger-width", "12px");
|
|
90
|
+
splitPanel.setDimension("40%");
|
|
91
|
+
|
|
92
|
+
expect(startPanel.style.width).to.equal("40%");
|
|
93
|
+
expect(endPanel.style.width).to.equal("calc(60% - 12px)");
|
|
94
|
+
done();
|
|
95
|
+
} catch (e) {
|
|
96
|
+
return done(e);
|
|
97
|
+
}
|
|
98
|
+
}, 0);
|
|
99
|
+
});
|
|
100
|
+
|
|
101
|
+
it("should use the configured dragger width for horizontal panel dimensions", (done) => {
|
|
102
|
+
const mocks = document.getElementById("mocks");
|
|
103
|
+
mocks.innerHTML = html1;
|
|
104
|
+
|
|
105
|
+
setTimeout(() => {
|
|
106
|
+
try {
|
|
107
|
+
const splitPanel = document.getElementById("my-split-panel");
|
|
108
|
+
const dragger = splitPanel.shadowRoot.querySelector(
|
|
109
|
+
"[data-monster-role=dragger]",
|
|
110
|
+
);
|
|
111
|
+
const startPanel = splitPanel.shadowRoot.querySelector(
|
|
112
|
+
"[data-monster-role=startPanel]",
|
|
113
|
+
);
|
|
114
|
+
const endPanel = splitPanel.shadowRoot.querySelector(
|
|
115
|
+
"[data-monster-role=endPanel]",
|
|
116
|
+
);
|
|
117
|
+
|
|
118
|
+
dragger.style.setProperty("--monster-dragger-width", "14px");
|
|
119
|
+
splitPanel.setOption("splitType", "horizontal");
|
|
120
|
+
splitPanel.setDimension("35%");
|
|
121
|
+
|
|
122
|
+
expect(startPanel.style.height).to.equal("35%");
|
|
123
|
+
expect(endPanel.style.height).to.equal("calc(65% - 14px)");
|
|
124
|
+
done();
|
|
125
|
+
} catch (e) {
|
|
126
|
+
return done(e);
|
|
127
|
+
}
|
|
128
|
+
}, 0);
|
|
129
|
+
});
|
|
130
|
+
});
|
|
131
|
+
});
|