Skip to content
Snippets Groups Projects
Unverified Commit 2643d3b3 authored by Paul Gascou-Vaillancourt's avatar Paul Gascou-Vaillancourt Committed by Lukas Eipert
Browse files

Fix modal related tests

parent 7abbbce3
No related branches found
No related tags found
No related merge requests found
Loading
Loading
@@ -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();
});
});
});
Loading
Loading
Loading
Loading
@@ -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();
});
});
});
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment