fix(grid): simplify save action label
This commit is contained in:
parent
92b67d3136
commit
6713b471bc
|
|
@ -1,5 +1,5 @@
|
|||
export interface DataGridSaveActionMode {
|
||||
labelKey: "grid.pendingChanges";
|
||||
labelKey: "grid.commit" | "grid.save";
|
||||
tooltipKey: "grid.transactionSaveHint" | "grid.nonTransactionalSaveHint";
|
||||
secondaryActionKey: "grid.rollback" | "grid.discard";
|
||||
}
|
||||
|
|
@ -9,7 +9,7 @@ export function dataGridSaveActionMode(options: {
|
|||
useTransaction: boolean;
|
||||
}): DataGridSaveActionMode {
|
||||
return {
|
||||
labelKey: "grid.pendingChanges",
|
||||
labelKey: options.useTransaction ? "grid.commit" : "grid.save",
|
||||
tooltipKey: options.useTransaction ? "grid.transactionSaveHint" : "grid.nonTransactionalSaveHint",
|
||||
secondaryActionKey: options.useTransaction ? "grid.rollback" : "grid.discard",
|
||||
};
|
||||
|
|
|
|||
|
|
@ -2,15 +2,15 @@ import { strict as assert } from "node:assert";
|
|||
import test from "node:test";
|
||||
import { dataGridSaveActionMode } from "../../apps/desktop/src/lib/dataGridSaveUi.ts";
|
||||
|
||||
test("uses pending-change count as the primary grid save action label", () => {
|
||||
test("uses concise save and commit labels for the primary grid save action", () => {
|
||||
assert.deepEqual(dataGridSaveActionMode({ pendingChangeCount: 3, useTransaction: true }), {
|
||||
labelKey: "grid.pendingChanges",
|
||||
labelKey: "grid.commit",
|
||||
tooltipKey: "grid.transactionSaveHint",
|
||||
secondaryActionKey: "grid.rollback",
|
||||
});
|
||||
|
||||
assert.deepEqual(dataGridSaveActionMode({ pendingChangeCount: 3, useTransaction: false }), {
|
||||
labelKey: "grid.pendingChanges",
|
||||
labelKey: "grid.save",
|
||||
tooltipKey: "grid.nonTransactionalSaveHint",
|
||||
secondaryActionKey: "grid.discard",
|
||||
});
|
||||
|
|
|
|||
Loading…
Reference in New Issue