summaryrefslogtreecommitdiff
path: root/spec/javascripts/pipelines
diff options
context:
space:
mode:
authorWinnie Hellmann <winnie@gitlab.com>2018-10-05 09:34:08 +0200
committerWinnie Hellmann <winnie@gitlab.com>2018-10-05 09:34:31 +0200
commitc5dead78558e552801205bf6e0a9b78f1e88711d (patch)
tree50c154441209bbbc71aa69f4fe9f8b2e78dde496 /spec/javascripts/pipelines
parente8f14ef8859c2b6f870090666331f538702c40b9 (diff)
downloadgitlab-ce-c5dead78558e552801205bf6e0a9b78f1e88711d.tar.gz
Make sure remaining time of scheduled jobs is positive in pipelines list
Diffstat (limited to 'spec/javascripts/pipelines')
-rw-r--r--spec/javascripts/pipelines/pipelines_actions_spec.js25
1 files changed, 20 insertions, 5 deletions
diff --git a/spec/javascripts/pipelines/pipelines_actions_spec.js b/spec/javascripts/pipelines/pipelines_actions_spec.js
index fe60a883f77..0566bc55693 100644
--- a/spec/javascripts/pipelines/pipelines_actions_spec.js
+++ b/spec/javascripts/pipelines/pipelines_actions_spec.js
@@ -47,11 +47,22 @@ describe('Pipelines Actions dropdown', () => {
playable: true,
scheduled_at: '2063-04-05T00:42:00Z',
};
- const findDropdownItem = () => vm.$el.querySelector('.dropdown-menu li button');
+ const expiredJobAction = {
+ name: 'expired action',
+ path: `${TEST_HOST}/expired/job/action`,
+ playable: true,
+ scheduled_at: '2018-10-05T08:23:00Z',
+ };
+ const findDropdownItem = action => {
+ const buttons = vm.$el.querySelectorAll('.dropdown-menu li button');
+ return Array.prototype.find.call(buttons, element =>
+ element.innerText.trim().startsWith(action.name),
+ );
+ };
beforeEach(() => {
spyOn(Date, 'now').and.callFake(() => new Date('2063-04-04T00:42:00Z').getTime());
- vm = mountComponent(Component, { actions: [scheduledJobAction] });
+ vm = mountComponent(Component, { actions: [scheduledJobAction, expiredJobAction] });
});
it('emits postAction event after confirming', () => {
@@ -59,7 +70,7 @@ describe('Pipelines Actions dropdown', () => {
eventHub.$on('postAction', emitSpy);
spyOn(window, 'confirm').and.callFake(() => true);
- findDropdownItem().click();
+ findDropdownItem(scheduledJobAction).click();
expect(window.confirm).toHaveBeenCalled();
expect(emitSpy).toHaveBeenCalledWith(scheduledJobAction.path);
@@ -70,14 +81,18 @@ describe('Pipelines Actions dropdown', () => {
eventHub.$on('postAction', emitSpy);
spyOn(window, 'confirm').and.callFake(() => false);
- findDropdownItem().click();
+ findDropdownItem(scheduledJobAction).click();
expect(window.confirm).toHaveBeenCalled();
expect(emitSpy).not.toHaveBeenCalled();
});
it('displays the remaining time in the dropdown', () => {
- expect(findDropdownItem()).toContainText('24:00:00');
+ expect(findDropdownItem(scheduledJobAction)).toContainText('24:00:00');
+ });
+
+ it('displays 00:00:00 for expired jobs in the dropdown', () => {
+ expect(findDropdownItem(expiredJobAction)).toContainText('00:00:00');
});
});
});