Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor(frontend): refactor tests and stories for sidebar #1188

Merged
merged 4 commits into from
Jul 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5,382 changes: 1,556 additions & 3,826 deletions frontend/package-lock.json

Large diffs are not rendered by default.

16 changes: 6 additions & 10 deletions frontend/src/components/buttons/CreateButtonMobile.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import CreateButtonMobile from './CreateButtonMobile.vue'
vi.mock('vike/client/router')
vi.mocked(navigate).mockResolvedValue()

describe('CreateButton', () => {
describe('CreateButtonMobile', () => {
const Wrapper = () => {
return mount(CreateButtonMobile, {
props: {},
Expand Down Expand Up @@ -49,18 +49,14 @@ describe('CreateButton', () => {
})

describe('new table button', () => {
beforeEach(() => {
beforeEach(async () => {
wrapper = Wrapper()
await wrapper.find('#create-button-mobile').trigger('click')
})
describe('enter room', () => {
beforeEach(async () => {
await wrapper.find('#create-button-mobile').trigger('click')
await wrapper.find('.button-list-mobile button.new-table-button').trigger('click')
})

it('opens room page', () => {
expect(navigate).toHaveBeenCalledWith('/room/')
})
it('opens room page', async () => {
await wrapper.find('.button-list-mobile button.new-table-button').trigger('click')
ogerly marked this conversation as resolved.
Show resolved Hide resolved
expect(navigate).toHaveBeenCalledWith('/room/')
})
})
})
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html

exports[`CreateButton > renders 1`] = `
exports[`CreateButtonMobile > renders 1`] = `
<div
class="create-button-container"
data-v-1c60eb53=""
Expand Down
4 changes: 3 additions & 1 deletion frontend/src/components/menu/BottomMenu.vue
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,15 @@ import Circle from './CircleElement.vue'
import UserInfo from './UserInfo.vue'

const drawer = ref(false)
const location = ref<'bottom' | 'right' | 'left' | 'end' | 'top' | 'start'>('bottom')

const toggleDrawer = () => {
drawer.value = !drawer.value
}

const updateDrawer = (value: boolean) => {
drawer.value = value
}
const location = ref<'bottom' | 'right' | 'left' | 'end' | 'top' | 'start'>('bottom')
</script>

<style scoped lang="scss">
Expand Down
8 changes: 6 additions & 2 deletions frontend/src/components/menu/TopMenu.stories.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@ const meta = {
export default meta
type Story = StoryObj<typeof meta>

export const Example: Story = {
args: {},
export const WithDrawer: Story = {
args: { drawer: true },
}

export const WithoutDrawer: Story = {
args: { drawer: false },
}
8 changes: 4 additions & 4 deletions frontend/src/components/menu/TopMenu.vue
Original file line number Diff line number Diff line change
Expand Up @@ -32,13 +32,13 @@
<script lang="ts" setup>
import { ref } from 'vue'

import LightDarkSwitch from '#components/menu/LightDarkSwitch.vue'
import LogoImage from '#components/menu/LogoImage.vue'
import TabControl from '#components/menu/TabControl.vue'
import UserInfo from '#components/menu/UserInfo.vue'
import ListWithNavigationDrawer from '#components/vuetify/Organisms/ListWithNavigationDrawer.vue'

import Circle from './CircleElement.vue'
import LightDarkSwitch from './LightDarkSwitch.vue'
import LogoImage from './LogoImage.vue'
import TabControl from './TabControl.vue'
import UserInfo from './UserInfo.vue'

const drawer = ref(false)
const toggleDrawer = () => {
Expand Down
94 changes: 1 addition & 93 deletions frontend/src/components/vuetify/Atoms/ListElement.stories.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
// import { VIcon, VBtn, VAvatar, VImg } from 'vuetify/components'

import { SBComp } from '#types/SBComp'

import ListElement from './ListElement.vue'

import type { Meta, StoryObj } from '@storybook/vue3'

const meta: Meta<typeof ListElement> = {
const meta = {
title: 'MOLECULES/ListElement',
component: ListElement as SBComp,
tags: ['autodocs'],
Expand All @@ -20,11 +18,6 @@ const meta: Meta<typeof ListElement> = {
participantCount: 4,
attendees: [],
joinLink: 'https://my.link',
// rounded: true,
// prepend: VIcon,
// prependProps: { icon: 'mdi-home' },
// append: VBtn,
// appendProps: { icon: 'mdi-menu' },
},
{
meetingName: 'Beispiel Titel 2',
Expand All @@ -33,11 +26,6 @@ const meta: Meta<typeof ListElement> = {
participantCount: 4,
attendees: [],
joinLink: 'https://my.link',
// rounded: true,
// prepend: VAvatar,
// prependProps: { src: 'https://via.placeholder.com/40' },
// append: VIcon,
// appendProps: { icon: 'mdi-menu' },
},
],
},
Expand All @@ -59,8 +47,6 @@ export const Basic: Story = {
participantCount: 4,
attendees: [],
joinLink: 'https://my.link',
// append: VBtn,
// appendProps: { icon: 'mdi-menu' },
},
{
meetingName: 'Beispiel Titel 2',
Expand All @@ -69,85 +55,7 @@ export const Basic: Story = {
participantCount: 4,
attendees: [],
joinLink: 'https://my.link',
// append: VIcon,
// appendProps: { icon: 'mdi-menu' },
},
],
},
}

/*
export const WithIcons: Story = {
args: {
items: [
{
title: 'Home',
prepend: VIcon,
prependProps: { icon: 'mdi-home' },
append: VIcon,
appendProps: { icon: 'mdi-menu' },
},
{
title: 'Profile',
prepend: VIcon,
prependProps: { icon: 'mdi-account' },
append: VIcon,
appendProps: { icon: 'mdi-menu' },
},
{
title: 'Settings',
prepend: VIcon,
prependProps: { icon: 'mdi-settings' },
append: VIcon,
appendProps: { icon: 'mdi-menu' },
},
{
title: 'Logout',
prepend: VIcon,
prependProps: { icon: 'mdi-logout' },
append: VIcon,
appendProps: { icon: 'mdi-menu' },
},
],
},
}

export const WithImages: Story = {
args: {
items: [
{
title: 'Item 1',
subtitle: 'Subtitle 1',
prepend: VImg,
prependProps: { src: 'https://via.placeholder.com/40' },
append: VIcon,
appendProps: { icon: 'mdi-menu' },
},
{
title: 'Item 2',
subtitle: 'Subtitle 2',
prepend: VImg,
prependProps: { src: 'https://via.placeholder.com/40' },
append: VIcon,
appendProps: { icon: 'mdi-menu' },
},
{
title: 'Item 3',
subtitle: 'Subtitle 3',
prepend: VImg,
prependProps: { src: 'https://via.placeholder.com/40' },
append: VIcon,
appendProps: { icon: 'mdi-menu' },
},
{
title: 'Item 4',
subtitle: 'Subtitle 4',
prepend: VImg,
prependProps: { src: 'https://via.placeholder.com/40' },
append: VIcon,
appendProps: { icon: 'mdi-menu' },
},
],
},
}
*/
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ describe('ListWithNavigationDrawer', () => {
const Wrapper = () => {
return mount(VApp, {
slots: {
default: h(ListWithNavigationDrawer as Component),
default: h(ListWithNavigationDrawer as Component, { drawer: true }),
},
})
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ exports[`ListWithNavigationDrawer > renders correctly 1`] = `


<nav
class="v-navigation-drawer v-navigation-drawer--right v-navigation-drawer--temporary v-theme--light v-navigation-drawer--mobile menu-drawer-top"
class="v-navigation-drawer v-navigation-drawer--right v-navigation-drawer--temporary v-navigation-drawer--active v-theme--light v-navigation-drawer--mobile menu-drawer-top"
data-v-3308ee86=""
style="right: 0px; z-index: 1004; transform: translateX(110%); position: fixed; transition: none !important; height: calc(100% - 0px - 0px); top: 0px; bottom: 0px;"
style="right: 0px; z-index: 1004; transform: translateX(0%); position: fixed; transition: none !important; height: calc(100% - 0px - 0px); top: 0px; bottom: 0px;"
>
<!---->
<!---->
Expand Down Expand Up @@ -120,7 +120,11 @@ exports[`ListWithNavigationDrawer > renders correctly 1`] = `
name="fade-transition"
persisted="false"
>
<!---->
<div
class="v-navigation-drawer__scrim"
data-v-3308ee86=""
style="z-index: 1003;"
/>
</transition-stub>


Expand Down
1 change: 0 additions & 1 deletion frontend/src/stores/activeRoomStore.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ export const useActiveRoomStore = defineStore(
const getActiveRoom = computed(() => activeRoom.value)

const setActiveRoom = (room: string | null) => {
// console.log('setActiveRoom', room)
activeRoom.value = room
}

Expand Down