diff options
| author | godosa <godosa@godosa.eu> | 2026-10-07 00:14:38 +0200 |
|---|---|---|
| committer | godosa <godosa@godosa.eu> | 2026-10-07 00:14:38 +0200 |
| commit | 3443c1c65e9f1753e1e656b35d08416c1fa298f2 (patch) | |
| tree | 4e43236f460145a4d75d1b4616dcb7aa6ef08f51 /viewer/tests/public.test.mjs | |
| download | worldmap-viewer-3443c1c65e9f1753e1e656b35d08416c1fa298f2.tar.gz worldmap-viewer-3443c1c65e9f1753e1e656b35d08416c1fa298f2.zip | |
worldmap-viewer: initial public history
Diffstat (limited to 'viewer/tests/public.test.mjs')
| -rw-r--r-- | viewer/tests/public.test.mjs | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/viewer/tests/public.test.mjs b/viewer/tests/public.test.mjs new file mode 100644 index 0000000..04ded8c --- /dev/null +++ b/viewer/tests/public.test.mjs @@ -0,0 +1,18 @@ +import { test } from 'node:test'; +import assert from 'node:assert/strict'; + +const { hiddenTabs, hideTabs } = await import('../js/public.js'); + +test('a read-only map hides the editing tabs; a private one hides none', () => { + assert.deepEqual(hiddenTabs({ read_only: true }), ['pins', 'regions', 'export']); + assert.deepEqual(hiddenTabs({ read_only: false }), []); + assert.deepEqual(hiddenTabs({}), []); + assert.deepEqual(hiddenTabs(null), []); +}); + +test('hideTabs removes the buttons and sections it names', () => { + const removed = []; + const doc = { querySelector: sel => ({ remove: () => removed.push(sel) }) }; + hideTabs(doc, ['pins']); + assert.deepEqual(removed, ['#panel nav [data-tab="pins"]', '#tab-pins']); +}); |
