summaryrefslogtreecommitdiff
path: root/tests/unit/Global/TableToolbar.spec.js
blob: fc2beacbb2cda5ba41626a696f348811cc7e5615 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
import { mount, createLocalVue } from '@vue/test-utils';
import TableToolbar from '@/components/Global/TableToolbar';
import BootstrapVue from 'bootstrap-vue';

const localVue = createLocalVue();
localVue.use(BootstrapVue);
describe('TableToolbar.vue', () => {
  const wrapper = mount(TableToolbar, {
    localVue,
    propsData: {
      selectedItemsCount: 0,
    },
    mocks: {
      $t: (key) => key,
    },
  });
  it('should exist', () => {
    expect(wrapper.exists()).toBe(true);
  });
  it('should render class toolbar-container when selectedItemsCount is greater than 0', async () => {
    await wrapper.setProps({ selectedItemsCount: 12 });
    expect(wrapper.find('.toolbar-container').exists()).toBe(true);
  });
  it('should render correctly', () => {
    expect(wrapper.element).toMatchSnapshot();
  });
});