Commit 531d4e56 authored by Filipa Lacerda's avatar Filipa Lacerda

Fix test

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