summaryrefslogtreecommitdiff
path: root/spec/javascripts/settings_panels_spec.js
blob: d433f8c3e074dfe12fd04f86807fe7321d7b9721 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
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);
    });
  });
});