I am trying to test a computed property that is dependent on several other computed properties of a Vue instance. I can access the wrapper's vm.normalizedHeadwind property in the spec...
const wrapper = getWrapper() // helper that returns wrapper with test data;
let result = (wrapper.vm as any).normalizedHeadwind; // returns expected value
but if I try:
ExceedenceCard.computed.normalizedHeadwind.call({... dependency data})
as described in https://lmiller1990.github.io/vue-testing-handbook/computed-properties.html#testing-by-rendering-the-value
I get undefined for the ExceedenceCard.computed property.
ExceedenceCard.ts
export default Vue.extend({
...
computed: {
normalizedHeadwind: {
get: function(): number {
const { direction, speed } = this.currentWindConditions;
return this.rounded(
calculateHeadwind(this.runwayHeading, direction, speed)
);
}
},
...
I've tried refactoring the code from using the vue-class-component and vue-property-decorator modules back to using the Vue.extend pattern and it made no difference.
Aucun commentaire:
Enregistrer un commentaire