Skip to content

Commit

Permalink
Section component and dashboard layout (#7)
Browse files Browse the repository at this point in the history
* set up template for dashboard

* remove top padding
  • Loading branch information
patrickpeinanw authored Jun 19, 2024
1 parent abc8084 commit 96a5422
Show file tree
Hide file tree
Showing 5 changed files with 60 additions and 3 deletions.
16 changes: 16 additions & 0 deletions src/components/bcros/Section.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<template>
<div :data-cy="'section_' + name">
<div :data-cy="'header_' + name" class="font-bold text-lg pb-2">
<slot name="header" />
</div>
<div :data-cy="'body_' + name" class="bg-white rounded">
<slot name="default" />
</div>
</div>
</template>

<script setup lang="ts">
defineProps({
name: { type: String, required: true }
})
</script>
6 changes: 6 additions & 0 deletions src/lang/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,12 @@
"selectLogin": "Select log in method",
"switchAccount": "Switch Account"
}
},
"section": {
"toDo": "To Do",
"filingHistory": "Recent Filing History",
"officeAddresses": "Office Addresses",
"currentDirectors": "Current Directors"
}
}
}
31 changes: 29 additions & 2 deletions src/pages/dashboard.vue
Original file line number Diff line number Diff line change
@@ -1,6 +1,33 @@
<template>
<div class="mt-8 mb-16" data-cy="business-dashboard">
TBD
<div class="mt-8 mb-16 flex flex-wrap" data-cy="business-dashboard">
<div class="w-full md:w-9/12">
<BcrosSection name="todo">
<template #header>
{{ $t('title.section.toDo') }}
</template>
TBD
</BcrosSection>
<BcrosSection name="filingHistory" class="pt-5">
<template #header>
{{ $t('title.section.filingHistory') }}
</template>
TBD
</BcrosSection>
</div>
<div class="w-full pt-5 md:w-3/12 md:pl-5 md:pt-0 flex flex-col">
<BcrosSection name="address">
<template #header>
{{ $t('title.section.officeAddresses') }}
</template>
TBD
</BcrosSection>
<BcrosSection name="directors" class="pt-5">
<template #header>
{{ $t('title.section.currentDirectors') }}
</template>
TBD
</BcrosSection>
</div>
</div>
</template>

Expand Down
3 changes: 2 additions & 1 deletion tests/pages/dashboard.spec.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
import { beforeEach, describe, expect, it } from 'vitest'
import { flushPromises, mount, VueWrapper } from '@vue/test-utils'
import { mockedI18n } from '../test-utils/mockedi18n'

import Dashboard from '../../src/pages/dashboard.vue'

describe('dashboard page tests', () => {
let wrapper: VueWrapper<any>

beforeEach(async () => {
wrapper = mount(Dashboard)
wrapper = mount(Dashboard, { global: { plugins: [mockedI18n] } })
// await api calls to resolve
await flushPromises()
})
Expand Down
7 changes: 7 additions & 0 deletions tests/test-utils/mockedi18n.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import { createI18n } from 'vue-i18n'
import en from '~/lang/en.json'

export const mockedI18n = createI18n({
locale: 'en',
messages: en
})

0 comments on commit 96a5422

Please sign in to comment.