diff options
author | Luke Bennett <lbennett@gitlab.com> | 2018-10-15 16:36:19 +0300 |
---|---|---|
committer | Phil Hughes <me@iamphill.com> | 2018-10-15 16:36:19 +0300 |
commit | 7cf19c0b816bf7bc146a7f634c65d2e7484f26e1 (patch) | |
tree | 1fd5af973b40f7793a9824765d961098a1c60faf /spec/javascripts/settings_panels_spec.js | |
parent | 280a132e15c8e1f66487312584e734b108b00df7 (diff) |
Prioritize group settings, improve panel titles, disable submit without changes
Diffstat (limited to 'spec/javascripts/settings_panels_spec.js')
-rw-r--r-- | spec/javascripts/settings_panels_spec.js | 30 |
1 files changed, 23 insertions, 7 deletions
diff --git a/spec/javascripts/settings_panels_spec.js b/spec/javascripts/settings_panels_spec.js index c1a69bd7018..3b681a9ff28 100644 --- a/spec/javascripts/settings_panels_spec.js +++ b/spec/javascripts/settings_panels_spec.js @@ -1,10 +1,11 @@ +import $ from 'jquery'; import initSettingsPanels from '~/settings_panels'; describe('Settings Panels', () => { - preloadFixtures('projects/ci_cd_settings.html.raw'); + preloadFixtures('groups/edit.html.raw'); beforeEach(() => { - loadFixtures('projects/ci_cd_settings.html.raw'); + loadFixtures('groups/edit.html.raw'); }); describe('initSettingsPane', () => { @@ -13,17 +14,32 @@ describe('Settings Panels', () => { }); it('should expand linked hash fragment panel', () => { - window.location.hash = '#autodevops-settings'; + window.location.hash = '#js-general-settings'; - const pipelineSettingsPanel = document.querySelector('#autodevops-settings'); + const panel = document.querySelector('#js-general-settings'); // Our test environment automatically expands everything so we need to clear that out first - pipelineSettingsPanel.classList.remove('expanded'); + panel.classList.remove('expanded'); - expect(pipelineSettingsPanel.classList.contains('expanded')).toBe(false); + expect(panel.classList.contains('expanded')).toBe(false); initSettingsPanels(); - expect(pipelineSettingsPanel.classList.contains('expanded')).toBe(true); + expect(panel.classList.contains('expanded')).toBe(true); }); }); + + it('does not change the text content of triggers', () => { + const panel = document.querySelector('#js-general-settings'); + const trigger = panel.querySelector('.js-settings-toggle-trigger-only'); + const originalText = trigger.textContent; + + initSettingsPanels(); + + expect(panel.classList.contains('expanded')).toBe(true); + + $(trigger).click(); + + expect(panel.classList.contains('expanded')).toBe(false); + expect(trigger.textContent).toEqual(originalText); + }); }); |