devextreme-vue
Version:
DevExtreme Vue UI and Visualization Components
43 lines (41 loc) • 1.4 kB
JavaScript
/*!
* devextreme-vue
* Version: 25.1.4
* Build date: Tue Aug 05 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
*/
import { mount } from '@vue/test-utils';
import { defineComponent } from 'vue';
import DxButton from '../../button';
import DxToolbar, { DxItem } from '../../toolbar';
jest.setTimeout(1000);
beforeEach(() => {
jest.clearAllMocks();
});
describe('template rendering', () => {
it('should render a default template only for a configuration component where it is declared', () => {
const vm = defineComponent({
template: `<dx-toolbar id="component">
<dx-item location="before">
<template #default>
<dx-button text="test" />
</template>
</dx-item>
<dx-item location="center"></dx-item>
</dx-toolbar>`,
components: {
DxToolbar,
DxItem,
DxButton,
},
});
const wrapper = mount(vm);
expect(wrapper.vm.$el.getElementsByClassName('dx-button')).toHaveLength(1);
});
});