Skip to content
Snippets Groups Projects
Commit 531d4e56 authored by Filipa Lacerda's avatar Filipa Lacerda
Browse files

Fix test

parent 6e5a1ea0
No related branches found
No related tags found
No related merge requests found
Loading
Loading
@@ -2,38 +2,27 @@
//= require environments/components/environment_stop
describe('Stop Component', () => {
fixture.preload('environments/element.html');
let stopURL;
let component;
beforeEach(() => {
fixture.load('environments/element.html');
});
 
it('should link to the provided URL', () => {
const stopURL = '/stop';
const component = new window.gl.environmentsList.StopComponent({
stopURL = '/stop';
component = new window.gl.environmentsList.StopComponent({
el: document.querySelector('.test-dom-element'),
propsData: {
stop_url: stopURL,
},
});
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;
it('should link to the provided URL', () => {
expect(component.$el.getAttribute('href')).toEqual(stopURL);
});
 
spyOn(window, 'confirm').and.callFake(function () {
opened = true;
expect(opened).toEqual(true);
return false;
});
component.$el.click();
});
it('should have a data-confirm attribute', () => {
expect(component.$el.getAttribute('data-confirm')).toEqual('Are you sure you want to stop this environment?');
});
});
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