@yuneta/gobj-ui 7.25.10 → 7.25.11

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.
@@ -75433,7 +75433,9 @@ function confirm_then(gobj, message, detail, kw) {
75433
75433
  kw = Object.assign({ model_gen: gobj.priv.model_gen }, kw);
75434
75434
  yui_shell_confirm_danger(yui_shell_of(gobj), message, {
75435
75435
  t: i18next.t,
75436
- detail
75436
+ detail,
75437
+ confirm_label: "delete",
75438
+ cancel_label: "cancel"
75437
75439
  }).then((yes) => {
75438
75440
  if (!yes || (0, _yuneta_gobj_js.gobj_is_destroying)(gobj)) return;
75439
75441
  (0, _yuneta_gobj_js.gobj_send_event)(gobj, "EV_CONFIRMED", kw, gobj);
@@ -75428,7 +75428,9 @@ function confirm_then(gobj, message, detail, kw) {
75428
75428
  kw = Object.assign({ model_gen: gobj.priv.model_gen }, kw);
75429
75429
  yui_shell_confirm_danger(yui_shell_of(gobj), message, {
75430
75430
  t,
75431
- detail
75431
+ detail,
75432
+ confirm_label: "delete",
75433
+ cancel_label: "cancel"
75432
75434
  }).then((yes) => {
75433
75435
  if (!yes || gobj_is_destroying(gobj)) return;
75434
75436
  gobj_send_event(gobj, "EV_CONFIRMED", kw, gobj);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@yuneta/gobj-ui",
3
- "version": "7.25.10",
3
+ "version": "7.25.11",
4
4
  "type": "module",
5
5
  "main": "dist/gobj-ui.cjs.js",
6
6
  "module": "dist/gobj-ui.es.js",
@@ -3504,9 +3504,15 @@ function ac_show_orphans(gobj, event, kw, src)
3504
3504
  function confirm_then(gobj, message, detail, kw)
3505
3505
  {
3506
3506
  kw = Object.assign({model_gen: gobj.priv.model_gen}, kw);
3507
+ /* The answers are i18n KEYS: shell_modals names each button by its
3508
+ * label, and its defaults ("Delete", "Cancel") are not lower-case, so
3509
+ * no validated locale holds them -- they read English in every
3510
+ * language, text, title and aria-label alike. */
3507
3511
  yui_shell_confirm_danger(yui_shell_of(gobj), message, {
3508
- t: t,
3509
- detail: detail
3512
+ t: t,
3513
+ detail: detail,
3514
+ confirm_label: "delete",
3515
+ cancel_label: "cancel"
3510
3516
  }).then((yes) => {
3511
3517
  if(!yes || gobj_is_destroying(gobj)) {
3512
3518
  return;
@@ -40,6 +40,7 @@ install_dom_double();
40
40
  * clicked like the operator would). */
41
41
  const shown = [];
42
42
  const modals = [];
43
+ const confirms = [];
43
44
  vi.mock("./shell_modals.js", () => ({
44
45
  yui_shell_show_error: (shell, message) => {
45
46
  shown.push(message);
@@ -53,7 +54,10 @@ vi.mock("./shell_modals.js", () => ({
53
54
  modal.closed = true;
54
55
  }};
55
56
  },
56
- yui_shell_confirm_danger: () => new Promise(() => {}),
57
+ yui_shell_confirm_danger: (shell, message, opts) => {
58
+ confirms.push({message, opts});
59
+ return new Promise(() => {});
60
+ },
57
61
  }));
58
62
 
59
63
  const {
@@ -167,6 +171,7 @@ beforeEach(() => {
167
171
  commands.length = 0;
168
172
  shown.length = 0;
169
173
  modals.length = 0;
174
+ confirms.length = 0;
170
175
  published.length = 0;
171
176
  });
172
177
 
@@ -1015,3 +1020,18 @@ describe("a confirmation answered where no treedb is open (fifth review)", () =>
1015
1020
  expect(shown).toEqual([STALE, STALE]);
1016
1021
  });
1017
1022
  });
1023
+
1024
+ describe("the answers of the editor's confirmations are i18n keys (fifth review, live)", () => {
1025
+
1026
+ /* shell_modals names each answer by its label; its defaults ("Delete",
1027
+ * "Cancel") are not lower-case, so no validated locale holds them and
1028
+ * the buttons -- and now their title and aria-label -- read English in
1029
+ * every language (seen on the deployed agent console, in Spanish). */
1030
+ test("a column delete asks with `delete` / `cancel`", () => {
1031
+ const {editor, remote, host} = build("k1", "db/users");
1032
+ gobj_send_event(editor, "EV_DELETE_COLUMN", {col: "id"}, host);
1033
+ expect(confirms.length).toBe(1);
1034
+ expect([confirms[0].opts.confirm_label, confirms[0].opts.cancel_label])
1035
+ .toEqual(["delete", "cancel"]);
1036
+ });
1037
+ });