Commit 417c3e11 authored by Brandon Labuschagne's avatar Brandon Labuschagne

Merge branch...

Merge branch 'Replace-GlDeprecatedDropdown-with-GlDropdown-in-app/assets/javascripts/vue_shared/components/timezone_dropdown.vue' into 'master'

Gldeprecateddropdown to  Gldropdown in timezone_ dropdown.vue

See merge request gitlab-org/gitlab!41434
parents 29f5e454 a846c438
<script> <script>
import { GlDropdown, GlDeprecatedDropdownItem, GlSearchBoxByType, GlIcon } from '@gitlab/ui'; import { GlDropdown, GlDropdownItem, GlSearchBoxByType } from '@gitlab/ui';
import { __ } from '~/locale'; import { __ } from '~/locale';
import autofocusonshow from '~/vue_shared/directives/autofocusonshow'; import autofocusonshow from '~/vue_shared/directives/autofocusonshow';
...@@ -7,9 +7,8 @@ export default { ...@@ -7,9 +7,8 @@ export default {
name: 'TimezoneDropdown', name: 'TimezoneDropdown',
components: { components: {
GlDropdown, GlDropdown,
GlDeprecatedDropdownItem, GlDropdownItem,
GlSearchBoxByType, GlSearchBoxByType,
GlIcon,
}, },
directives: { directives: {
autofocusonshow, autofocusonshow,
...@@ -74,29 +73,23 @@ export default { ...@@ -74,29 +73,23 @@ export default {
}; };
</script> </script>
<template> <template>
<gl-dropdown :text="value" block lazy menu-class="gl-w-full!"> <gl-dropdown :text="selectedTimezoneLabel" block lazy menu-class="gl-w-full!">
<template #button-content>
<span class="gl-flex-grow-1" :class="{ 'gl-text-gray-300': !value }">
{{ selectedTimezoneLabel }}
</span>
<gl-icon name="chevron-down" />
</template>
<gl-search-box-by-type v-model.trim="searchTerm" v-autofocusonshow autofocus /> <gl-search-box-by-type v-model.trim="searchTerm" v-autofocusonshow autofocus />
<gl-deprecated-dropdown-item <gl-dropdown-item
v-for="timezone in filteredResults" v-for="timezone in filteredResults"
:key="timezone.formattedTimezone" :key="timezone.formattedTimezone"
:is-checked="isSelected(timezone)"
:is-check-item="true"
@click="selectTimezone(timezone)" @click="selectTimezone(timezone)"
> >
<gl-icon
:class="{ invisible: !isSelected(timezone) }"
name="mobile-issue-close"
class="gl-vertical-align-middle"
/>
{{ timezone.formattedTimezone }} {{ timezone.formattedTimezone }}
</gl-deprecated-dropdown-item> </gl-dropdown-item>
<gl-deprecated-dropdown-item v-if="!filteredResults.length" data-testid="noMatchingResults"> <gl-dropdown-item
v-if="!filteredResults.length"
class="gl-pointer-events-none"
data-testid="noMatchingResults"
>
{{ $options.tranlations.noResultsText }} {{ $options.tranlations.noResultsText }}
</gl-deprecated-dropdown-item> </gl-dropdown-item>
</gl-dropdown> </gl-dropdown>
</template> </template>
---
title: Replace GlDeprecatedDropdown with GlDropDown in timezone-dropdown.vue
merge_request: 41434
author: nuwe1
type: other
import Vuex from 'vuex'; import Vuex from 'vuex';
import { shallowMount, createLocalVue } from '@vue/test-utils'; import { shallowMount, createLocalVue } from '@vue/test-utils';
import { GlDeprecatedDropdownItem, GlDropdown } from '@gitlab/ui'; import { GlDropdownItem, GlDropdown } from '@gitlab/ui';
import TimezoneDropdown from '~/vue_shared/components/timezone_dropdown.vue'; import TimezoneDropdown from '~/vue_shared/components/timezone_dropdown.vue';
import createStore from '~/deploy_freeze/store'; import createStore from '~/deploy_freeze/store';
...@@ -29,8 +29,8 @@ describe('Deploy freeze timezone dropdown', () => { ...@@ -29,8 +29,8 @@ describe('Deploy freeze timezone dropdown', () => {
wrapper.setData({ searchTerm }); wrapper.setData({ searchTerm });
}; };
const findAllDropdownItems = () => wrapper.findAll(GlDeprecatedDropdownItem); const findAllDropdownItems = () => wrapper.findAll(GlDropdownItem);
const findDropdownItemByIndex = index => wrapper.findAll(GlDeprecatedDropdownItem).at(index); const findDropdownItemByIndex = index => wrapper.findAll(GlDropdownItem).at(index);
afterEach(() => { afterEach(() => {
wrapper.destroy(); wrapper.destroy();
......
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