@yuneta/gobj-ui 7.26.46 → 7.26.47
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 +94 -16
- package/dist/gobj-ui.cjs.js +247 -59
- package/dist/gobj-ui.es.js +247 -59
- package/package.json +1 -1
- package/scripts/validate-locales.mjs +185 -8
- package/src/c_yui_form.css +9 -0
- package/src/c_yui_form.js +158 -20
- package/src/c_yui_shell.js +25 -2
- package/src/c_yui_treedb_topic_with_form.js +8 -2
- package/src/c_yui_window.js +15 -1
- package/src/form_table_rows.wiring.test.js +169 -3
- package/src/form_time_cell_editor.js +40 -23
- package/src/form_time_cell_editor.test.js +38 -0
- package/src/form_time_field.wiring.test.js +118 -0
- package/src/form_time_value.js +59 -1
- package/src/form_time_value.test.js +25 -1
- package/src/shell_focus_trap.js +19 -24
- package/src/shell_focus_trap.test.js +53 -9
- package/src/shell_stop_overlays.wiring.test.js +35 -3
- package/src/treedb_time_cell.wiring.test.js +103 -0
- package/src/window_rect_rounding.wiring.test.js +29 -1
- package/src/yui_tabulator_i18n.js +18 -7
- package/src/yui_tabulator_i18n.test.js +36 -0
|
@@ -390,8 +390,9 @@ test("Tab and Shift+Tab wrap to the first and last DRAWN controls", () => {
|
|
|
390
390
|
* drawer or a dialog open) holds the focus of nothing. Kept on
|
|
391
391
|
* the stack it was the "overlay" every later window opened
|
|
392
392
|
* under, so none of them took the focus; and above a live trap
|
|
393
|
-
* it left that one deaf to Tab. It is
|
|
394
|
-
*
|
|
393
|
+
* it left that one deaf to Tab. It is skipped: the top is the
|
|
394
|
+
* highest trap whose panel is in the document. It stays on the
|
|
395
|
+
* stack, listener and all, until its release().
|
|
395
396
|
***************************************************************/
|
|
396
397
|
function connected_panel(focusables)
|
|
397
398
|
{
|
|
@@ -407,12 +408,12 @@ test("a trap whose panel left the document is no longer the top", () => {
|
|
|
407
408
|
let doc = make_doc(null);
|
|
408
409
|
|
|
409
410
|
let release_a = activate_focus_trap_on(panel_a, doc);
|
|
410
|
-
activate_focus_trap_on(panel_b, doc);
|
|
411
|
+
let release_b = activate_focus_trap_on(panel_b, doc);
|
|
411
412
|
expect(focus_trap_panel()).toBe(panel_b);
|
|
412
413
|
|
|
413
414
|
panel_b.isConnected = false;
|
|
414
415
|
expect(focus_trap_panel()).toBe(panel_a);
|
|
415
|
-
expect(doc.listeners.length).toBe(
|
|
416
|
+
expect(doc.listeners.length).toBe(2);
|
|
416
417
|
|
|
417
418
|
/* And the live one under it hears Tab again. */
|
|
418
419
|
a_first.focus_calls.length = 0;
|
|
@@ -429,6 +430,7 @@ test("a trap whose panel left the document is no longer the top", () => {
|
|
|
429
430
|
expect(a_first.focus_calls).toEqual(["a-first.focus"]);
|
|
430
431
|
|
|
431
432
|
release_a();
|
|
433
|
+
release_b();
|
|
432
434
|
expect(doc.listeners.length).toBe(0);
|
|
433
435
|
});
|
|
434
436
|
|
|
@@ -439,10 +441,10 @@ test("a detached trap above a live one does not leave the live one deaf to Tab",
|
|
|
439
441
|
let doc = make_doc(null);
|
|
440
442
|
|
|
441
443
|
let release_a = activate_focus_trap_on(panel_a, doc);
|
|
442
|
-
activate_focus_trap_on(panel_b, doc);
|
|
444
|
+
let release_b = activate_focus_trap_on(panel_b, doc);
|
|
443
445
|
panel_b.isConnected = false;
|
|
444
446
|
|
|
445
|
-
/* Nobody asked for the top: the Tab itself
|
|
447
|
+
/* Nobody asked for the top: the Tab itself skips the stale one. */
|
|
446
448
|
a_first.focus_calls.length = 0;
|
|
447
449
|
doc.activeElement = make_focusable("outside");
|
|
448
450
|
let prevented = false;
|
|
@@ -458,12 +460,13 @@ test("a detached trap above a live one does not leave the live one deaf to Tab",
|
|
|
458
460
|
}
|
|
459
461
|
expect(prevented).toBe(true);
|
|
460
462
|
expect(a_first.focus_calls).toEqual(["a-first.focus"]);
|
|
461
|
-
expect(doc.listeners.length).toBe(1);
|
|
462
463
|
|
|
463
464
|
release_a();
|
|
465
|
+
release_b();
|
|
466
|
+
expect(doc.listeners.length).toBe(0);
|
|
464
467
|
});
|
|
465
468
|
|
|
466
|
-
test("the release of a
|
|
469
|
+
test("the release of a skipped trap takes it off and gives the focus back", () => {
|
|
467
470
|
let prev = make_focusable("prev");
|
|
468
471
|
let panel = connected_panel([make_focusable("first")]);
|
|
469
472
|
let doc = make_doc(prev);
|
|
@@ -471,8 +474,49 @@ test("the release of a dropped trap still gives the focus back", () => {
|
|
|
471
474
|
let release = activate_focus_trap_on(panel, doc);
|
|
472
475
|
panel.isConnected = false;
|
|
473
476
|
expect(focus_trap_panel()).not.toBe(panel);
|
|
474
|
-
expect(doc.listeners.length).toBe(
|
|
477
|
+
expect(doc.listeners.length).toBe(1);
|
|
475
478
|
|
|
476
479
|
release();
|
|
480
|
+
expect(doc.listeners.length).toBe(0);
|
|
477
481
|
expect(prev.focus_calls).toEqual(["prev.focus"]);
|
|
482
|
+
panel.isConnected = true;
|
|
483
|
+
expect(focus_trap_panel()).not.toBe(panel);
|
|
484
|
+
});
|
|
485
|
+
|
|
486
|
+
/***************************************************************
|
|
487
|
+
* A panel that only MOVES -- taken out of the document and put
|
|
488
|
+
* back, its trap never released -- keeps its trap. Up to gobj-ui
|
|
489
|
+
* 7.26.46 the first read of the stack while it was out dropped
|
|
490
|
+
* the trap for good: back in the document, Tab left the window.
|
|
491
|
+
***************************************************************/
|
|
492
|
+
test("a panel taken out and put back keeps its trap", () => {
|
|
493
|
+
let first = make_focusable("first");
|
|
494
|
+
let last = make_focusable("last");
|
|
495
|
+
let panel = connected_panel([first, last]);
|
|
496
|
+
let doc = make_doc(null);
|
|
497
|
+
|
|
498
|
+
let release = activate_focus_trap_on(panel, doc);
|
|
499
|
+
panel.isConnected = false;
|
|
500
|
+
expect(focus_trap_panel()).not.toBe(panel);
|
|
501
|
+
panel.isConnected = true;
|
|
502
|
+
expect(focus_trap_panel()).toBe(panel);
|
|
503
|
+
|
|
504
|
+
first.focus_calls.length = 0;
|
|
505
|
+
doc.activeElement = last;
|
|
506
|
+
let prevented = false;
|
|
507
|
+
for(let fn of doc.listeners.slice()) {
|
|
508
|
+
fn({
|
|
509
|
+
key: "Tab",
|
|
510
|
+
shiftKey: false,
|
|
511
|
+
preventDefault() {
|
|
512
|
+
prevented = true;
|
|
513
|
+
}
|
|
514
|
+
});
|
|
515
|
+
}
|
|
516
|
+
expect(prevented).toBe(true);
|
|
517
|
+
expect(first.focus_calls).toEqual(["first.focus"]);
|
|
518
|
+
|
|
519
|
+
release();
|
|
520
|
+
expect(doc.listeners.length).toBe(0);
|
|
521
|
+
expect(focus_trap_panel()).not.toBe(panel);
|
|
478
522
|
});
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
* Copyright (c) 2026, ArtGins.
|
|
14
14
|
* All Rights Reserved.
|
|
15
15
|
***********************************************************************/
|
|
16
|
-
import {describe, test, expect, beforeAll, beforeEach} from "vitest";
|
|
16
|
+
import {describe, test, expect, beforeAll, beforeEach, vi} from "vitest";
|
|
17
17
|
import {install_dom_double} from "../test/dom_double.js";
|
|
18
18
|
|
|
19
19
|
install_dom_double();
|
|
@@ -60,7 +60,7 @@ function settle()
|
|
|
60
60
|
return new Promise(resolve => setTimeout(resolve, 0));
|
|
61
61
|
}
|
|
62
62
|
|
|
63
|
-
function make_shell()
|
|
63
|
+
function make_shell(use_hash)
|
|
64
64
|
{
|
|
65
65
|
seq++;
|
|
66
66
|
const app = gobj_create(`sapp${seq}`, "C_TEST_STOP_HOST", {}, yuno);
|
|
@@ -75,7 +75,8 @@ function make_shell()
|
|
|
75
75
|
}
|
|
76
76
|
}
|
|
77
77
|
},
|
|
78
|
-
subscriber: app
|
|
78
|
+
subscriber: app,
|
|
79
|
+
use_hash: !!use_hash
|
|
79
80
|
}, app);
|
|
80
81
|
gobj_start(shell);
|
|
81
82
|
logged.length = 0; /* the shell's own start: no route table here */
|
|
@@ -140,4 +141,35 @@ describe("a shell stopped with an overlay up", () => {
|
|
|
140
141
|
/* gobj-js says what the test did; nothing else is said. */
|
|
141
142
|
expect(errors().filter((m) => !m.includes("Destroying a RUNNING gobj"))).toEqual([]);
|
|
142
143
|
});
|
|
144
|
+
|
|
145
|
+
test("it moves no browser history: their markers are left in place", async () => {
|
|
146
|
+
window.location.hash = "#/home";
|
|
147
|
+
const shell = make_shell(true);
|
|
148
|
+
|
|
149
|
+
yui_shell_show_modal(shell, "the sheet", {
|
|
150
|
+
dialog: true, logical_class: "TEST_STOP_SHEET", title: "settings"
|
|
151
|
+
});
|
|
152
|
+
let answer = null;
|
|
153
|
+
yui_shell_confirm_yesno(shell, "really?").then((a) => {
|
|
154
|
+
answer = a;
|
|
155
|
+
});
|
|
156
|
+
expect(window.history.state && window.history.state.__yui_overlay__).toBeTruthy();
|
|
157
|
+
|
|
158
|
+
/* A stopped shell hears no landing: a back() of its own would be
|
|
159
|
+
* taken by whatever the next shell pushed in the same turn. */
|
|
160
|
+
const back = vi.spyOn(window.history, "back");
|
|
161
|
+
try {
|
|
162
|
+
gobj_stop(shell);
|
|
163
|
+
gobj_destroy(shell);
|
|
164
|
+
await settle();
|
|
165
|
+
expect(back).not.toHaveBeenCalled();
|
|
166
|
+
} finally {
|
|
167
|
+
back.mockRestore();
|
|
168
|
+
window.location.hash = "";
|
|
169
|
+
}
|
|
170
|
+
expect(answer).toBe(false);
|
|
171
|
+
expect(document.querySelectorAll(".TEST_STOP_SHEET").length).toBe(0);
|
|
172
|
+
expect(focus_trap_panel()).toBe(null);
|
|
173
|
+
expect(errors()).toEqual([]);
|
|
174
|
+
});
|
|
143
175
|
});
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
/***********************************************************************
|
|
2
|
+
* treedb_time_cell.wiring.test.js
|
|
3
|
+
*
|
|
4
|
+
* A time column of C_YUI_TREEDB_TOPIC_WITH_FORM's table reads its
|
|
5
|
+
* value as the form does (form_time_value.js): an ISO text for a
|
|
6
|
+
* string column, an epoch in seconds for any other, nothing for no
|
|
7
|
+
* time. Up to gobj-ui 7.26.46 it read every column with parseInt --
|
|
8
|
+
* an ISO text as 2026 SECONDS, in January 1970 -- and showed a
|
|
9
|
+
* column with no time as January 1970.
|
|
10
|
+
*
|
|
11
|
+
* Copyright (c) 2026, ArtGins.
|
|
12
|
+
* All Rights Reserved.
|
|
13
|
+
***********************************************************************/
|
|
14
|
+
import {describe, test, expect, beforeAll, vi} from "vitest";
|
|
15
|
+
import {install_dom_double} from "../test/dom_double.js";
|
|
16
|
+
|
|
17
|
+
install_dom_double();
|
|
18
|
+
|
|
19
|
+
if(typeof globalThis.ResizeObserver === "undefined") {
|
|
20
|
+
globalThis.ResizeObserver = class {
|
|
21
|
+
observe() {
|
|
22
|
+
}
|
|
23
|
+
unobserve() {
|
|
24
|
+
}
|
|
25
|
+
disconnect() {
|
|
26
|
+
}
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
const tables = vi.hoisted(() => []);
|
|
31
|
+
vi.mock("tabulator-tables", () => {
|
|
32
|
+
class FakeTabulator {
|
|
33
|
+
constructor($el, settings) {
|
|
34
|
+
this.element = $el;
|
|
35
|
+
this.options = settings;
|
|
36
|
+
tables.push(this);
|
|
37
|
+
return new Proxy(this, {
|
|
38
|
+
get(target, prop) {
|
|
39
|
+
if(prop in target) {
|
|
40
|
+
return target[prop];
|
|
41
|
+
}
|
|
42
|
+
return () => [];
|
|
43
|
+
}
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
on() {
|
|
47
|
+
}
|
|
48
|
+
off() {
|
|
49
|
+
}
|
|
50
|
+
destroy() {
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
return {TabulatorFull: FakeTabulator, Tabulator: FakeTabulator};
|
|
54
|
+
});
|
|
55
|
+
|
|
56
|
+
const {
|
|
57
|
+
SDATA_END, gclass_create, set_log_callback,
|
|
58
|
+
gobj_start_up, gobj_create_yuno, gobj_create_service, gobj_start,
|
|
59
|
+
} = await import("@yuneta/gobj-js");
|
|
60
|
+
const {register_c_yui_treedb_topic_with_form} = await import("./c_yui_treedb_topic_with_form.js");
|
|
61
|
+
|
|
62
|
+
const logged = [];
|
|
63
|
+
let yuno = null;
|
|
64
|
+
|
|
65
|
+
beforeAll(async () => {
|
|
66
|
+
const i18next = (await import("i18next")).default;
|
|
67
|
+
await i18next.init({lng: "en", resources: {}});
|
|
68
|
+
gobj_start_up(null, null, null, null, null, null, null);
|
|
69
|
+
set_log_callback((level, msg) => {
|
|
70
|
+
logged.push({level: String(level), msg: String(msg)});
|
|
71
|
+
});
|
|
72
|
+
gclass_create("C_TEST_TIME_CELL_HOST", [], [["ST_IDLE", []]], {}, 0, [SDATA_END()], {}, 0, 0, 0, 0);
|
|
73
|
+
register_c_yui_treedb_topic_with_form();
|
|
74
|
+
yuno = gobj_create_yuno("time_cell_yuno", "C_TEST_TIME_CELL_HOST", {});
|
|
75
|
+
gobj_start(yuno);
|
|
76
|
+
});
|
|
77
|
+
|
|
78
|
+
describe("a time column of a treedb topic's table", () => {
|
|
79
|
+
test("reads an ISO text column as ISO, and shows no time as nothing", () => {
|
|
80
|
+
const view = gobj_create_service("time_cell_view", "C_YUI_TREEDB_TOPIC_WITH_FORM", {
|
|
81
|
+
treedb_name: "treedb_test",
|
|
82
|
+
topic_name: "events",
|
|
83
|
+
desc: {id: "events", pkey: "id", cols: [
|
|
84
|
+
{id: "id", header: "Id", type: "string", flag: ["persistent", "required"]},
|
|
85
|
+
{id: "at", header: "at", type: "string", flag: ["persistent", "time"]},
|
|
86
|
+
{id: "when", header: "when", type: "integer", flag: ["persistent", "time"]}
|
|
87
|
+
]}
|
|
88
|
+
}, yuno);
|
|
89
|
+
gobj_start(view);
|
|
90
|
+
const columns = tables[tables.length - 1].options.columns;
|
|
91
|
+
const text = (field, value) => {
|
|
92
|
+
const col = columns.find((c) => c.field === field);
|
|
93
|
+
const out = col.formatter({getValue: () => value, getData: () => ({}), getField: () => field}, {}, () => {});
|
|
94
|
+
return (out && typeof out === "object") ? out.textContent : String(out);
|
|
95
|
+
};
|
|
96
|
+
const year = (s) => (s.match(/\b(19|20)\d\d\b/) || [""])[0];
|
|
97
|
+
const epoch = Math.floor(new Date("2026-03-14T09:26:53").getTime() / 1000);
|
|
98
|
+
expect(year(text("at", new Date(epoch * 1000).toISOString()))).toBe("2026");
|
|
99
|
+
expect(year(text("when", epoch))).toBe("2026");
|
|
100
|
+
expect(text("when", null)).toBe("");
|
|
101
|
+
expect(logged.filter((l) => l.level === "error")).toEqual([]);
|
|
102
|
+
});
|
|
103
|
+
});
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
* Copyright (c) 2026, ArtGins.
|
|
15
15
|
* All Rights Reserved.
|
|
16
16
|
***********************************************************************/
|
|
17
|
-
import {describe, test, expect, beforeAll} from "vitest";
|
|
17
|
+
import {describe, test, expect, beforeAll, vi} from "vitest";
|
|
18
18
|
import {install_dom_double} from "../test/dom_double.js";
|
|
19
19
|
|
|
20
20
|
install_dom_double();
|
|
@@ -117,6 +117,34 @@ describe("the saved rect of a window is whole pixels", () => {
|
|
|
117
117
|
expect(logged.filter((l) => l.msg.includes("rect_none-rect"))).toEqual([]);
|
|
118
118
|
});
|
|
119
119
|
|
|
120
|
+
/* Not json at all, or the json `null`: kw_get_local_storage_value()
|
|
121
|
+
* answers nothing for either (the first with a console.warn of its
|
|
122
|
+
* own). Up to 7.26.46 the entry stayed, and was said on every open. */
|
|
123
|
+
test.each([["not json", "garbage{"], ["json null", "null"]])(
|
|
124
|
+
"an entry that is %s is said once, forgotten, and the window opens where it would",
|
|
125
|
+
(label, text) => {
|
|
126
|
+
const name = label === "not json" ? "rect_text" : "rect_null";
|
|
127
|
+
window.localStorage.setItem(`${name}-rect`, text);
|
|
128
|
+
logged.length = 0;
|
|
129
|
+
const warn = vi.spyOn(console, "warn").mockImplementation(() => {});
|
|
130
|
+
let win;
|
|
131
|
+
try {
|
|
132
|
+
win = gobj_create_service(name, "C_YUI_WINDOW", {
|
|
133
|
+
header: name, body: ["div", {}, name], auto_save_size_and_position: true,
|
|
134
|
+
x: 5, y: 6, width: 300, height: 200,
|
|
135
|
+
}, yuno);
|
|
136
|
+
gobj_start(win);
|
|
137
|
+
} finally {
|
|
138
|
+
warn.mockRestore();
|
|
139
|
+
}
|
|
140
|
+
expect(attrs_rect(win)).toEqual({x: 5, y: 6, width: 300, height: 200});
|
|
141
|
+
const warned = logged.filter((l) => l.level === "warning" && l.msg.includes(`${name}-rect`));
|
|
142
|
+
expect(warned.length, "the entry is said").toBe(1);
|
|
143
|
+
expect(window.localStorage.getItem(`${name}-rect`), "and forgotten").toBe(null);
|
|
144
|
+
expect(errors()).toEqual([]);
|
|
145
|
+
}
|
|
146
|
+
);
|
|
147
|
+
|
|
120
148
|
/* A rect with no size -- what the box of a window that is not
|
|
121
149
|
* drawn answers -- is no place to open in: the window was drawn at
|
|
122
150
|
* the CSS minimum while its attrs said 0 x 0, and every open
|
|
@@ -169,8 +169,14 @@ function yui_tabulator_name_filters(table, t)
|
|
|
169
169
|
* from `yui_tabulator_relocalize()` so a language change
|
|
170
170
|
* reaches them.
|
|
171
171
|
*
|
|
172
|
-
* It matches Tabulator's OWN literal and
|
|
173
|
-
* view named itself is
|
|
172
|
+
* It matches Tabulator's OWN literal, and the boxes it named itself
|
|
173
|
+
* (they carry `data-yui-row-select`), so a box a view named itself is
|
|
174
|
+
* left alone. Up to 7.26.46 it matched only the literal: a box named
|
|
175
|
+
* once was never found again, and a language change through
|
|
176
|
+
* yui_tabulator_relocalize() left it in the old language.
|
|
177
|
+
*
|
|
178
|
+
* The box in the HEADER selects every row, and is named so
|
|
179
|
+
* ("select all rows"); up to 7.26.46 it was "select row" too.
|
|
174
180
|
***************************************************************/
|
|
175
181
|
const TABULATOR_ROW_SELECT_ARIA = "Select Row";
|
|
176
182
|
|
|
@@ -193,12 +199,17 @@ function yui_tabulator_name_row_selects(table, t)
|
|
|
193
199
|
return;
|
|
194
200
|
}
|
|
195
201
|
let boxes = $el.querySelectorAll(
|
|
196
|
-
`input[type=checkbox][aria-label="${TABULATOR_ROW_SELECT_ARIA}"]`
|
|
202
|
+
`input[type=checkbox][aria-label="${TABULATOR_ROW_SELECT_ARIA}"], ` +
|
|
203
|
+
`input[type=checkbox][data-yui-row-select]`);
|
|
197
204
|
for(let $box of boxes) {
|
|
198
|
-
$box.
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
$box.setAttribute("
|
|
205
|
+
let all = typeof $box.closest === "function" && !!$box.closest(".tabulator-header");
|
|
206
|
+
let name = all ? t("select all rows") : t("select row");
|
|
207
|
+
let key = all ? "select all rows" : "select row";
|
|
208
|
+
$box.setAttribute("aria-label", name);
|
|
209
|
+
$box.setAttribute("data-i18n-aria-label", key);
|
|
210
|
+
$box.setAttribute("title", name);
|
|
211
|
+
$box.setAttribute("data-i18n-title", key);
|
|
212
|
+
$box.setAttribute("data-yui-row-select", "");
|
|
202
213
|
}
|
|
203
214
|
} catch(e) {
|
|
204
215
|
/* a table between renders has no boxes to name */
|
|
@@ -81,6 +81,42 @@ describe("yui_tabulator_name_row_selects", () => {
|
|
|
81
81
|
expect($box.attrs["title"]).toBe("Seleccionar fila");
|
|
82
82
|
expect($box.attrs["data-i18n-title"]).toBe("select row");
|
|
83
83
|
});
|
|
84
|
+
|
|
85
|
+
/* Up to 7.26.46 the header's box -- which selects every row -- was
|
|
86
|
+
* named "select row" too. */
|
|
87
|
+
it("names the header's box for what it does: select all rows", () => {
|
|
88
|
+
const $box = element();
|
|
89
|
+
$box.setAttribute("aria-label", "Select Row");
|
|
90
|
+
$box.closest = (sel) => (sel === ".tabulator-header" ? {} : null);
|
|
91
|
+
const table = {element: element($box)};
|
|
92
|
+
|
|
93
|
+
yui_tabulator_name_row_selects(table, (key) => key === "select all rows" ? "Seleccionar todas las filas" : key);
|
|
94
|
+
|
|
95
|
+
expect($box.attrs["aria-label"]).toBe("Seleccionar todas las filas");
|
|
96
|
+
expect($box.attrs["data-i18n-aria-label"]).toBe("select all rows");
|
|
97
|
+
expect($box.attrs["title"]).toBe("Seleccionar todas las filas");
|
|
98
|
+
expect($box.attrs["data-i18n-title"]).toBe("select all rows");
|
|
99
|
+
});
|
|
100
|
+
|
|
101
|
+
/* Up to 7.26.46 only Tabulator's English literal was matched, so a
|
|
102
|
+
* box named once was never named again: a language change through
|
|
103
|
+
* yui_tabulator_relocalize() (C_YUI_FORM's EV_LANGUAGE_CHANGED) left
|
|
104
|
+
* it in the old language. */
|
|
105
|
+
it("names again, in the new language, a box it named before", () => {
|
|
106
|
+
const $box = element();
|
|
107
|
+
$box.setAttribute("aria-label", "Select Row");
|
|
108
|
+
/* Found again by the mark it left, not by Tabulator's literal */
|
|
109
|
+
const table = {element: {querySelectorAll: (sel) => (
|
|
110
|
+
sel.includes("Select Row") && $box.attrs["aria-label"] !== "Select Row" &&
|
|
111
|
+
!sel.includes("data-yui-row-select") ? [] : [$box])}};
|
|
112
|
+
|
|
113
|
+
yui_tabulator_name_row_selects(table, t);
|
|
114
|
+
expect($box.attrs["aria-label"]).toBe("Seleccionar fila");
|
|
115
|
+
|
|
116
|
+
yui_tabulator_name_row_selects(table, (key) => key === "select row" ? "Select the row" : key);
|
|
117
|
+
expect($box.attrs["aria-label"]).toBe("Select the row");
|
|
118
|
+
expect($box.attrs["title"]).toBe("Select the row");
|
|
119
|
+
});
|
|
84
120
|
});
|
|
85
121
|
|
|
86
122
|
describe("yui_tabulator_name_editor", () => {
|