Skip to content

Commit

Permalink
QA fixes (#74)
Browse files Browse the repository at this point in the history
* QA fixes

Signed-off-by: Kial Jinnah <kialjinnah@gmail.com>

* updates

Signed-off-by: Kial Jinnah <kialjinnah@gmail.com>

* test fixes

Signed-off-by: Kial Jinnah <kialjinnah@gmail.com>

---------

Signed-off-by: Kial Jinnah <kialjinnah@gmail.com>
  • Loading branch information
kialj876 authored Dec 7, 2023
1 parent 7479d50 commit db0085c
Show file tree
Hide file tree
Showing 11 changed files with 42 additions and 24 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<UInput
:model-value="selectedDateDisplay"
icon="i-mdi-calendar"
:placeholder="$t('placeholders.dateSelect')"
:placeholder="placeholder || ''"
trailing
type="text"
variant="bcGov"
Expand Down Expand Up @@ -34,7 +34,7 @@
import { ComputedRef, Ref, computed, ref, watch } from 'vue'
import { Popover, PopoverButton, PopoverPanel } from '@headlessui/vue'
defineProps<{ maxDate?: Date }>()
defineProps<{ maxDate?: Date, placeholder?: string }>()
const emit = defineEmits<{(e: 'selection', value: Date | null): void }>()
Expand Down
8 changes: 4 additions & 4 deletions btr-web/btr-layouts/layouts/business.vue
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@
<BcrosHeader />
<BcrosBreadcrumb v-if="crumbConstructors.length > 0" :crumb-constructors="crumbConstructors" />
<BcrosBusinessDetails />
<div class="mx-auto p-4 w-full max-w-bcroslg flex justify-center items-start">
<div class="max-w-bcrosmd p-4">
<div class="mx-auto px-4 w-full max-w-bcroslg flex">
<div>
<slot />
</div>
<div class="hidden bcroslg:block p-4 sticky top-0">
<BcrosWidgetsFee :fees="payFeesWidget.fees" data-cy="pay-fees-widget">
<div class="flex-none ml-8 mt-10">
<BcrosWidgetsFee class="sticky top-10" :fees="payFeesWidget.fees" data-cy="pay-fees-widget">
<template #emptyFees>
<div
class="bg-white p-3 border-gray-300 border-b-[1px] flex"
Expand Down
9 changes: 7 additions & 2 deletions btr-web/btr-main-app/components/individual-person/AddNew.vue
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,7 @@
id="addNewPersonBirthdate"
class="mt-3"
:max-date="new Date()"
:placeholder="$t('placeholders.dateSelect.birthdate')"
@selection="significantIndividual.profile.birthDate = dateToString($event, 'YYYY-MM-DD')"
/>
</div>
Expand Down Expand Up @@ -218,7 +219,7 @@ import { z } from 'zod'
const { t } = useI18n()
const emits = defineEmits<{ add: [value: SignificantIndividualI], cancel: [value: any]}>()
const props = defineProps<{ setSignificantIndividual?: SignificantIndividualI }>()
const props = defineProps<{ setSignificantIndividual?: SignificantIndividualI, startDate?: string }>()
const defaultSI = {
profile: {
fullName: '',
Expand Down Expand Up @@ -262,12 +263,16 @@ const defaultSI = {
missingInfoReason: undefined,
percentOfShares: '',
percentOfVotes: '',
startDate: useSignificantIndividuals().currentSIFiling?.effectiveDate || '',
startDate: props.startDate || '',
action: FilingActionE.ADD
}
// NOTE: not setting this as modelValue because it is a nested object so mutating it gets complicated
const significantIndividual: Ref<SignificantIndividualI> = ref(props.setSignificantIndividual || defaultSI)
watch(() => props.startDate, (val) => {
significantIndividual.value.startDate = val
})
function addSignificantIndividual () {
// FUTURE: validate form / scroll to 1st error
// emit significantIndividual so it gets added to the filing
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@
<template #significanceDates-data="{ row }">
<div data-cy="summary-table-dates">
{{ $t('texts.dateRange', {
start: row.startDate ? datetimeStringToDateString(row.startDate) : $t('labels.unknown'),
end: row.endDate ? datetimeStringToDateString(row.endDate) : $t('labels.current') }) }}
start: row.startDate ? row.startDate : $t('labels.unknown'),
end: row.endDate ? row.endDate : $t('labels.current') }) }}
</div>
</template>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
</template>

