Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
"vuedraggable": "^2.24.1"
},
"devDependencies": {
"@types/jest": "^26.0.14",
"@types/jest": "^27.0.1",
"@typescript-eslint/eslint-plugin": "^4.1.1",
"@typescript-eslint/parser": "^4.1.1",
"@vue/cli-plugin-babel": "^4.0.5",
Expand All @@ -61,9 +61,9 @@
"babel-eslint": "^10.0.1",
"eslint": "^7.9.0",
"eslint-plugin-vue": "^7.1.0",
"lint-staged": "^10.4.0",
"lint-staged": "^11.1.2",
"node-sass": "^6.0.1",
"sass-loader": "^10.0.2",
"sass-loader": "^12.1.0",
"typescript": "^4.0.3",
"vue-template-compiler": "^2.5.21",
"vuepress": "^1.2.0"
Expand Down
2 changes: 1 addition & 1 deletion tests/unit/colored-borders.spec.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { mount } from '@vue/test-utils';
import Draggable from 'vuedraggable';
import { QueryBuilderConfig, RuleSet } from '@/types';
import QueryBuilder from '@/QueryBuilder.vue';
import QueryBuilderGroup from '@/QueryBuilderGroup.vue';
import QueryBuilderChild from '@/QueryBuilderChild.vue';
import Draggable from 'vuedraggable';
import Component from '../components/Component.vue';

describe('Testing drag\'n\'drop related features', () => {
Expand Down
39 changes: 21 additions & 18 deletions tests/unit/drag-n-drop.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ describe('Test drag\'n\'drop related actions', () => {
expect((app.emitted('input') as any)[0][0]).toStrictEqual(qbClone);
});

it('tests drag\'n\'drop by merging with a parent group', async done => {
it('tests drag\'n\'drop by merging with a parent group', done => {
const app = mount(QueryBuilder, {
propsData: {
value,
Expand Down Expand Up @@ -204,15 +204,16 @@ describe('Test drag\'n\'drop related actions', () => {
};
adderComponent.findComponent(Draggable).vm.$emit('change', addEv);

await flushPromises();
flushPromises()
.then(() => {
expect((parent.emitted('query-update') as any)[0][0]).toStrictEqual(qbClone);
expect((app.emitted('input') as any)[0][0]).toStrictEqual(qbClone);

expect((parent.emitted('query-update') as any)[0][0]).toStrictEqual(qbClone);
expect((app.emitted('input') as any)[0][0]).toStrictEqual(qbClone);

done();
done();
});
});

it('tests drag\'n\'dropping with merging within the adding group', async done => {
it('tests drag\'n\'dropping with merging within the adding group', done => {
const app = mount(QueryBuilder, {
propsData: {
value,
Expand Down Expand Up @@ -263,15 +264,16 @@ describe('Test drag\'n\'drop related actions', () => {
};
adderComponent.findComponent(Draggable).vm.$emit('change', addEv);

await flushPromises();

expect((adderComponent.emitted('query-update') as any)[0][0]).toStrictEqual(adder);
expect((app.emitted('input') as any)[0][0]).toStrictEqual(qbClone);
flushPromises()
.then(() => {
expect((adderComponent.emitted('query-update') as any)[0][0]).toStrictEqual(adder);
expect((app.emitted('input') as any)[0][0]).toStrictEqual(qbClone);

done();
done();
});
});

it('tests drag\'n\'dropping with merging within the deleting group', async done => {
it('tests drag\'n\'dropping with merging within the deleting group', done => {
const app = mount(QueryBuilder, {
propsData: {
value,
Expand Down Expand Up @@ -322,11 +324,12 @@ describe('Test drag\'n\'drop related actions', () => {
};
adderComponent.findComponent(Draggable).vm.$emit('change', addEv);

await flushPromises();

expect((removerComponent.emitted('query-update') as any)[0][0]).toStrictEqual(remover);
expect((app.emitted('input') as any)[0][0]).toStrictEqual(qbClone);
flushPromises()
.then(() => {
expect((removerComponent.emitted('query-update') as any)[0][0]).toStrictEqual(remover);
expect((app.emitted('input') as any)[0][0]).toStrictEqual(qbClone);

done();
done();
});
});
});
Loading