feat(history): expose complete history deletion
Add a permanent danger action to the History toolbar so users can clear all saved entries without selecting rows or expanding the sidebar. Reuse the existing confirmation and storage path, disable the action while history is empty or loading, localize the label in English, and cover the interaction with focused regression tests.
This commit is contained in:
@@ -513,7 +513,26 @@ describe("HistoryView", () => {
|
||||
]);
|
||||
});
|
||||
|
||||
it("renders expanded paths and URLs as copyable details without changing the 48px main-row contract", () => {
|
||||
it("keeps the full-history delete action visible without a selection and disables it only for unavailable history", () => {
|
||||
const calls: string[] = [];
|
||||
const populated = buildHistoryViewModel(entries, "all", "", [], [], false, "", now);
|
||||
const empty = buildHistoryViewModel([], "all", "", [], [], false, "", now);
|
||||
const loading = buildHistoryViewModel(entries, "all", "", [], [], true, "", now);
|
||||
const actions = createActions({ onClearHistory: () => calls.push("clear-history") });
|
||||
|
||||
const populatedButton = findButton(HistoryToolbar({ actions, model: populated }), "Gesamtverlauf löschen");
|
||||
const emptyButton = findButton(HistoryToolbar({ actions, model: empty }), "Gesamtverlauf löschen");
|
||||
const loadingButton = findButton(HistoryToolbar({ actions, model: loading }), "Gesamtverlauf löschen");
|
||||
|
||||
expect(populatedButton.props.className).toContain("history-action-danger");
|
||||
expect(populatedButton.props.disabled).toBe(false);
|
||||
expect(emptyButton.props.disabled).toBe(true);
|
||||
expect(loadingButton.props.disabled).toBe(true);
|
||||
populatedButton.props.onClick();
|
||||
expect(calls).toEqual(["clear-history"]);
|
||||
});
|
||||
|
||||
it("renders expanded paths and URLs as copyable details without changing the 48px main-row contract", () => {
|
||||
const html = renderToStaticMarkup(
|
||||
<HistoryView
|
||||
actions={createActions()}
|
||||
|
||||
@@ -31,6 +31,7 @@ describe("renderer localization", () => {
|
||||
["Gelöscht", "Deleted"],
|
||||
["Fehlgeschlagen", "Failed"],
|
||||
["Verlauf leeren", "Clear history"],
|
||||
["Gesamtverlauf löschen", "Delete all history"],
|
||||
["Erneut hinzufügen", "Add again"],
|
||||
["Im Ordner zeigen", "Show in folder"],
|
||||
["Auswahl löschen", "Clear selection"],
|
||||
|
||||
Reference in New Issue
Block a user