UNPKG

devextreme-vue

Version:

DevExtreme Vue UI and Visualization Components

67 lines (65 loc) 2.03 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 form_1 = require("../../form"); jest.setTimeout(1000); beforeEach(() => { jest.clearAllMocks(); }); describe('form', () => { it('should render config components by condition', async () => { expect.assertions(1); const vm = (0, vue_1.defineComponent)({ template: `<DxForm id="form" :form-data="data" > <DxItem v-if="show" data-field="FirstName" /> <DxItem data-field="Position" /> </DxForm>`, components: { DxItem: form_1.DxItem, DxForm: form_1.DxForm, }, props: { show: { type: Boolean, default: true, }, data: { type: Object, default: { FirstName: 'name1', Position: 'name2', }, }, }, }); const wrapper = (0, test_utils_1.mount)(vm); await wrapper.setProps({ show: false }); await (0, vue_1.nextTick)(() => { wrapper.setProps({ show: true }); }); await (0, vue_1.nextTick)(() => { expect(wrapper.getComponent('#form').vm.$el .getElementsByClassName('dx-field-item-label-text')).toHaveLength(2); }); }); });