|
|
@@ -12,6 +12,36 @@ function LocationProbe() {
|
|
|
}
|
|
|
|
|
|
describe('SubscriptionGeneralTab', () => {
|
|
|
+ it('keeps the stored subscription port when the field is cleared', () => {
|
|
|
+ const updateSetting = vi.fn();
|
|
|
+
|
|
|
+ renderWithProviders(
|
|
|
+ <MemoryRouter initialEntries={['/settings#subscription']}>
|
|
|
+ <SubscriptionGeneralTab allSetting={new AllSetting({ subPort: 2096 })} updateSetting={updateSetting} />
|
|
|
+ </MemoryRouter>,
|
|
|
+ );
|
|
|
+
|
|
|
+ const portInput = screen.getByDisplayValue('2096');
|
|
|
+ fireEvent.change(portInput, { target: { value: '' } });
|
|
|
+ fireEvent.blur(portInput);
|
|
|
+
|
|
|
+ expect(updateSetting).not.toHaveBeenCalled();
|
|
|
+ });
|
|
|
+
|
|
|
+ it('forwards typed subscription ports unchanged', () => {
|
|
|
+ const updateSetting = vi.fn();
|
|
|
+
|
|
|
+ renderWithProviders(
|
|
|
+ <MemoryRouter initialEntries={['/settings#subscription']}>
|
|
|
+ <SubscriptionGeneralTab allSetting={new AllSetting({ subPort: 2096 })} updateSetting={updateSetting} />
|
|
|
+ </MemoryRouter>,
|
|
|
+ );
|
|
|
+
|
|
|
+ fireEvent.change(screen.getByDisplayValue('2096'), { target: { value: '8443' } });
|
|
|
+
|
|
|
+ expect(updateSetting).toHaveBeenCalledWith({ subPort: 8443 });
|
|
|
+ });
|
|
|
+
|
|
|
it('uses router navigation to open subscription format settings', () => {
|
|
|
const allSetting = new AllSetting({ subClashEnable: true });
|
|
|
|