Skip to content

Commit

Permalink
fix ts and specs
Browse files Browse the repository at this point in the history
  • Loading branch information
cars10 committed Oct 15, 2024
1 parent c14eeab commit 0b191bf
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 9 deletions.
10 changes: 5 additions & 5 deletions src/components/base/ThemeSwitcher.vue
Original file line number Diff line number Diff line change
Expand Up @@ -29,19 +29,19 @@
</template>

<script setup lang="ts">
import { useThemeStore } from '../../store/theme.js'
import { ThemePreferences, useThemeStore } from '../../store/theme.js'
import { computed } from 'vue'
import { useTranslation } from '../../composables/i18n.ts'
import { setAppThemeCss } from '../../helpers/theme.ts'
const themeStore = useThemeStore()
const t = useTranslation()
const themes = {
light: 'light_mode',
dark: 'dark_mode',
auto: 'brightness_medium'
[ThemePreferences.light]: 'light_mode',
[ThemePreferences.dark]: 'dark_mode',
[ThemePreferences.auto]: 'brightness_medium'
}
const changeTheme = (theme) => {
const changeTheme = (theme: ThemePreferences) => {
themeStore.setPreference(theme)
setAppThemeCss(themeStore.appTheme)
}
Expand Down
2 changes: 1 addition & 1 deletion src/store/theme.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ export enum AppThemes {
dark = 'dark'
}

type ThemeState = {
export type ThemeState = {
preference: ThemePreferences,
appTheme: AppThemes
}
Expand Down
7 changes: 4 additions & 3 deletions tests/e2e/tests/pages/Base.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,9 @@ test.describe('base', () => {

test('can change to dark theme', async ({ page }) => {
await openElasticvue(page)
const body = await page.locator('body')
page.getByTestId('change-theme-button').click()
const body = page.locator('body')
await page.getByTestId('change-theme-button').click()
await page.getByTestId('change-theme__dark').click()

await expect(body).toHaveClass(/theme--dark/)
await expect(body).not.toHaveClass(/theme--light/)
Expand All @@ -31,7 +32,7 @@ test.describe('base', () => {
test.describe('language', () => {
test('defaults to english', async ({ page }) => {
await openElasticvue(page)
page.getByTestId('change-language-button').click()
await page.getByTestId('change-language-button').click()

await expect(page.getByTestId('change-language__en')).toHaveClass(/q-item--active/)
})
Expand Down

0 comments on commit 0b191bf

Please sign in to comment.