summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFilipa Lacerda <filipa@gitlab.com>2016-11-19 13:29:48 +0000
committerFilipa Lacerda <filipa@gitlab.com>2016-11-19 13:29:48 +0000
commit531d4e564b8417db672b096755a54f909ee7af76 (patch)
tree9e43ff055896ac84e219cb2d8185cddd291823d1
parent6e5a1ea02ad929b5c7d5f4c69405281428a26a11 (diff)
downloadgitlab-ce-531d4e564b8417db672b096755a54f909ee7af76.tar.gz
-rw-r--r--spec/javascripts/environments/environment_stop_spec.js.es633
1 files changed, 11 insertions, 22 deletions
diff --git a/spec/javascripts/environments/environment_stop_spec.js.es6 b/spec/javascripts/environments/environment_stop_spec.js.es6
index 3502914dbd6..b842be4da61 100644
--- a/spec/javascripts/environments/environment_stop_spec.js.es6
+++ b/spec/javascripts/environments/environment_stop_spec.js.es6
@@ -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?');
});
});