mirror of
https://github.com/Studio-Saelix/sencho.git
synced 2026-09-04 14:45:41 +00:00
feat: add Reduced motion setting and polish chrome, files, and stack-detail (#1501)
A batch of UI/UX polish: - New independent "Reduced motion" appearance setting (separate from Reduced effects). Drives framer-motion via MotionConfig and clamps CSS transitions via data-motion on <html>; toasts are unaffected. Defaults off (OS preference still honored). - Stack-detail Files tab: rename "Files & Volumes" to "Files", add a persisted word-wrap toggle to the file viewer (default on), and add a fullscreen toggle that collapses the Command Center + Logs column so the editor fills the width. - Create Stack > From Git: remove the nested scroll clamp so the deploy toggle and footer are reachable. - Fleet: full-width tab band with icon-only Refresh / Export Dossier, icon-only Check-for-updates / Add-node on the Overview toolbar, theme-aware empty-state headings (calm drops the italic), and fix the Actions card body overlapping the action-row divider. - Snapshots: restyle Restore and Restore all to the ghost button design used by View / Preview / Download, and right-align the per-stack Restore. - Settings sidebar: App Store gradient active style and standard font size. - Compose Doctor: dismiss the high-risk banner (and clear the tab dot) until the findings change, via a shared fingerprint-keyed hook. - Stack-detail Storage: link the "no recent fleet snapshot" warning to the Fleet Snapshots tab (FleetView tabs are now controlled to support the deep link).
This commit is contained in:
@@ -0,0 +1,50 @@
|
||||
import { describe, it, expect, beforeEach } from 'vitest';
|
||||
import { renderHook, act } from '@testing-library/react';
|
||||
import { usePreflightDismiss } from '../usePreflightDismiss';
|
||||
|
||||
const findings = (sev: string) => [
|
||||
{ ruleId: 'DS001', severity: sev, service: 'web' },
|
||||
{ ruleId: 'DS002', severity: 'warning' },
|
||||
];
|
||||
|
||||
describe('usePreflightDismiss', () => {
|
||||
beforeEach(() => localStorage.clear());
|
||||
|
||||
it('is not dismissed until dismiss() is called', () => {
|
||||
const { result } = renderHook(() => usePreflightDismiss('app', 1, findings('high')));
|
||||
expect(result.current.dismissed).toBe(false);
|
||||
act(() => result.current.dismiss());
|
||||
expect(result.current.dismissed).toBe(true);
|
||||
});
|
||||
|
||||
it('stays dismissed for an identical finding set (order-independent)', () => {
|
||||
const first = renderHook(() => usePreflightDismiss('app', 1, findings('high')));
|
||||
act(() => first.result.current.dismiss());
|
||||
// A fresh consumer with the same findings in a different order reads dismissed.
|
||||
const reordered = [...findings('high')].reverse();
|
||||
const second = renderHook(() => usePreflightDismiss('app', 1, reordered));
|
||||
expect(second.result.current.dismissed).toBe(true);
|
||||
});
|
||||
|
||||
it('re-surfaces when the findings change', () => {
|
||||
const first = renderHook(() => usePreflightDismiss('app', 1, findings('high')));
|
||||
act(() => first.result.current.dismiss());
|
||||
// Severity changed -> different fingerprint -> not dismissed.
|
||||
const changed = renderHook(() => usePreflightDismiss('app', 1, findings('blocker')));
|
||||
expect(changed.result.current.dismissed).toBe(false);
|
||||
});
|
||||
|
||||
it('keys per stack and node', () => {
|
||||
const a = renderHook(() => usePreflightDismiss('app', 1, findings('high')));
|
||||
act(() => a.result.current.dismiss());
|
||||
expect(renderHook(() => usePreflightDismiss('other', 1, findings('high'))).result.current.dismissed).toBe(false);
|
||||
expect(renderHook(() => usePreflightDismiss('app', 2, findings('high'))).result.current.dismissed).toBe(false);
|
||||
});
|
||||
|
||||
it('treats an empty finding set as never dismissed', () => {
|
||||
const { result } = renderHook(() => usePreflightDismiss('app', 1, []));
|
||||
expect(result.current.dismissed).toBe(false);
|
||||
act(() => result.current.dismiss());
|
||||
expect(result.current.dismissed).toBe(false);
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user