diff options
author | Tomasz Maczukin <tomasz@maczukin.pl> | 2018-03-01 00:30:06 +0300 |
---|---|---|
committer | Tomasz Maczukin <tomasz@maczukin.pl> | 2018-03-28 14:57:18 +0300 |
commit | d34e937b93b103435a59e6759a9f30e9f8addc11 (patch) | |
tree | 64cd7907842523f923878f0375f5baf127487cae | |
parent | 1b0b8b9c02642ac19b9f5019cdd38fcec280c2a7 (diff) |
Add tests for frontend changes
-rw-r--r-- | spec/javascripts/jobs/mock_data.js | 4 | ||||
-rw-r--r-- | spec/javascripts/jobs/sidebar_detail_row_spec.js | 17 | ||||
-rw-r--r-- | spec/javascripts/jobs/sidebar_details_block_spec.js | 6 |
3 files changed, 27 insertions, 0 deletions
diff --git a/spec/javascripts/jobs/mock_data.js b/spec/javascripts/jobs/mock_data.js index 43589d54be4..6c3f39f0193 100644 --- a/spec/javascripts/jobs/mock_data.js +++ b/spec/javascripts/jobs/mock_data.js @@ -115,6 +115,10 @@ export default { commit_path: '/root/ci-mock/commit/c58647773a6b5faf066d4ad6ff2c9fbba5f180f6', }, }, + timeout: { + value: '1m 40s', + source: 'runner', + }, merge_request: { iid: 2, path: '/root/ci-mock/merge_requests/2', diff --git a/spec/javascripts/jobs/sidebar_detail_row_spec.js b/spec/javascripts/jobs/sidebar_detail_row_spec.js index 3ac65709c4a..e1f0fe334ac 100644 --- a/spec/javascripts/jobs/sidebar_detail_row_spec.js +++ b/spec/javascripts/jobs/sidebar_detail_row_spec.js @@ -37,4 +37,21 @@ describe('Sidebar detail row', () => { vm.$el.textContent.replace(/\s+/g, ' ').trim(), ).toEqual('this is the title: this is the value'); }); + + it('should not render help when helpUrl not provided', () => { + expect(vm.$el.querySelector('.help-button')).toBeUndefined(); + }); + + beforeEach(() => { + vm = new SidebarDetailRow({ + propsData: { + helpUrl: 'help url', + }, + }).$mount(); + }); + + it('should render help when helpUrl is provided', () => { + expect(vm.$el.querySelector('.help-button a').getAttribute('href')).toEqual('help url'); + }); + }); diff --git a/spec/javascripts/jobs/sidebar_details_block_spec.js b/spec/javascripts/jobs/sidebar_details_block_spec.js index 95532ef5382..602dae514b1 100644 --- a/spec/javascripts/jobs/sidebar_details_block_spec.js +++ b/spec/javascripts/jobs/sidebar_details_block_spec.js @@ -96,6 +96,12 @@ describe('Sidebar details block', () => { ).toEqual('Runner: #1'); }); + it('should render timeout information', () => { + expect( + trimWhitespace(vm.$el.querySelector('.js-job-timeout')), + ).toEqual('Timeout: 1m 40s (from runner)'); + }); + it('should render coverage', () => { expect( trimWhitespace(vm.$el.querySelector('.js-job-coverage')), |