diff options
author | Eric Eastwood <contact@ericeastwood.com> | 2018-02-13 04:30:03 +0300 |
---|---|---|
committer | Eric Eastwood <contact@ericeastwood.com> | 2018-02-13 19:36:47 +0300 |
commit | 37d3d07b9ffd59f6e214c13247c4b95be9816c78 (patch) | |
tree | a2b211c49ed73d602f920c324b54954e46e8959f /spec/javascripts/settings_panels_spec.js | |
parent | ee8e5a596c3d4e18a227185965b52baf6f66c5db (diff) |
Fix settings panel not expanding when fragment hash linked
See https://gitlab.com/gitlab-org/gitlab-ce/issues/43198
Diffstat (limited to 'spec/javascripts/settings_panels_spec.js')
-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); + }); + }); +}); |