Skip to content

Commit

Permalink
17435 Make resolution dates optional in a correction (bcgov#525) (bcg…
Browse files Browse the repository at this point in the history
…ov#526)

* - app version = 4.5.6a

* - removed some accessors
- fixed type of Previous Dates prop
- made Resolution Dates Validity dependent on Alteration Filing
- fixed unit test suite

* - renamed previousDates -> originalResolutions
  • Loading branch information
severinbeauvais authored Aug 18, 2023
1 parent ef4a03b commit 8e41c5d
Show file tree
Hide file tree
Showing 7 changed files with 21 additions and 18 deletions.
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "business-edit-ui",
"version": "4.5.6",
"version": "4.5.6a",
"private": true,
"appName": "Edit UI",
"sbcName": "SBC Common Components",
Expand Down
4 changes: 2 additions & 2 deletions src/components/Alteration/AlterationSummary.vue
Original file line number Diff line number Diff line change
Expand Up @@ -110,8 +110,8 @@
<v-divider class="mx-4" />
<div class="section-container new-resolution-dates-summary">
<ResolutionDates
:added-dates="getNewResolutionDates"
:previous-dates="getOriginalResolutions"
:addedDates="getNewResolutionDates"
:originalResolutions="getOriginalResolutions"
:isEditMode="false"
/>
</div>
Expand Down
8 changes: 4 additions & 4 deletions src/components/Alteration/Articles/Articles.vue
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
>
<ResolutionDates
:addedDates="getNewResolutionDates"
:previousDates="getOriginalResolutions"
:originalResolutions="getOriginalResolutions"
:isEditMode="true"
:hasRightsOrRestrictions="getHasRightsOrRestrictions"
@addRemoveDate="setNewResolutionDates($event)"
Expand Down Expand Up @@ -76,14 +76,14 @@ export default class Articles extends Mixins(CommonMixin) {
/** Emits Have Changes event. */
@Emit('haveChanges')
// eslint-disable-next-line @typescript-eslint/no-unused-vars
protected emitHaveChanges (haveChanges: boolean): void {}
emitHaveChanges (haveChanges: boolean): void {}
protected setEditingCompanyProvisions (editing: boolean) {
setEditingCompanyProvisions (editing: boolean) {
this.isEditingCompanyProvisions = editing
this.setValidComponent({ key: 'isValidCompanyProvisions', value: !editing })
}
protected setIsAddingResolutionDate (addingResolutionDate: boolean) {
setIsAddingResolutionDate (addingResolutionDate: boolean) {
this.isAddingResolutionDate = addingResolutionDate
}
Expand Down
13 changes: 7 additions & 6 deletions src/components/Alteration/Articles/ResolutionDates.vue
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@
<span>{{ addBtnLabel }}</span>
</v-btn>
</v-col>

<v-col
v-else-if="isAdding"
cols="2"
Expand Down Expand Up @@ -157,10 +158,10 @@
<template v-if="displayPreviousDates">
<ul class="resolution-date-list info-text pl-0 mt-3">
<li
v-for="(resolutions, index) in previousDates"
v-for="(resolution, index) in originalResolutions"
:key="`resolutionDate-${index}`"
>
{{ resolutions.date }}
{{ resolution.date }}
</li>
</ul>
</template>
Expand All @@ -175,7 +176,7 @@ import { Action, Getter } from 'pinia-class'
import { CommonMixin, DateMixin } from '@/mixins/'
import { DatePicker as DatePickerShared } from '@bcrs-shared-components/date-picker/'
import { cloneDeep } from 'lodash'
import { ActionKvIF } from '@/interfaces/'
import { ActionKvIF, ResolutionsIF } from '@/interfaces/'
import { useStore } from '@/store/store'
@Component({
Expand All @@ -187,8 +188,8 @@ export default class ResolutionDates extends Mixins(CommonMixin, DateMixin) {
/** New resolution dates. */
@Prop({ default: () => [] }) readonly addedDates!: string[]
/** Previously existing resolution dates. */
@Prop({ default: () => [] }) readonly previousDates!: string[]
/** Previously existing resolutions (ie, dates). */
@Prop({ default: () => [] }) readonly originalResolutions!: ResolutionsIF[]
/** Whether this component should be in edit mode or review mode. */
@Prop({ default: true }) readonly isEditMode!: boolean
Expand Down Expand Up @@ -227,7 +228,7 @@ export default class ResolutionDates extends Mixins(CommonMixin, DateMixin) {
}
get havePreviousDates (): boolean {
return (this.previousDates?.length > 0)
return (this.originalResolutions?.length > 0)
}
get addBtnIcon (): string {
Expand Down
1 change: 1 addition & 0 deletions src/store/store.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1114,6 +1114,7 @@ export const useStore = defineStore('store', {
/** True if resolution dates are valid. */
getIsResolutionDatesValid (): boolean {
if (
this.isAlterationFiling &&
this.hasShareStructureChanged &&
(this.getHasOriginalRightsOrRestrictions || this.getHasRightsOrRestrictions)
) {
Expand Down
7 changes: 4 additions & 3 deletions tests/unit/ResolutionDates.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ const addedDates = [
'2020-06-01'
]

const previousDates = [
const originalResolutions = [
{
'date': '2020-06-12'
},
Expand Down Expand Up @@ -74,6 +74,7 @@ describe('Resolution Dates component - edit mode', () => {
let wrapperFactory: any

beforeAll(() => {
store.stateModel.tombstone.filingType = FilingTypes.ALTERATION
store.stateModel.shareStructureStep.shareClasses = shareClasses as any
wrapperFactory = (propsData: any) => {
return mount(ResolutionDates, { propsData: { ...propsData, isEditMode: true }, vuetify })
Expand Down Expand Up @@ -105,7 +106,7 @@ describe('Resolution Dates component - edit mode', () => {
})

it('displays previous dates', async () => {
const wrapper = wrapperFactory({ previousDates })
const wrapper = wrapperFactory({ originalResolutions })
const vm = wrapper.vm

// verify there is a second row
Expand Down Expand Up @@ -366,7 +367,7 @@ describe('Resolution Dates component - review mode', () => {
})

it('displays previous dates', async () => {
const wrapper = wrapperFactory({ previousDates })
const wrapper = wrapperFactory({ originalResolutions })
const vm = wrapper.vm

// verify there is a second row
Expand Down

0 comments on commit 8e41c5d

Please sign in to comment.