1
0

Additional test, remove .adds/scripts too

This commit is contained in:
2026-03-21 19:49:11 +01:00
parent 8645a2d626
commit 03d13962d6
2 changed files with 48 additions and 1 deletions

View File

@@ -430,6 +430,49 @@ test.describe('NickelMenu', () => {
// Screensaver should NOT be removed (unchecked)
expect(await mockPathExists(page, '.kobo', 'screensaver', 'moon.png')).toBe(true);
});
test('with device — remove NickelMenu, go back, checklist preserved', async ({ page }) => {
test.skip(!hasNickelMenuAssets(), 'NickelMenu assets not found in webroot');
await connectMockDevice(page, {
hasNickelMenu: true,
hasKoreader: true,
hasReaderlyFonts: true,
});
await page.click('#btn-device-next');
await page.click('#btn-mode-next');
// NickelMenu configure step
await expect(page.locator('#step-nickelmenu')).not.toBeHidden();
// Select remove
await page.click('input[name="nm-option"][value="remove"]');
// Uninstall checkboxes should appear
await expect(page.locator('#nm-uninstall-options')).not.toBeHidden();
await expect(page.locator('input[name="nm-uninstall-koreader"]')).toBeChecked();
await expect(page.locator('input[name="nm-uninstall-readerly-fonts"]')).toBeChecked();
// Uncheck one option
await page.uncheck('input[name="nm-uninstall-readerly-fonts"]');
await page.click('#btn-nm-next');
// Review step
await expect(page.locator('#step-nm-review')).not.toBeHidden();
await expect(page.locator('#nm-review-summary')).toContainText('removal');
// Go back
await page.click('#btn-nm-review-back');
// Checklist should still be visible with preserved state
await expect(page.locator('#step-nickelmenu')).not.toBeHidden();
await expect(page.locator('#nm-uninstall-options')).not.toBeHidden();
await expect(page.locator('input[name="nm-uninstall-koreader"]')).toBeChecked();
// Readerly should still be unchecked (state preserved)
await expect(page.locator('input[name="nm-uninstall-readerly-fonts"]')).not.toBeChecked();
});
});
// ============================================================

View File

@@ -618,7 +618,6 @@ import JSZip from 'jszip';
}
function goToNickelMenuConfig() {
checkNickelMenuInstalled();
renderFeatureCheckboxes();
const currentOption = $q('input[name="nm-option"]:checked', stepNickelMenu);
nmConfigOptions.hidden = !currentOption || currentOption.value !== 'preset';
@@ -716,6 +715,11 @@ import JSZip from 'jszip';
} catch {
// ignore — folder may already be gone
}
try {
await device.removeEntry(['.adds', 'scripts'], { recursive: true });
} catch {
// ignore — folder may already be gone
}
nmProgress.textContent = 'Creating uninstall marker...';
await device.writeFile(['.adds', 'nm', 'uninstall'], new Uint8Array(0));