salix-front/test/jest/__tests__/MyDialog.spec.js

29 lines
875 B
JavaScript

import { installQuasarPlugin } from '@quasar/quasar-app-extension-testing-unit-jest';
import { beforeEach, describe, expect, it } from '@jest/globals';
import { DOMWrapper, mount } from '@vue/test-utils';
import MyDialog from './demo/MyDialog';
installQuasarPlugin();
describe('MyDialog', () => {
beforeEach(() => {
mount(MyDialog, {
data: () => ({
isDialogOpen: true,
}),
});
});
it('should mount the document body and expose for testing', () => {
const wrapper = new DOMWrapper(document.body);
expect(wrapper.find('.q-dialog').exists()).toBeTruthy();
});
it('can check the inner text of the dialog', () => {
const wrapper = new DOMWrapper(document.body);
expect(wrapper.find('.q-dialog').html()).toContain('Custom dialog which should be tested');
});
});