Skip to content

Commit

Permalink
Add publications route
Browse files Browse the repository at this point in the history
  • Loading branch information
Ruhshan committed Aug 26, 2024
1 parent 9a522cb commit 293509e
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 1 deletion.
2 changes: 2 additions & 0 deletions frontend-vue3/src/components/TopBar.vue
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<script setup lang="ts">
const homeRoute = { name: 'home' }
const guideRoute = { name: 'guide' }
const publicationsRoute = {name: 'publications'}
</script>

<template>
Expand All @@ -17,6 +18,7 @@ const guideRoute = { name: 'guide' }
<router-link :to="homeRoute" data-testid="home-button">Home</router-link>
<router-link to="/#" data-testid="search-button">Search</router-link>
<router-link :to="guideRoute" data-testid="guide-button">Guide</router-link>
<router-link :to="publicationsRoute" data-testid="publications-button">Publications</router-link>
</div>
</v-col>
</v-row>
Expand Down
11 changes: 10 additions & 1 deletion frontend-vue3/src/components/__tests__/TopBar.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,12 +48,21 @@ describe('TopBar.vue', () => {
expect(searchButton.text()).toBe('Search')
})

it('renders the Guid button with text "Search"', () => {
it('renders the Guide button with text "Guide"', () => {
const guideButton = wrapper.find('[data-testid="guide-button"]')

expect(guideButton.exists()).toBe(true)
expect(guideButton.text()).toBe('Guide')

expect(findRouterLinkTo(guideButton)).toEqual({ name: 'guide' })
})

it('renders the Publications button with text "Publications"', () => {
const guideButton = wrapper.find('[data-testid="publications-button"]')

expect(guideButton.exists()).toBe(true)
expect(guideButton.text()).toBe('Publications')

expect(findRouterLinkTo(guideButton)).toEqual({ name: 'publications' })
})
})
6 changes: 6 additions & 0 deletions frontend-vue3/src/router/index.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { createRouter, createWebHistory } from 'vue-router'
import HomeView from '@/views/HomeView.vue'
import GuideView from '@/views/GuideView.vue'
import PublicationsView from "@/views/PublicationsView.vue";

const router = createRouter({
history: createWebHistory(import.meta.env.BASE_URL),
Expand All @@ -14,6 +15,11 @@ const router = createRouter({
path: '/guide',
name: 'guide',
component: GuideView
},
{
path: '/publications',
name: 'publications',
component: PublicationsView
}
]
})
Expand Down
12 changes: 12 additions & 0 deletions frontend-vue3/src/views/PublicationsView.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<script setup lang="ts">
import BreadCrumb from "@/components/BreadCrumb.vue";
</script>

<template>
<BreadCrumb title="Publications" item-name="Publications"></BreadCrumb>
</template>

<style scoped>
</style>

0 comments on commit 293509e

Please sign in to comment.