diff options
| author | Filipa Lacerda <filipa@gitlab.com> | 2018-03-07 12:01:36 +0000 |
|---|---|---|
| committer | Filipa Lacerda <filipa@gitlab.com> | 2018-03-07 12:01:36 +0000 |
| commit | b9f9e6fa4e7a54d6caee81799ed88ee40dfb645b (patch) | |
| tree | 4712d8131339bb67cf1bb824ea9c915c8ac75090 /spec/javascripts/pipelines | |
| parent | 2b8e9add859f66f32c76948ed7b95f783188695c (diff) | |
| download | gitlab-ce-b9f9e6fa4e7a54d6caee81799ed88ee40dfb645b.tar.gz | |
Removes UJS from reset cache button
Uses loading button for better UX
Diffstat (limited to 'spec/javascripts/pipelines')
| -rw-r--r-- | spec/javascripts/pipelines/nav_controls_spec.js | 37 |
1 files changed, 24 insertions, 13 deletions
diff --git a/spec/javascripts/pipelines/nav_controls_spec.js b/spec/javascripts/pipelines/nav_controls_spec.js index 77c5258f74c..f4cdc1d21ae 100644 --- a/spec/javascripts/pipelines/nav_controls_spec.js +++ b/spec/javascripts/pipelines/nav_controls_spec.js @@ -39,19 +39,6 @@ describe('Pipelines Nav Controls', () => { expect(component.$el.querySelector('.js-run-pipeline')).toEqual(null); }); - it('should render link for resetting runner caches', () => { - const mockData = { - newPipelinePath: 'foo', - ciLintPath: 'foo', - resetCachePath: 'foo', - }; - - component = mountComponent(NavControlsComponent, mockData); - - expect(component.$el.querySelector('.js-clear-cache').textContent.trim()).toContain('Clear Runner Caches'); - expect(component.$el.querySelector('.js-clear-cache').getAttribute('href')).toEqual(mockData.resetCachePath); - }); - it('should render link for CI lint', () => { const mockData = { newPipelinePath: 'foo', @@ -65,4 +52,28 @@ describe('Pipelines Nav Controls', () => { expect(component.$el.querySelector('.js-ci-lint').textContent.trim()).toContain('CI Lint'); expect(component.$el.querySelector('.js-ci-lint').getAttribute('href')).toEqual(mockData.ciLintPath); }); + + describe('Reset Runners Cache', () => { + beforeEach(() => { + const mockData = { + newPipelinePath: 'foo', + ciLintPath: 'foo', + resetCachePath: 'foo', + }; + + component = mountComponent(NavControlsComponent, mockData); + }); + + it('should render button for resetting runner caches', () => { + expect(component.$el.querySelector('.js-clear-cache').textContent.trim()).toContain('Clear Runner Caches'); + }); + + it('should emit postAction event when reset runner cache button is clicked', () => { + spyOn(component, '$on'); + + component.$el.querySelector('.js-clear-cache').click(); + + expect(component.$on).toHaveBeenCalledWith('postAction', 'foo'); + }); + }); }); |
