summaryrefslogtreecommitdiff
path: root/spec/javascripts
diff options
context:
space:
mode:
authorPhil Hughes <me@iamphill.com>2018-02-13 17:38:17 +0000
committerPhil Hughes <me@iamphill.com>2018-02-13 17:38:17 +0000
commitecd77bd0cf3eb6c8b8ddaa811ac3b9561a391692 (patch)
treeab692fe178dab30db828e9a2a0acb810d059d3ba /spec/javascripts
parent49b41879423966f0ed6d931766d0779f055dfa5b (diff)
parent37d3d07b9ffd59f6e214c13247c4b95be9816c78 (diff)
downloadgitlab-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.js29
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);
+ });
+ });
+});