mirror of
https://github.com/bitsocialnet/5chan.git
synced 2026-08-03 07:41:04 +02:00
fix(settings): move pure p2p toggle below fields
This commit is contained in:
@@ -81,6 +81,12 @@ const clickButton = async (text: string) => {
|
|||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const getSaveAdvancedSettingsButton = () => {
|
||||||
|
const button = Array.from(container.querySelectorAll('button')).find((candidate) => candidate.textContent === 'save_advanced_settings');
|
||||||
|
expect(button).toBeTruthy();
|
||||||
|
return button as HTMLButtonElement;
|
||||||
|
};
|
||||||
|
|
||||||
describe('AdvancedSettings', () => {
|
describe('AdvancedSettings', () => {
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
vi.clearAllMocks();
|
vi.clearAllMocks();
|
||||||
@@ -199,6 +205,7 @@ describe('AdvancedSettings', () => {
|
|||||||
expect(checkbox?.checked).toBe(false);
|
expect(checkbox?.checked).toBe(false);
|
||||||
expect(container.textContent).not.toContain('pure P2P:');
|
expect(container.textContent).not.toContain('pure P2P:');
|
||||||
expect(checkbox?.closest('label')?.nextElementSibling?.textContent).toBe('enable_pure_p2p_tip');
|
expect(checkbox?.closest('label')?.nextElementSibling?.textContent).toBe('enable_pure_p2p_tip');
|
||||||
|
expect(getSaveAdvancedSettingsButton().previousElementSibling).toBe(checkbox?.closest('div'));
|
||||||
|
|
||||||
await act(async () => {
|
await act(async () => {
|
||||||
checkbox?.click();
|
checkbox?.click();
|
||||||
|
|||||||
@@ -317,7 +317,6 @@ const AdvancedSettings = () => {
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<div className={styles.content}>
|
<div className={styles.content}>
|
||||||
{canConfigureBrowserPureP2P() && <PureP2PBrowserSettings pureP2PBrowserRef={pureP2PBrowserRef} />}
|
|
||||||
<div className={styles.category}>
|
<div className={styles.category}>
|
||||||
<span className={styles.categoryTitle}>IPFS gateways:</span>
|
<span className={styles.categoryTitle}>IPFS gateways:</span>
|
||||||
<span className={styles.categorySettings}>
|
<span className={styles.categorySettings}>
|
||||||
@@ -358,6 +357,7 @@ const AdvancedSettings = () => {
|
|||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
|
{canConfigureBrowserPureP2P() && <PureP2PBrowserSettings pureP2PBrowserRef={pureP2PBrowserRef} />}
|
||||||
<button className={styles.saveOptions} onClick={handleSave}>
|
<button className={styles.saveOptions} onClick={handleSave}>
|
||||||
{t('save_advanced_settings')}
|
{t('save_advanced_settings')}
|
||||||
</button>
|
</button>
|
||||||
|
|||||||
Reference in New Issue
Block a user