diff options
Diffstat (limited to 'spec/frontend/pages/admin')
4 files changed, 24 insertions, 5 deletions
diff --git a/spec/frontend/pages/admin/abuse_reports/abuse_reports_spec.js b/spec/frontend/pages/admin/abuse_reports/abuse_reports_spec.js index 71c9da238b4..6edfe9641b9 100644 --- a/spec/frontend/pages/admin/abuse_reports/abuse_reports_spec.js +++ b/spec/frontend/pages/admin/abuse_reports/abuse_reports_spec.js @@ -1,5 +1,5 @@ import $ from 'jquery'; -import '~/lib/utils/text_utility'; +import { loadHTMLFixture, resetHTMLFixture } from 'helpers/fixtures'; import AbuseReports from '~/pages/admin/abuse_reports/abuse_reports'; describe('Abuse Reports', () => { @@ -15,11 +15,15 @@ describe('Abuse Reports', () => { $messages.filter((index, element) => element.innerText.indexOf(searchText) > -1).first(); beforeEach(() => { - loadFixtures(FIXTURE); + loadHTMLFixture(FIXTURE); new AbuseReports(); // eslint-disable-line no-new $messages = $('.abuse-reports .message'); }); + afterEach(() => { + resetHTMLFixture(); + }); + it('should truncate long messages', () => { const $longMessage = findMessage('LONG MESSAGE'); diff --git a/spec/frontend/pages/admin/application_settings/account_and_limits_spec.js b/spec/frontend/pages/admin/application_settings/account_and_limits_spec.js index 3a4f93d4464..542eb2f3ab8 100644 --- a/spec/frontend/pages/admin/application_settings/account_and_limits_spec.js +++ b/spec/frontend/pages/admin/application_settings/account_and_limits_spec.js @@ -1,4 +1,5 @@ import $ from 'jquery'; +import { loadHTMLFixture, resetHTMLFixture } from 'helpers/fixtures'; import initUserInternalRegexPlaceholder, { PLACEHOLDER_USER_EXTERNAL_DEFAULT_FALSE, PLACEHOLDER_USER_EXTERNAL_DEFAULT_TRUE, @@ -10,12 +11,16 @@ describe('AccountAndLimits', () => { let $userInternalRegex; beforeEach(() => { - loadFixtures(FIXTURE); + loadHTMLFixture(FIXTURE); initUserInternalRegexPlaceholder(); $userDefaultExternal = $('#application_setting_user_default_external'); $userInternalRegex = document.querySelector('#application_setting_user_default_internal_regex'); }); + afterEach(() => { + resetHTMLFixture(); + }); + describe('Changing of userInternalRegex when userDefaultExternal', () => { it('is unchecked', () => { expect($userDefaultExternal.prop('checked')).toBeFalsy(); diff --git a/spec/frontend/pages/admin/application_settings/metrics_and_profiling/usage_statistics_spec.js b/spec/frontend/pages/admin/application_settings/metrics_and_profiling/usage_statistics_spec.js index 4140b985682..3a52c243867 100644 --- a/spec/frontend/pages/admin/application_settings/metrics_and_profiling/usage_statistics_spec.js +++ b/spec/frontend/pages/admin/application_settings/metrics_and_profiling/usage_statistics_spec.js @@ -2,6 +2,7 @@ import initSetHelperText, { HELPER_TEXT_SERVICE_PING_DISABLED, HELPER_TEXT_SERVICE_PING_ENABLED, } from '~/pages/admin/application_settings/metrics_and_profiling/usage_statistics'; +import { loadHTMLFixture, resetHTMLFixture } from 'helpers/fixtures'; describe('UsageStatistics', () => { const FIXTURE = 'application_settings/usage.html'; @@ -11,7 +12,7 @@ describe('UsageStatistics', () => { let servicePingFeaturesHelperText; beforeEach(() => { - loadFixtures(FIXTURE); + loadHTMLFixture(FIXTURE); initSetHelperText(); servicePingCheckBox = document.getElementById('application_setting_usage_ping_enabled'); servicePingFeaturesCheckBox = document.getElementById( @@ -21,6 +22,10 @@ describe('UsageStatistics', () => { servicePingFeaturesHelperText = document.getElementById('service_ping_features_helper_text'); }); + afterEach(() => { + resetHTMLFixture(); + }); + const expectEnabledservicePingFeaturesCheckBox = () => { expect(servicePingFeaturesCheckBox.classList.contains('gl-cursor-not-allowed')).toBe(false); expect(servicePingFeaturesHelperText.textContent).toEqual(HELPER_TEXT_SERVICE_PING_ENABLED); diff --git a/spec/frontend/pages/admin/projects/components/namespace_select_spec.js b/spec/frontend/pages/admin/projects/components/namespace_select_spec.js index f10b202f4d7..909349569a8 100644 --- a/spec/frontend/pages/admin/projects/components/namespace_select_spec.js +++ b/spec/frontend/pages/admin/projects/components/namespace_select_spec.js @@ -1,5 +1,6 @@ import { mount } from '@vue/test-utils'; import { nextTick } from 'vue'; +import { setHTMLFixture, resetHTMLFixture } from 'helpers/fixtures'; import Api from '~/api'; import NamespaceSelect from '~/pages/admin/projects/components/namespace_select.vue'; @@ -26,7 +27,7 @@ describe('Dropdown select component', () => { }; beforeEach(() => { - setFixtures('<div class="test-container"></div>'); + setHTMLFixture('<div class="test-container"></div>'); jest.spyOn(Api, 'namespaces').mockImplementation((_, callback) => callback([ @@ -36,6 +37,10 @@ describe('Dropdown select component', () => { ); }); + afterEach(() => { + resetHTMLFixture(); + }); + it('creates a hidden input if fieldName is provided', () => { mountDropdown({ fieldName: 'namespace-input' }); |