Fix broken test
This commit is contained in:
parent
f9a662c38f
commit
6e5a1ea02a
|
@ -13,16 +13,11 @@
|
|||
},
|
||||
},
|
||||
|
||||
methods: {
|
||||
openConfirmDialog() {
|
||||
return window.confirm('Are you sure you want to stop this environment?'); // eslint-disable-line
|
||||
},
|
||||
},
|
||||
|
||||
template: `
|
||||
<a v-on:click="openConfirmDialog"
|
||||
<a
|
||||
class="btn stop-env-link"
|
||||
:href="stop_url"
|
||||
data-confirm="Are you sure you want to stop this environment?"
|
||||
data-method="post"
|
||||
rel="nofollow">
|
||||
<i class="fa fa-stop stop-env-icon"></i>
|
||||
|
|
|
@ -16,4 +16,24 @@ describe('Stop Component', () => {
|
|||
});
|
||||
expect(component.$el.getAttribute('href')).toEqual(stopURL);
|
||||
});
|
||||
|
||||
describe('When clicked', () => {
|
||||
it('Should open popup with confirmation warning', () => {
|
||||
const component = new window.gl.environmentsList.StopComponent({
|
||||
el: document.querySelector('.test-dom-element'),
|
||||
propsData: {
|
||||
stop_url: '#',
|
||||
},
|
||||
});
|
||||
|
||||
let opened = false;
|
||||
|
||||
spyOn(window, 'confirm').and.callFake(function () {
|
||||
opened = true;
|
||||
expect(opened).toEqual(true);
|
||||
return false;
|
||||
});
|
||||
component.$el.click();
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
Loading…
Reference in New Issue