UNPKG

devextreme-vue

Version:

DevExtreme Vue UI and Visualization Components

73 lines (71 loc) 2.3 kB
/*! * devextreme-vue * Version: 25.1.6 * Build date: Mon Oct 13 2025 * * Copyright (c) 2012 - 2025 Developer Express Inc. ALL RIGHTS RESERVED * * This software may be modified and distributed under the terms * of the MIT license. See the LICENSE file in the root of the project for details. * * https://github.com/DevExpress/devextreme-vue */ "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); const test_utils_1 = require("@vue/test-utils"); const vue_1 = require("vue"); const data_grid_1 = require("../../data-grid"); jest.setTimeout(1000); beforeEach(() => { jest.clearAllMocks(); }); describe('data grid', () => { it('vmodel should work correctly for nested components', async () => { expect.assertions(2); const vm = (0, vue_1.defineComponent)({ template: `<DxDataGrid id="grid" ref="data-grid" :form-data="data" > <DxColumn v-model:visible="visible1" data-field="prop" /> <DxColumn v-model:visible="visible2" data-field="prop2" /> </DxDataGrid>`, components: { DxDataGrid: data_grid_1.DxDataGrid, DxColumn: data_grid_1.DxColumn, }, data() { return { visible1: true, visible2: true, }; }, props: { data: { type: Object, default: [ { prop: 'test1', prop2: 'test1' }, { prop: 'test2', prop2: 'test2' }, ], }, }, }); const wrapper = (0, test_utils_1.mount)(vm); const instance = wrapper.getComponent('#grid').vm.$_instance; instance.option('columns[0].visible', false); await (0, vue_1.nextTick)(() => { instance.option('columns[1].visible', false); }); await (0, vue_1.nextTick)(() => { expect(wrapper.vm.visible1).toBe(false); expect(wrapper.vm.visible2).toBe(false); }); }); });