diff --git a/resources/assets/js/components/auth/LoginForm.vue b/resources/assets/js/components/auth/LoginForm.vue
index b31d69d2..93f99134 100644
--- a/resources/assets/js/components/auth/LoginForm.vue
+++ b/resources/assets/js/components/auth/LoginForm.vue
@@ -22,8 +22,8 @@ const DEMO_ACCOUNT = {
}
const url = ref('')
-const email = ref(isDemo ? DEMO_ACCOUNT.email : '')
-const password = ref(isDemo ? DEMO_ACCOUNT.password : '')
+const email = ref(isDemo() ? DEMO_ACCOUNT.email : '')
+const password = ref(isDemo() ? DEMO_ACCOUNT.password : '')
const failed = ref(false)
const emit = defineEmits(['loggedin'])
diff --git a/resources/assets/js/components/layout/main-wrapper/ExtraPanel.spec.ts b/resources/assets/js/components/layout/main-wrapper/ExtraPanel.spec.ts
index b2ed7979..f01e0d5c 100644
--- a/resources/assets/js/components/layout/main-wrapper/ExtraPanel.spec.ts
+++ b/resources/assets/js/components/layout/main-wrapper/ExtraPanel.spec.ts
@@ -61,6 +61,14 @@ new class extends UnitTestCase {
expect(emitMock).toHaveBeenCalledWith('MODAL_SHOW_ABOUT_KOEL')
})
+ it('notifies new version', async () => {
+ it('shows new version', () => {
+ commonStore.state.current_version = 'v1.0.0'
+ commonStore.state.latest_version = 'v1.0.1'
+ this.actingAsAdmin().renderComponent().getByTitle('New version available!')
+ })
+ })
+
it('logs out', async () => {
const emitMock = this.mock(eventBus, 'emit')
const { getByTitle } = this.renderComponent()
diff --git a/resources/assets/js/components/layout/main-wrapper/ExtraPanel.vue b/resources/assets/js/components/layout/main-wrapper/ExtraPanel.vue
index 66f06ecf..bb79ee21 100644
--- a/resources/assets/js/components/layout/main-wrapper/ExtraPanel.vue
+++ b/resources/assets/js/components/layout/main-wrapper/ExtraPanel.vue
@@ -7,8 +7,14 @@
-
diff --git a/resources/assets/js/components/meta/AboutKoelModal.spec.ts b/resources/assets/js/components/meta/AboutKoelModal.spec.ts
index 5a182042..f16fe89d 100644
--- a/resources/assets/js/components/meta/AboutKoelModal.spec.ts
+++ b/resources/assets/js/components/meta/AboutKoelModal.spec.ts
@@ -1,6 +1,8 @@
import { expect, it } from 'vitest'
import { commonStore } from '@/stores'
import UnitTestCase from '@/__tests__/UnitTestCase'
+import { http } from '@/services'
+import { waitFor } from '@testing-library/vue'
import AboutKoelModel from './AboutKoelModal.vue'
new class extends UnitTestCase {
@@ -15,13 +17,20 @@ new class extends UnitTestCase {
it('shows new version', () => {
commonStore.state.current_version = 'v1.0.0'
commonStore.state.latest_version = 'v1.0.1'
- this.actingAsAdmin().render(AboutKoelModel).findByTestId('new-version-about')
+ this.actingAsAdmin().render(AboutKoelModel).getByTestId('new-version-about')
})
- it('shows demo notation', () => {
+ it('shows demo notation', async () => {
+ const getMock = this.mock(http, 'get').mockResolvedValue([])
// @ts-ignore
import.meta.env.VITE_KOEL_ENV = 'demo'
- this.render(AboutKoelModel).findByTestId('demo-credits')
+
+ const { getByTestId } = this.render(AboutKoelModel)
+
+ await waitFor(() => {
+ getByTestId('demo-credits')
+ expect(getMock).toHaveBeenCalledWith('demo/credits')
+ })
})
}
}
diff --git a/resources/assets/js/components/meta/AboutKoelModal.vue b/resources/assets/js/components/meta/AboutKoelModal.vue
index 37377230..096181d4 100644
--- a/resources/assets/js/components/meta/AboutKoelModal.vue
+++ b/resources/assets/js/components/meta/AboutKoelModal.vue
@@ -21,11 +21,11 @@
Made with ❤️ by
Phan An
and quite a few
- awesome
- contributors.
+ awesome contributors.
-
+
Music by
-
@@ -75,7 +75,7 @@ const emit = defineEmits(['close'])
const close = () => emit('close')
onMounted(async () => {
- credits.value = isDemo ? orderBy(await http.get('demo/credits'), 'name') : []
+ credits.value = isDemo() ? orderBy(await http.get('demo/credits'), 'name') : []
})
diff --git a/resources/assets/js/components/meta/__snapshots__/AboutKoelModal.spec.ts.snap b/resources/assets/js/components/meta/__snapshots__/AboutKoelModal.spec.ts.snap
index f13cc799..9dbe859e 100644
--- a/resources/assets/js/components/meta/__snapshots__/AboutKoelModal.spec.ts.snap
+++ b/resources/assets/js/components/meta/__snapshots__/AboutKoelModal.spec.ts.snap
@@ -9,7 +9,7 @@ exports[`renders 1`] = `
v0.0.0
- Made with ❤️ by Phan An and quite a few awesomecontributors.
+ Made with ❤️ by Phan An and quite a few awesome contributors.
Loving Koel? Please consider supporting its development via GitHub Sponsors and/or OpenCollective.
diff --git a/resources/assets/js/components/profile-preferences/ProfileForm.vue b/resources/assets/js/components/profile-preferences/ProfileForm.vue
index 070264c6..9677e965 100644
--- a/resources/assets/js/components/profile-preferences/ProfileForm.vue
+++ b/resources/assets/js/components/profile-preferences/ProfileForm.vue
@@ -79,7 +79,7 @@ const update = async () => {
throw Error()
}
- if (isDemo) {
+ if (isDemo()) {
toaster.value.success('Profile updated.')
return
}
diff --git a/resources/assets/js/utils/common.ts b/resources/assets/js/utils/common.ts
index 55eb8bc7..ea3b341f 100644
--- a/resources/assets/js/utils/common.ts
+++ b/resources/assets/js/utils/common.ts
@@ -40,4 +40,4 @@ export const copyText = (text: string): void => {
document.execCommand('copy')
}
-export const isDemo = import.meta.env.VITE_KOEL_ENV === 'demo'
+export const isDemo = () => import.meta.env.VITE_KOEL_ENV === 'demo'