diff options
author | Phil Hughes <me@iamphill.com> | 2018-02-13 17:38:17 +0000 |
---|---|---|
committer | Phil Hughes <me@iamphill.com> | 2018-02-13 17:38:17 +0000 |
commit | ecd77bd0cf3eb6c8b8ddaa811ac3b9561a391692 (patch) | |
tree | ab692fe178dab30db828e9a2a0acb810d059d3ba /spec/javascripts | |
parent | 49b41879423966f0ed6d931766d0779f055dfa5b (diff) | |
parent | 37d3d07b9ffd59f6e214c13247c4b95be9816c78 (diff) | |
download | gitlab-ce-ecd77bd0cf3eb6c8b8ddaa811ac3b9561a391692.tar.gz |
Merge branch '43198-fix-settings-panel-expanding-when-fragment-hash-linked' into 'master'
Fix settings panels not expanding when fragment hash linked
Closes #43198
See merge request gitlab-org/gitlab-ce!17074
Diffstat (limited to 'spec/javascripts')
-rw-r--r-- | spec/javascripts/settings_panels_spec.js | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/spec/javascripts/settings_panels_spec.js b/spec/javascripts/settings_panels_spec.js new file mode 100644 index 00000000000..d433f8c3e07 --- /dev/null +++ b/spec/javascripts/settings_panels_spec.js @@ -0,0 +1,29 @@ +import initSettingsPanels from '~/settings_panels'; + +describe('Settings Panels', () => { + preloadFixtures('projects/ci_cd_settings.html.raw'); + + beforeEach(() => { + loadFixtures('projects/ci_cd_settings.html.raw'); + }); + + describe('initSettingsPane', () => { + afterEach(() => { + location.hash = ''; + }); + + it('should expand linked hash fragment panel', () => { + location.hash = '#js-general-pipeline-settings'; + + const pipelineSettingsPanel = document.querySelector('#js-general-pipeline-settings'); + // Our test environment automatically expands everything so we need to clear that out first + pipelineSettingsPanel.classList.remove('expanded'); + + expect(pipelineSettingsPanel.classList.contains('expanded')).toBe(false); + + initSettingsPanels(); + + expect(pipelineSettingsPanel.classList.contains('expanded')).toBe(true); + }); + }); +}); |