diff --git a/package-lock.json b/package-lock.json index d26fafd..2a31832 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "anvil", - "version": "0.0.8", + "version": "0.0.10", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "anvil", - "version": "0.0.8", + "version": "0.0.10", "dependencies": { "@floating-ui/dom": "1.6.7", "axios": "1.7.2", diff --git a/package.json b/package.json index c9dd8cf..e7c7f2c 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "anvil", - "version": "0.0.8", + "version": "0.0.10", "private": true, "scripts": { "dev": "vite dev", diff --git a/src/lib/components/atoms/SettingsSidebar.svelte b/src/lib/components/atoms/SettingsSidebar.svelte new file mode 100644 index 0000000..9ff3aaf --- /dev/null +++ b/src/lib/components/atoms/SettingsSidebar.svelte @@ -0,0 +1,125 @@ + + + + + + + {$_('settings.headline')} + + + + + + {$_('settings.profile.label')} + + + + + + {$_('settings.account.label')} + + + + + + {$_('settings.ssh_gpg_keys.label')} + + + + + + {$_('settings.appearance.label')} + + + + + + {$_('settings.notifications.label')} + + + + + Matrix + + + ForgeFed + + + Code + + + diff --git a/src/lib/i18n/locales/bg.json b/src/lib/i18n/locales/bg.json index 05dba7c..618593a 100644 --- a/src/lib/i18n/locales/bg.json +++ b/src/lib/i18n/locales/bg.json @@ -172,5 +172,23 @@ }, "reset": "" } + }, + "settings": { + "headline": "", + "account": { + "label": "" + }, + "appearance": { + "label": "" + }, + "notifications": { + "label": "" + }, + "profile": { + "label": "" + }, + "ssh_gpg_keys": { + "label": "" + } } } diff --git a/src/lib/i18n/locales/de.json b/src/lib/i18n/locales/de.json index 416332c..bea851d 100644 --- a/src/lib/i18n/locales/de.json +++ b/src/lib/i18n/locales/de.json @@ -172,5 +172,23 @@ }, "reset": "" } + }, + "settings": { + "headline": "", + "account": { + "label": "" + }, + "appearance": { + "label": "" + }, + "notifications": { + "label": "" + }, + "profile": { + "label": "" + }, + "ssh_gpg_keys": { + "label": "" + } } } diff --git a/src/lib/i18n/locales/en.json b/src/lib/i18n/locales/en.json index e99df8a..d995f26 100644 --- a/src/lib/i18n/locales/en.json +++ b/src/lib/i18n/locales/en.json @@ -172,5 +172,23 @@ }, "reset": "Reset passphrase" } + }, + "settings": { + "headline": "Settings", + "account": { + "label": "Account" + }, + "appearance": { + "label": "Appearance" + }, + "notifications": { + "label": "Notifications" + }, + "profile": { + "label": "Profile" + }, + "ssh_gpg_keys": { + "label": "SSH/GPG Keys" + } } } diff --git a/src/lib/i18n/locales/he.json b/src/lib/i18n/locales/he.json index f18d46b..3669218 100644 --- a/src/lib/i18n/locales/he.json +++ b/src/lib/i18n/locales/he.json @@ -172,5 +172,23 @@ }, "reset": "" } + }, + "settings": { + "headline": "", + "account": { + "label": "" + }, + "appearance": { + "label": "" + }, + "notifications": { + "label": "" + }, + "profile": { + "label": "" + }, + "ssh_gpg_keys": { + "label": "" + } } } diff --git a/src/lib/i18n/locales/pl.json b/src/lib/i18n/locales/pl.json index 6eb5eaa..85bac85 100644 --- a/src/lib/i18n/locales/pl.json +++ b/src/lib/i18n/locales/pl.json @@ -172,5 +172,23 @@ }, "reset": "" } + }, + "settings": { + "headline": "", + "account": { + "label": "" + }, + "appearance": { + "label": "" + }, + "notifications": { + "label": "" + }, + "profile": { + "label": "" + }, + "ssh_gpg_keys": { + "label": "" + } } } diff --git a/tests/components/atoms/SettingsSidebar.test.ts b/tests/components/atoms/SettingsSidebar.test.ts new file mode 100644 index 0000000..d41bcac --- /dev/null +++ b/tests/components/atoms/SettingsSidebar.test.ts @@ -0,0 +1,125 @@ +/* Component test for SettingsSidebar atom. + * Copyright (C) 2024 André Jaenisch + * SPDX-FileCopyrightText: 2024 André Jaenisch + * SPDX-License-Identifier: AGPL-3.0-or-later + * + * This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License along with this program. If not, see . + */ + +import '@testing-library/jest-dom'; +import { render, screen } from '@testing-library/svelte'; +import { get, readable } from 'svelte/store'; +import { init, locale, register } from 'svelte-i18n'; + +import SettingsSidebar from '../../../src/lib/components/atoms/SettingsSidebar.svelte'; +import enMessages from '../../../src/lib/i18n/locales/en.json'; + +describe('SettingsSidebar.svelte', () => { + beforeEach(() => { + register('en', () => import('../../../src/lib/i18n/locales/en.json')); + init({ fallbackLocale: 'en', initialLocale: 'en' }); + locale.set('en'); + }); + + it('should mount', () => { + // Arrange + // See https://testing-library.com/docs/svelte-testing-library/example#contexts + const drawerStore = readable([]); + + // Act + const { container } = render(SettingsSidebar, { + context: new Map([['drawerStore', drawerStore]]) + }); + + // Assert + expect(container).toBeTruthy(); + }); + + it('should have a headline', () => { + // Arrange + // See https://testing-library.com/docs/svelte-testing-library/example#contexts + const drawerStore = readable([]); + + // Act + render(SettingsSidebar, { + context: new Map([['drawerStore', drawerStore]]) + }); + + // Assert + expect(screen.getByText(enMessages.settings.headline)).toBeInTheDocument(); + }); + + it('should have a profile tile', () => { + // Arrange + // See https://testing-library.com/docs/svelte-testing-library/example#contexts + const drawerStore = readable([]); + + // Act + render(SettingsSidebar, { + context: new Map([['drawerStore', drawerStore]]) + }); + + // Assert + expect(screen.getByText(enMessages.settings.profile.label)).toBeInTheDocument(); + }); + + it('should have an account tile', () => { + // Arrange + // See https://testing-library.com/docs/svelte-testing-library/example#contexts + const drawerStore = readable([]); + + // Act + render(SettingsSidebar, { + context: new Map([['drawerStore', drawerStore]]) + }); + + // Assert + expect(screen.getByText(enMessages.settings.account.label)).toBeInTheDocument(); + }); + + it('should have a SSH/GPG keys tile', () => { + // Arrange + // See https://testing-library.com/docs/svelte-testing-library/example#contexts + const drawerStore = readable([]); + + // Act + render(SettingsSidebar, { + context: new Map([['drawerStore', drawerStore]]) + }); + + // Assert + expect(screen.getByText(enMessages.settings.ssh_gpg_keys.label)).toBeInTheDocument(); + }); + + it('should have an appearance tile', () => { + // Arrange + // See https://testing-library.com/docs/svelte-testing-library/example#contexts + const drawerStore = readable([]); + + // Act + render(SettingsSidebar, { + context: new Map([['drawerStore', drawerStore]]) + }); + + // Assert + expect(screen.getByText(enMessages.settings.appearance.label)).toBeInTheDocument(); + }); + + it('should have a notifications tile', () => { + // Arrange + // See https://testing-library.com/docs/svelte-testing-library/example#contexts + const drawerStore = readable([]); + + // Act + render(SettingsSidebar, { + context: new Map([['drawerStore', drawerStore]]) + }); + + // Assert + expect(screen.getByText(enMessages.settings.notifications.label)).toBeInTheDocument(); + }); +});