@yuneta/gobj-ui 7.25.8 → 7.25.10
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/README.md +72 -12
- package/dist/gobj-ui.cjs.js +327 -97
- package/dist/gobj-ui.es.js +327 -97
- package/package.json +1 -1
- package/src/c_yui_schema_editor.js +418 -76
- package/src/schema_editor_reload.wiring.test.js +551 -7
- package/src/shell_modals.js +17 -5
- package/src/shell_toast_once.test.js +77 -0
|
@@ -11,6 +11,12 @@
|
|
|
11
11
|
* review): its handle and its time are its own, and the toast
|
|
12
12
|
* stays while any caller still holds it.
|
|
13
13
|
*
|
|
14
|
+
* And every ✕ this module draws is a control with a NAME: a
|
|
15
|
+
* `title` and an `aria-label`, both translatable (fourth
|
|
16
|
+
* independent review: TOAST_CLOSE had the label only). So is
|
|
17
|
+
* every other button of a dialog (fifth: the dialog's back arrow
|
|
18
|
+
* had no title, and the Yes/No of every confirmation had neither).
|
|
19
|
+
*
|
|
14
20
|
* Copyright (c) 2026, ArtGins.
|
|
15
21
|
* All Rights Reserved.
|
|
16
22
|
***********************************************************************/
|
|
@@ -22,6 +28,8 @@ install_dom_double();
|
|
|
22
28
|
const {
|
|
23
29
|
yui_shell_show_error,
|
|
24
30
|
yui_shell_show_info,
|
|
31
|
+
yui_shell_show_modal,
|
|
32
|
+
yui_shell_confirm_danger,
|
|
25
33
|
} = await import("./shell_modals.js");
|
|
26
34
|
|
|
27
35
|
let shell = null;
|
|
@@ -123,3 +131,72 @@ describe("a repeat is its own caller", () => {
|
|
|
123
131
|
expect(toasts().length).toBe(1);
|
|
124
132
|
});
|
|
125
133
|
});
|
|
134
|
+
|
|
135
|
+
describe("every close control is named", () => {
|
|
136
|
+
|
|
137
|
+
function named($b)
|
|
138
|
+
{
|
|
139
|
+
/* The text itself is whatever the app's i18next answers (none
|
|
140
|
+
* here); what is checked is that both are THERE and carry the
|
|
141
|
+
* key a language change re-translates them by. */
|
|
142
|
+
return {
|
|
143
|
+
title: $b.getAttribute("title") !== null,
|
|
144
|
+
title_key: $b.getAttribute("data-i18n-title"),
|
|
145
|
+
label: $b.getAttribute("aria-label") !== null,
|
|
146
|
+
label_key: $b.getAttribute("data-i18n-aria-label"),
|
|
147
|
+
};
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
const NAMED = {title: true, title_key: "close", label: true, label_key: "close"};
|
|
151
|
+
|
|
152
|
+
test("the toast's", () => {
|
|
153
|
+
yui_shell_show_error(shell, "the connection dropped");
|
|
154
|
+
expect(named(toasts()[0].querySelector(".TOAST_CLOSE"))).toEqual(NAMED);
|
|
155
|
+
});
|
|
156
|
+
|
|
157
|
+
test("a modal's, dialog or plain, and a confirmation's", () => {
|
|
158
|
+
shell.priv.layers.modal = document.createElement("div");
|
|
159
|
+
yui_shell_show_modal(shell, document.createElement("div"), {dialog: true, title: "x"});
|
|
160
|
+
yui_shell_show_modal(shell, document.createElement("div"), {});
|
|
161
|
+
yui_shell_confirm_danger(shell, "delete this column?");
|
|
162
|
+
const $closes = shell.priv.layers.modal.querySelectorAll(
|
|
163
|
+
".MODAL_CLOSE, .CONFIRM_CLOSE");
|
|
164
|
+
expect($closes.length).toBe(3);
|
|
165
|
+
for(const $b of $closes) {
|
|
166
|
+
expect(named($b)).toEqual(NAMED);
|
|
167
|
+
}
|
|
168
|
+
});
|
|
169
|
+
});
|
|
170
|
+
|
|
171
|
+
describe("every other button of a dialog is named (fifth review)", () => {
|
|
172
|
+
|
|
173
|
+
function named($b)
|
|
174
|
+
{
|
|
175
|
+
return {
|
|
176
|
+
title: $b.getAttribute("title") !== null,
|
|
177
|
+
title_key: $b.getAttribute("data-i18n-title"),
|
|
178
|
+
label: $b.getAttribute("aria-label") !== null,
|
|
179
|
+
label_key: $b.getAttribute("data-i18n-aria-label"),
|
|
180
|
+
};
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
test("the back arrow of an adaptive dialog", () => {
|
|
184
|
+
shell.priv.layers.modal = document.createElement("div");
|
|
185
|
+
yui_shell_show_modal(shell, document.createElement("div"), {dialog: true, title: "x"});
|
|
186
|
+
const $back = shell.priv.layers.modal.querySelector(".MODAL_BACK");
|
|
187
|
+
expect(named($back)).toEqual(
|
|
188
|
+
{title: true, title_key: "back", label: true, label_key: "back"});
|
|
189
|
+
});
|
|
190
|
+
|
|
191
|
+
test("the answers of a confirmation, named by their own label key", () => {
|
|
192
|
+
shell.priv.layers.modal = document.createElement("div");
|
|
193
|
+
yui_shell_confirm_danger(shell, "delete this column?",
|
|
194
|
+
{confirm_label: "delete", cancel_label: "cancel"});
|
|
195
|
+
const $answers = shell.priv.layers.modal.querySelectorAll(".CONFIRM_BTN");
|
|
196
|
+
expect($answers.length).toBe(2);
|
|
197
|
+
expect([...$answers].map(named)).toEqual([
|
|
198
|
+
{title: true, title_key: "delete", label: true, label_key: "delete"},
|
|
199
|
+
{title: true, title_key: "cancel", label: true, label_key: "cancel"},
|
|
200
|
+
]);
|
|
201
|
+
});
|
|
202
|
+
});
|