Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'spec/frontend/deploy_freeze/components/timezone_dropdown_spec.js')
-rw-r--r--spec/frontend/deploy_freeze/components/timezone_dropdown_spec.js102
1 files changed, 0 insertions, 102 deletions
diff --git a/spec/frontend/deploy_freeze/components/timezone_dropdown_spec.js b/spec/frontend/deploy_freeze/components/timezone_dropdown_spec.js
deleted file mode 100644
index 567d18f8b92..00000000000
--- a/spec/frontend/deploy_freeze/components/timezone_dropdown_spec.js
+++ /dev/null
@@ -1,102 +0,0 @@
-import { GlDropdownItem, GlDropdown } from '@gitlab/ui';
-import { shallowMount } from '@vue/test-utils';
-import Vue from 'vue';
-import Vuex from 'vuex';
-import createStore from '~/deploy_freeze/store';
-import TimezoneDropdown from '~/vue_shared/components/timezone_dropdown.vue';
-import { findTzByName, formatTz, timezoneDataFixture } from '../helpers';
-
-Vue.use(Vuex);
-
-describe('Deploy freeze timezone dropdown', () => {
- let wrapper;
- let store;
-
- const createComponent = (searchTerm, selectedTimezone) => {
- store = createStore({
- projectId: '8',
- timezoneData: timezoneDataFixture,
- });
- wrapper = shallowMount(TimezoneDropdown, {
- store,
- propsData: {
- value: selectedTimezone,
- timezoneData: timezoneDataFixture,
- },
- });
-
- // setData usage is discouraged. See https://gitlab.com/groups/gitlab-org/-/epics/7330 for details
- // eslint-disable-next-line no-restricted-syntax
- wrapper.setData({ searchTerm });
- };
-
- const findAllDropdownItems = () => wrapper.findAllComponents(GlDropdownItem);
- const findDropdownItemByIndex = (index) => wrapper.findAllComponents(GlDropdownItem).at(index);
-
- afterEach(() => {
- wrapper.destroy();
- wrapper = null;
- });
-
- describe('No time zones found', () => {
- beforeEach(() => {
- createComponent('UTC timezone');
- });
-
- it('renders empty results message', () => {
- expect(findDropdownItemByIndex(0).text()).toBe('No matching results');
- });
- });
-
- describe('Search term is empty', () => {
- beforeEach(() => {
- createComponent('');
- });
-
- it('renders all timezones when search term is empty', () => {
- expect(findAllDropdownItems()).toHaveLength(timezoneDataFixture.length);
- });
- });
-
- describe('Time zones found', () => {
- beforeEach(() => {
- createComponent('Alaska');
- });
-
- it('renders only the time zone searched for', () => {
- const selectedTz = findTzByName('Alaska');
- expect(findAllDropdownItems()).toHaveLength(1);
- expect(findDropdownItemByIndex(0).text()).toBe(formatTz(selectedTz));
- });
-
- it('should not display empty results message', () => {
- expect(wrapper.find('[data-testid="noMatchingResults"]').exists()).toBe(false);
- });
-
- describe('Custom events', () => {
- const selectedTz = findTzByName('Alaska');
-
- it('should emit input if a time zone is clicked', () => {
- findDropdownItemByIndex(0).vm.$emit('click');
- expect(wrapper.emitted('input')).toEqual([
- [
- {
- formattedTimezone: formatTz(selectedTz),
- identifier: selectedTz.identifier,
- },
- ],
- ]);
- });
- });
- });
-
- describe('Selected time zone', () => {
- beforeEach(() => {
- createComponent('', 'Alaska');
- });
-
- it('renders selected time zone as dropdown label', () => {
- expect(wrapper.findComponent(GlDropdown).vm.text).toBe('Alaska');
- });
- });
-});