2016-11-10 13:58:35 -05:00
|
|
|
//= require vue
|
|
|
|
//= require environments/components/environment_rollback
|
|
|
|
describe('Rollback Component', () => {
|
|
|
|
fixture.preload('environments/element.html');
|
|
|
|
|
|
|
|
const retryURL = 'https://gitlab.com/retry';
|
|
|
|
|
|
|
|
beforeEach(() => {
|
|
|
|
fixture.load('environments/element.html');
|
|
|
|
});
|
|
|
|
|
2016-12-08 07:06:49 -05:00
|
|
|
it('Should link to the provided retryUrl', () => {
|
2016-11-10 13:58:35 -05:00
|
|
|
const component = new window.gl.environmentsList.RollbackComponent({
|
|
|
|
el: document.querySelector('.test-dom-element'),
|
|
|
|
propsData: {
|
2016-12-08 06:54:08 -05:00
|
|
|
retryUrl: retryURL,
|
|
|
|
isLastDeployment: true,
|
2016-11-10 13:58:35 -05:00
|
|
|
},
|
|
|
|
});
|
|
|
|
|
|
|
|
expect(component.$el.getAttribute('href')).toEqual(retryURL);
|
|
|
|
});
|
|
|
|
|
2016-12-08 07:06:49 -05:00
|
|
|
it('Should render Re-deploy label when isLastDeployment is true', () => {
|
2016-11-10 13:58:35 -05:00
|
|
|
const component = new window.gl.environmentsList.RollbackComponent({
|
|
|
|
el: document.querySelector('.test-dom-element'),
|
|
|
|
propsData: {
|
2016-12-08 06:54:08 -05:00
|
|
|
retryUrl: retryURL,
|
|
|
|
isLastDeployment: true,
|
2016-11-10 13:58:35 -05:00
|
|
|
},
|
|
|
|
});
|
|
|
|
|
|
|
|
expect(component.$el.querySelector('span').textContent).toContain('Re-deploy');
|
|
|
|
});
|
|
|
|
|
|
|
|
|
2016-12-08 07:06:49 -05:00
|
|
|
it('Should render Rollback label when isLastDeployment is false', () => {
|
2016-11-10 13:58:35 -05:00
|
|
|
const component = new window.gl.environmentsList.RollbackComponent({
|
|
|
|
el: document.querySelector('.test-dom-element'),
|
|
|
|
propsData: {
|
2016-12-08 06:54:08 -05:00
|
|
|
retryUrl: retryURL,
|
|
|
|
isLastDeployment: false,
|
2016-11-10 13:58:35 -05:00
|
|
|
},
|
|
|
|
});
|
|
|
|
|
|
|
|
expect(component.$el.querySelector('span').textContent).toContain('Rollback');
|
|
|
|
});
|
|
|
|
});
|