feat(reader): manage rules shortcut in proofread popup (#4062)

This commit is contained in:
Huang Xin
2026-05-05 16:01:26 +08:00
committed by GitHub
parent 43f72720f2
commit d66fedcab7
5 changed files with 48 additions and 10 deletions
@@ -233,4 +233,23 @@ describe('ProofreadPopup Component', () => {
expect(mockOnClose).not.toHaveBeenCalled();
});
});
describe('Manage Replacement Rules Shortcut', () => {
it('should not render manage button when onManage is not provided', () => {
renderWithProviders(<ProofreadPopup {...defaultProps} />);
expect(screen.queryByLabelText('Proofread Replacement Rules')).toBeNull();
});
it('should render manage button and invoke onManage when provided', () => {
const mockOnManage = vi.fn();
renderWithProviders(<ProofreadPopup {...defaultProps} onManage={mockOnManage} />);
const button = screen.getByLabelText('Proofread Replacement Rules');
expect(button).toBeTruthy();
fireEvent.click(button);
expect(mockOnManage).toHaveBeenCalledTimes(1);
});
});
});