Open AniaKru95 opened 1 year ago
I change data values to display some chunk of template. This chunks depend on computed property, but it never change.
Template:
<apexchart v-if="isSingleChartActive" type="bar" height="700px" :options="columnChartOpts" :series="columnChartSeries"/>
Computed variable
const isSingleChartActive = computed(() => columnChartSeries.length !== 0 && props.isSingleChart)
Prop variable
const props = withDefaults(defineProps<Props>(), { isSingleChart: true })
Data variable
const columnChartSeries = reactive([])
Computed value should also change
it('should display single chart2', async () => { const wrapper = await mount(MyChart, { propsData: { isSingleChart: true, }, global: { stubs: { apexchart: true } } }) expect(wrapper.find("apexchart-stub").exists()).toBeFalsy() //true wrapper.vm.columnChartSeries = [{ name: "dummy", data: [{"10:00": 25}], system: "pod" }] await nextTick() console.log(wrapper.vm.columnChartSeries.length !== 0) //true console.log(wrapper.vm.isSingleChart) //true console.log(wrapper.vm.isSingleChartActive) //false expect(wrapper.find("apexchart-stub").exists()).toBeTruthy() })
isSingleChartActive should be also true!
I've tried to setTimeout, but does not work.
Subject of the issue
I change data values to display some chunk of template. This chunks depend on computed property, but it never change.
Steps to reproduce
Template:
Computed variable
Prop variable
Data variable
Expected behaviour
Computed value should also change
Actual behaviour
isSingleChartActive should be also true!
I've tried to setTimeout, but does not work.