gitlab-org--gitlab-foss/spec/javascripts/settings_panels_spec.js
Winnie Hellmann ad985a7a28 Merge branch 'winh-remove-sushi' into 'master'
Remove .raw from JavaScript fixture file names

Closes #59201

See merge request gitlab-org/gitlab-ce!26430

(cherry picked from commit 79a45f7f02)
2019-03-26 16:03:28 +00:00

45 lines
1.3 KiB
JavaScript

import $ from 'jquery';
import initSettingsPanels from '~/settings_panels';
describe('Settings Panels', () => {
preloadFixtures('groups/edit.html');
beforeEach(() => {
loadFixtures('groups/edit.html');
});
describe('initSettingsPane', () => {
afterEach(() => {
window.location.hash = '';
});
it('should expand linked hash fragment panel', () => {
window.location.hash = '#js-general-settings';
const panel = document.querySelector('#js-general-settings');
// Our test environment automatically expands everything so we need to clear that out first
panel.classList.remove('expanded');
expect(panel.classList.contains('expanded')).toBe(false);
initSettingsPanels();
expect(panel.classList.contains('expanded')).toBe(true);
});
});
it('does not change the text content of triggers', () => {
const panel = document.querySelector('#js-general-settings');
const trigger = panel.querySelector('.js-settings-toggle-trigger-only');
const originalText = trigger.textContent;
initSettingsPanels();
expect(panel.classList.contains('expanded')).toBe(true);
$(trigger).click();
expect(panel.classList.contains('expanded')).toBe(false);
expect(trigger.textContent).toEqual(originalText);
});
});