Commit ecd77bd0 authored by Phil Hughes's avatar Phil Hughes

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
parents 49b41879 37d3d07b
......@@ -42,7 +42,7 @@ export default function initSettingsPanels() {
if (location.hash) {
const $target = $(location.hash);
if ($target.length && $target.hasClass('.settings')) {
if ($target.length && $target.hasClass('settings')) {
expandSection($target);
}
}
......
---
title: Fix settings panels not expanding when fragment hash linked
merge_request: 17074
author:
type: fixed
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);
});
});
});
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment