Browse Source

Fixes #4625 - Mobile - Update text color in warnings

Vladimir Sheremet 1 year ago
parent
commit
735340cbae

+ 1 - 1
app/frontend/apps/mobile/pages/login/components/LoginTwoFactor.vue

@@ -1,7 +1,7 @@
 <!-- Copyright (C) 2012-2023 Zammad Foundation, https://zammad-foundation.org/ -->
 
 <script setup lang="ts">
-import { useNotifications } from '#shared/components/CommonNotifications/composable.ts'
+import { useNotifications } from '#shared/components/CommonNotifications/useNotifications.ts'
 import Form from '#shared/components/Form/Form.vue'
 import type { FormData, FormSchemaNode } from '#shared/components/Form/types.ts'
 import type { TwoFactorPlugin } from '#shared/entities/two-factor/types.ts'

+ 3 - 1
app/frontend/apps/mobile/pages/login/routes.ts

@@ -44,7 +44,9 @@ const route: RouteRecordRaw[] = [
         const [{ useAuthenticationStore }, { useNotifications }] =
           await Promise.all([
             import('#shared/stores/authentication.ts'),
-            import('#shared/components/CommonNotifications/composable.ts'),
+            import(
+              '#shared/components/CommonNotifications/useNotifications.ts'
+            ),
           ])
 
         const { clearAllNotifications } = useNotifications()

+ 1 - 1
app/frontend/shared/components/CommonNotifications/CommonNotifications.story.vue

@@ -3,7 +3,7 @@
 <script setup lang="ts">
 import { ref } from 'vue'
 import CommonNotifications from './CommonNotifications.vue'
-import { useNotifications } from './composable.ts'
+import { useNotifications } from './useNotifications.ts'
 import type { NewNotification } from './types.ts'
 import { NotificationTypes } from './types.ts'
 

+ 2 - 2
app/frontend/shared/components/CommonNotifications/CommonNotifications.vue

@@ -3,12 +3,12 @@
 <script setup lang="ts">
 /* eslint-disable vue/no-v-html */
 
-import { useNotifications } from '#shared/components/CommonNotifications/composable.ts'
+import { useNotifications } from '#shared/components/CommonNotifications/useNotifications.ts'
 import type { Notification } from '#shared/components/CommonNotifications/types.ts'
 import { markup } from '#shared/utils/markup.ts'
 
 const notificationTypeClassMap = {
-  warn: 'bg-yellow text-white',
+  warn: 'bg-yellow text-black',
   success: 'bg-green text-white',
   error: 'bg-red/60 text-white',
   info: 'bg-white text-black',

+ 1 - 1
app/frontend/shared/components/CommonNotifications/__tests__/CommonNotifications.spec.ts

@@ -6,7 +6,7 @@ import {
   type ExtendedRenderResult,
 } from '#tests/support/components/index.ts'
 import { waitForTimeout } from '#tests/support/utils.ts'
-import { useNotifications } from '../composable.ts'
+import { useNotifications } from '../useNotifications.ts'
 import { NotificationTypes } from '../types.ts'
 import CommonNotifications from '../CommonNotifications.vue'
 

+ 1 - 1
app/frontend/shared/components/CommonNotifications/index.ts

@@ -6,4 +6,4 @@ export {
   type NewNotification,
 } from './types.ts'
 
-export { useNotifications } from './composable.ts'
+export { useNotifications } from './useNotifications.ts'

+ 0 - 0
app/frontend/shared/components/CommonNotifications/composable.ts → app/frontend/shared/components/CommonNotifications/useNotifications.ts


+ 25 - 22
app/frontend/tests/vitest.setup.ts

@@ -63,30 +63,33 @@ vi.stubGlobal('matchMedia', (media: string) => ({
   removeEventListener: vi.fn(),
 }))
 
-vi.mock('#shared/components/CommonNotifications/composable.ts', async () => {
-  const { useNotifications: originalUseNotifications } =
-    await vi.importActual<any>(
-      '#shared/components/CommonNotifications/composable.ts',
-    )
-  let notifications: any
-  const useNotifications = () => {
-    if (notifications) return notifications
-    const result = originalUseNotifications()
-    notifications = {
-      notify: vi.fn(result.notify),
-      notifications: result.notifications,
-      removeNotification: vi.fn(result.removeNotification),
-      clearAllNotifications: vi.fn(result.clearAllNotifications),
-      hasErrors: vi.fn(result.hasErrors),
+vi.mock(
+  '#shared/components/CommonNotifications/useNotifications.ts',
+  async () => {
+    const { useNotifications: originalUseNotifications } =
+      await vi.importActual<any>(
+        '#shared/components/CommonNotifications/useNotifications.ts',
+      )
+    let notifications: any
+    const useNotifications = () => {
+      if (notifications) return notifications
+      const result = originalUseNotifications()
+      notifications = {
+        notify: vi.fn(result.notify),
+        notifications: result.notifications,
+        removeNotification: vi.fn(result.removeNotification),
+        clearAllNotifications: vi.fn(result.clearAllNotifications),
+        hasErrors: vi.fn(result.hasErrors),
+      }
+      return notifications
     }
-    return notifications
-  }
 
-  return {
-    useNotifications,
-    default: useNotifications,
-  }
-})
+    return {
+      useNotifications,
+      default: useNotifications,
+    }
+  },
+)
 
 // don't rely on tiptap, because it's not supported in JSDOM
 vi.mock(