Commit 58f1442c authored by Paul Gascou-Vaillancourt's avatar Paul Gascou-Vaillancourt Committed by Lukas Eipert

Fix modal related tests

parent 20f77f33
......@@ -72,21 +72,15 @@ describe('collapsible registry container', () => {
expect(findDeleteBtn()).not.toBeNull();
});
describe('clicked on delete', () => {
beforeEach(done => {
findDeleteBtn().click();
Vue.nextTick(done);
});
it('should open confirmation modal', () => {
expect(vm.$el.querySelector('#confirm-repo-deletion-modal')).not.toBeNull();
});
it('should call deleteItem when confirming deletion', done => {
findDeleteBtn().click();
spyOn(vm, 'deleteItem').and.returnValue(Promise.resolve());
it('should call deleteItem when confirming deletion', () => {
spyOn(vm, 'deleteItem').and.returnValue(Promise.resolve());
vm.$el.querySelector('#confirm-repo-deletion-modal .btn-danger').click();
Vue.nextTick(() => {
document.querySelector('#confirm-repo-deletion-modal .btn-danger').click();
expect(vm.deleteItem).toHaveBeenCalledWith(vm.repo);
done();
});
});
});
......
......@@ -46,23 +46,16 @@ describe('table registry', () => {
expect(findDeleteBtn()).toBeDefined();
});
describe('clicked on delete', () => {
beforeEach(done => {
findDeleteBtn().click();
Vue.nextTick(done);
});
it('should open confirmation modal and set itemToBeDeleted properly', () => {
expect(vm.itemToBeDeleted).toEqual(firstImage);
expect(vm.$el.querySelector('#confirm-image-deletion-modal')).not.toBeNull();
});
it('should call deleteItem and reset itemToBeDeleted when confirming deletion', done => {
findDeleteBtn().click();
spyOn(vm, 'deleteItem').and.returnValue(Promise.resolve());
it('should call deleteItem and reset itemToBeDeleted when confirming deletion', () => {
spyOn(vm, 'deleteItem').and.returnValue(Promise.resolve());
vm.$el.querySelector('#confirm-image-deletion-modal .btn-danger').click();
Vue.nextTick(() => {
document.querySelector('#confirm-image-deletion-modal .btn-danger').click();
expect(vm.deleteItem).toHaveBeenCalledWith(firstImage);
expect(vm.itemToBeDeleted).toBeNull();
done();
});
});
});
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment