2022-03-24 12:41:17 +00:00
|
|
|
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', () => {
|
2022-03-24 13:57:11 +00:00
|
|
|
beforeEach(() => {
|
|
|
|
mount(MyDialog, {
|
|
|
|
data: () => ({
|
|
|
|
isDialogOpen: true,
|
|
|
|
}),
|
|
|
|
});
|
2022-03-24 12:41:17 +00:00
|
|
|
});
|
|
|
|
|
2022-03-24 13:57:11 +00:00
|
|
|
it('should mount the document body and expose for testing', () => {
|
|
|
|
const wrapper = new DOMWrapper(document.body);
|
2022-03-24 12:41:17 +00:00
|
|
|
|
2022-03-24 13:57:11 +00:00
|
|
|
expect(wrapper.find('.q-dialog').exists()).toBeTruthy();
|
|
|
|
});
|
2022-03-24 12:41:17 +00:00
|
|
|
|
2022-03-24 13:57:11 +00:00
|
|
|
it('can check the inner text of the dialog', () => {
|
|
|
|
const wrapper = new DOMWrapper(document.body);
|
2022-03-24 12:41:17 +00:00
|
|
|
|
2022-03-24 13:57:11 +00:00
|
|
|
expect(wrapper.find('.q-dialog').html()).toContain('Custom dialog which should be tested');
|
|
|
|
});
|
2022-03-24 12:41:17 +00:00
|
|
|
});
|