<script setup lang="ts">
import { ref, watch, defineProps, defineEmits } from 'vue'
import { ref, watch } from 'vue'
const props = defineProps({
id: { type: String, required: true },
Expand Down
14 changes: 6 additions & 8 deletions btr-web/btr-main-app/cypress/e2e/pages/reviewConfirm.cy.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { dateToString } from '../../../../btr-common-components/utils/date'
import payFeesForBtrRegsigin from '../../fixtures/payFeeForBtrRegsigin.json'

describe('pages -> Review and Confirm', () => {
Expand Down Expand Up @@ -72,12 +73,10 @@ describe('pages -> Review and Confirm', () => {
// verify the url changes to /review-confirm
cy.url().should('include', '/review-confirm')

// TO-DO: uncomment the following section when the bug in date picker is fixed

// // check the significant individual change date is correct
// const today = new Date()
// const expectedDate = today.toISOString().split('T')[0]
// cy.get('[data-cy=effective-date-select]').contains(expectedDate)
// check the significant individual change date is correct
const today = new Date()
const expectedDate = dateToString(today, 'YYYY-MM-DD')
cy.get('[data-cy=effective-date-select]').contains(expectedDate)

// check if the summary table contain the correct data
const summaryTable = cy.get('[data-cy="individualsSummaryTable"]')
Expand All @@ -93,8 +92,7 @@ describe('pages -> Review and Confirm', () => {
summaryTable.get('[data-cy=summary-table-details]').contains(testData.summaryTable.citizenship)
summaryTable.get('[data-cy=summary-table-details]').contains(testData.summaryTable.taxResidency)

// TO-DO: uncomment the following section when the bug in date picker is fixed
// summaryTable.get('[data-cy=summary-table-dates]').contains(expectedDate)
summaryTable.get('[data-cy=summary-table-dates]').contains(expectedDate)

summaryTable.get('[data-cy=summary-table-controls]').contains(testData.summaryTable.shareControl)
summaryTable.get('[data-cy=summary-table-controls]').contains(testData.summaryTable.directorControl)
Expand Down
4 changes: 4 additions & 0 deletions btr-web/btr-main-app/lang/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,10 @@
"reviewConfirm": "Review the information in your registration. If you need to change anything, return to the previous step to make the necessary change."
},
"placeholders": {
"dateSelect": {
"birthdate": "Select Date",
"significantIndividualChange": "Significant Individual Change Date"
},
"taxNumber": "CRA Tax Number (SIN, ITN, or TTN)"
},
"errors": {
Expand Down
12 changes: 9 additions & 3 deletions btr-web/btr-main-app/pages/ownerChange.vue
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
<div class="ml-8 flex-auto">
<BcrosInputsDateSelect
:max-date="new Date()"
:placeholder="$t('placeholders.dateSelect.significantIndividualChange')"
@selection="significantIndividualChangeDate($event)"
/>
</div>
Expand All @@ -27,7 +28,12 @@
/>
<div v-else class="mt-10 p-10 bg-white rounded flex flex-row">
<label class="font-bold text-lg min-w-[190px]">{{ $t('labels.addIndividual') }}</label>
<IndividualPersonAddNew class="ml-8" @cancel="expandNewSI = false" @add="addNewSI($event)" />
<IndividualPersonAddNew
class="ml-8"
:start-date="currentSIFiling.effectiveDate"
@cancel="expandNewSI = false"
@add="addNewSI($event)"
/>
</div>
<IndividualPersonSummaryTable class="mt-10" :individuals="currentSIFiling.significantIndividuals || []" />
</div>
Expand All @@ -41,8 +47,8 @@ const { currentSIFiling } = storeToRefs(significantIndividuals)
const expandNewSI = ref(false)
const significantIndividualChangeDate = (event) => {
currentSIFiling.value.effectiveDate = datetimeStringToDateString(event)
const significantIndividualChangeDate = (event: Date) => {
currentSIFiling.value.effectiveDate = dateToString(event, 'YYYY-MM-DD')
addBtrPayFees()
}
Expand Down
2 changes: 1 addition & 1 deletion btr-web/btr-main-app/pages/reviewConfirm.vue
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
<div class="mt-10 p-10 bg-white rounded flex" data-cy="effective-date-select">
<label class="font-bold text-lg w-[200px]">{{ $t('labels.significantIndividualChangeDate') }}</label>
<div class="ml-10 text-lg">
{{ datetimeStringToDateString (currentSIFiling.effectiveDate) }}
{{ currentSIFiling.effectiveDate }}
</div>
</div>
<div class="bg-white rounded-[5px] mt-10">
Expand Down
2 changes: 1 addition & 1 deletion btr-web/btr-main-app/stores/significant-individuals.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ export const useSignificantIndividuals = defineStore('significantIndividuals', (

/** Add currentSI to the currentSIFiling. */
function filingAddSI (significantIndividual: SignificantIndividualI) {
currentSIFiling.value.significantIndividuals.push(significantIndividual)
currentSIFiling.value.significantIndividuals.unshift(significantIndividual)
}

/** Initialize a new significant individual filing */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,5 +30,10 @@ describe('Business Store Tests', () => {
significantIndividuals.filingAddSI(testSI)
// FUTURE: call mocked and returning a list of existing SIs
expect(currentSIFiling.value.significantIndividuals).toEqual([testSI])
// add another one and ensure it is first
const newTestSI = { ...testSI }
newTestSI.profile.fullName = 'Test Name 2'
significantIndividuals.filingAddSI(newTestSI)
expect(currentSIFiling.value.significantIndividuals).toEqual([newTestSI, testSI])
})
})

0 comments on commit db0085c

Please sign in to comment.