Skip to content

Commit

Permalink
fix: implemented changes to display Search bar only on the index page (
Browse files Browse the repository at this point in the history
…#923)

* fix: implemented changes using conditional class to Search bar to show only on index page

* display search bar on index page and change conditional class to use v-show instead

* fix: created const variable for isHomepage.

* fix: reverted changes on the child component SearchBar.vue instead implemented the changes to the parent component TopNav.vue

* test: update test for search bar visibility
  • Loading branch information
karlk08 authored Dec 10, 2024
1 parent c4c8449 commit 76ca99b
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 3 deletions.
5 changes: 5 additions & 0 deletions components/TopNav.vue
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@
</NuxtLink>
</div>
<div
v-show="isHomepage"
data-testid="landscape-searchbar"
class="portrait:hidden flex align-middle"
>
Expand Down Expand Up @@ -120,12 +121,16 @@
</template>

<script lang="ts" setup>
import { useRoute } from 'vue-router'
import { computed } from 'vue'
import HamburgerMenu from './HamburgerMenu.vue'
import SVGProfileIcon from '~/assets/icons/profile-icon.svg'
import SVGSiteLogo from '~/assets/icons/site-logo.svg'
import { useAuthStore } from '~/stores/authStore'
const authStore = useAuthStore()
const route = useRoute()
const isHomepage = computed(() => route.path === '/')
async function logout() {
await authStore.logout()
Expand Down
2 changes: 1 addition & 1 deletion test/cypress/e2e/about.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ describe('About page', () => {
})

it('shows the desktop top nav', () => {
cy.get('[data-testid="landscape-searchbar"]').should('exist').should('be.visible')
cy.get('[data-testid="landscape-searchbar"]').should('exist').should('not.be.visible')
})

it('does not show the hamburger component', () => {
Expand Down
2 changes: 1 addition & 1 deletion test/cypress/e2e/privacy.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ describe('Privacy Policy page', () => {
})

it('shows the landscape top nav', () => {
cy.get('[data-testid="landscape-searchbar"]').should('exist').should('be.visible')
cy.get('[data-testid="landscape-searchbar"]').should('exist').should('not.be.visible')
})

it('does not show the hamburger component', () => {
Expand Down
2 changes: 1 addition & 1 deletion test/cypress/e2e/submit.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ describe('Submit page', () => {
})

it('shows the desktop top nav', () => {
cy.get('[data-testid="landscape-searchbar"]').should('exist').should('be.visible')
cy.get('[data-testid="landscape-searchbar"]').should('exist').should('not.be.visible')
})

it('does not show the hamburger component', () => {
Expand Down

0 comments on commit 76ca99b

Please sign in to comment.