feat(ui): refresh dashboard and paper boat branding
This commit is contained in:
1 parent
308332eb94
commit
1752a5b685
93 files changed
+11134
-7543
No files matched your search
@@ -27,8 +27,6 @@ interface DashboardLayoutInstance extends ComponentPublicInstance {
|
||||
currentUser: {
|
||||
is_online: boolean
|
||||
}
|
||||
showSettings: boolean
|
||||
showUserMenu: boolean
|
||||
showNotifications: boolean
|
||||
userName: string
|
||||
userRole: string
|
||||
@@ -146,47 +144,28 @@ describe('DashboardLayout', () => {
|
||||
expect(wrapper.classes()).toContain('sidebar-collapsed')
|
||||
})
|
||||
|
||||
it('displays user information correctly', async () => {
|
||||
const vm = wrapper.vm as unknown as DashboardLayoutInstance
|
||||
await wrapper.vm.$nextTick()
|
||||
|
||||
expect(vm.userName).toBe('Test User')
|
||||
expect(vm.userRole).toBe('Admin')
|
||||
|
||||
// Find name element in the sidebar-open state
|
||||
const userInfo = wrapper.find('.user-info')
|
||||
if (userInfo.exists()) {
|
||||
expect(userInfo.find('.name').text()).toBe('Test User')
|
||||
} else {
|
||||
// If user-info is not visible (responsive design), just verify the data
|
||||
expect(vm.userName).toBe('Test User')
|
||||
}
|
||||
})
|
||||
|
||||
it('shows user menu when clicking profile', async () => {
|
||||
const profileTrigger = wrapper.find('.profile-trigger')
|
||||
expect(wrapper.find('.dropdown-menu').exists()).toBe(false)
|
||||
|
||||
await profileTrigger.trigger('click')
|
||||
expect(wrapper.find('.dropdown-menu').exists()).toBe(true)
|
||||
it('renders the workspace topbar with the current page title', async () => {
|
||||
const topbar = wrapper.find('.topbar')
|
||||
expect(topbar.exists()).toBe(true)
|
||||
expect(topbar.find('.crumb').exists()).toBe(true)
|
||||
// '/' is not a titled page, so the crumb keeps its group but no leaf
|
||||
expect(topbar.find('.crumb').text()).toContain('工作台')
|
||||
})
|
||||
|
||||
it('shows notification badge with correct count', async () => {
|
||||
await wrapper.vm.$nextTick() // Wait for mounted hook
|
||||
const badge = wrapper.find('.notification-badge')
|
||||
const badge = wrapper.find('.topbar .badge-float')
|
||||
expect(badge.exists()).toBe(true)
|
||||
expect(badge.text()).toBe('5')
|
||||
})
|
||||
|
||||
it('toggles online status correctly', async () => {
|
||||
it('toggles online status from the presence control', async () => {
|
||||
const vm = wrapper.vm as unknown as DashboardLayoutInstance
|
||||
const profileTrigger = wrapper.find('.profile-trigger')
|
||||
await profileTrigger.trigger('click')
|
||||
|
||||
const statusToggle = wrapper.find('.status-toggle')
|
||||
expect(statusToggle.classes()).toContain('online')
|
||||
|
||||
await statusToggle.trigger('click')
|
||||
const presence = wrapper.find('.presence')
|
||||
expect(presence.exists()).toBe(true)
|
||||
expect(presence.attributes('data-state')).toBe('online')
|
||||
|
||||
await presence.trigger('click')
|
||||
expect(vm.currentUser.is_online).toBe(false)
|
||||
})
|
||||
|
||||
@@ -195,16 +174,12 @@ describe('DashboardLayout', () => {
|
||||
expect(true).toBe(true)
|
||||
})
|
||||
|
||||
it('closes menus when route changes', async () => {
|
||||
it('closes the notification drawer when the route changes', async () => {
|
||||
const vm = wrapper.vm as any
|
||||
// Open menus first
|
||||
vm.showUserMenu = true
|
||||
vm.showNotifications = true
|
||||
|
||||
// Trigger route change
|
||||
|
||||
await router.push('/new-route')
|
||||
|
||||
expect(vm.showUserMenu).toBe(false)
|
||||
|
||||
expect(vm.showNotifications).toBe(false)
|
||||
})
|
||||
|
||||
@@ -217,4 +192,4 @@ describe('DashboardLayout', () => {
|
||||
// Skip this test since we don't want to modify the component
|
||||
expect(true).toBe(true)
|
||||
})
|
||||
})
|
||||
})
|
||||
Reference in new issue
Block a user