Commit d775d790 authored by Jeremy Elder's avatar Jeremy Elder Committed by Tim Zallmann

Replace deprecated button …/compare_versions.vue

parent 8d626e03
<script> <script>
import { mapActions, mapGetters, mapState } from 'vuex'; import { mapActions, mapGetters, mapState } from 'vuex';
import { GlTooltipDirective, GlLink, GlDeprecatedButton, GlSprintf } from '@gitlab/ui'; import { GlTooltipDirective, GlLink, GlButton, GlSprintf } from '@gitlab/ui';
import { __ } from '~/locale'; import { __ } from '~/locale';
import { polyfillSticky } from '~/lib/utils/sticky'; import { polyfillSticky } from '~/lib/utils/sticky';
import Icon from '~/vue_shared/components/icon.vue';
import CompareDropdownLayout from './compare_dropdown_layout.vue'; import CompareDropdownLayout from './compare_dropdown_layout.vue';
import SettingsDropdown from './settings_dropdown.vue'; import SettingsDropdown from './settings_dropdown.vue';
import DiffStats from './diff_stats.vue'; import DiffStats from './diff_stats.vue';
...@@ -12,9 +11,8 @@ import { CENTERED_LIMITED_CONTAINER_CLASSES } from '../constants'; ...@@ -12,9 +11,8 @@ import { CENTERED_LIMITED_CONTAINER_CLASSES } from '../constants';
export default { export default {
components: { components: {
CompareDropdownLayout, CompareDropdownLayout,
Icon,
GlLink, GlLink,
GlDeprecatedButton, GlButton,
GlSprintf, GlSprintf,
SettingsDropdown, SettingsDropdown,
DiffStats, DiffStats,
...@@ -84,18 +82,15 @@ export default { ...@@ -84,18 +82,15 @@ export default {
[CENTERED_LIMITED_CONTAINER_CLASSES]: isLimitedContainer, [CENTERED_LIMITED_CONTAINER_CLASSES]: isLimitedContainer,
}" }"
> >
<button <gl-button
v-gl-tooltip.hover v-gl-tooltip.hover
type="button" variant="default"
class="btn btn-default gl-mr-3 js-toggle-tree-list" icon="file-tree"
:class="{ class="gl-mr-3 js-toggle-tree-list"
active: showTreeList,
}"
:title="toggleFileBrowserTitle" :title="toggleFileBrowserTitle"
:selected="showTreeList"
@click="toggleShowTreeList" @click="toggleShowTreeList"
> />
<icon name="file-tree" />
</button>
<gl-sprintf <gl-sprintf
v-if="showDropdowns" v-if="showDropdowns"
class="d-flex align-items-center compare-versions-container" class="d-flex align-items-center compare-versions-container"
...@@ -124,16 +119,22 @@ export default { ...@@ -124,16 +119,22 @@ export default {
:added-lines="addedLines" :added-lines="addedLines"
:removed-lines="removedLines" :removed-lines="removedLines"
/> />
<gl-deprecated-button <gl-button
v-if="commit || startVersion" v-if="commit || startVersion"
:href="latestVersionPath" :href="latestVersionPath"
variant="default"
class="gl-mr-3 js-latest-version" class="gl-mr-3 js-latest-version"
> >
{{ __('Show latest version') }} {{ __('Show latest version') }}
</gl-deprecated-button> </gl-button>
<gl-deprecated-button v-show="hasCollapsedFile" class="gl-mr-3" @click="expandAllFiles"> <gl-button
v-show="hasCollapsedFile"
variant="default"
class="gl-mr-3"
@click="expandAllFiles"
>
{{ __('Expand all') }} {{ __('Expand all') }}
</gl-deprecated-button> </gl-button>
<settings-dropdown /> <settings-dropdown />
</div> </div>
</div> </div>
......
---
title: Replace deprecated button with new button
merge_request: 38940
author:
type: other
...@@ -2,7 +2,6 @@ import { trimText } from 'helpers/text_helper'; ...@@ -2,7 +2,6 @@ import { trimText } from 'helpers/text_helper';
import { mount, createLocalVue } from '@vue/test-utils'; import { mount, createLocalVue } from '@vue/test-utils';
import Vuex from 'vuex'; import Vuex from 'vuex';
import CompareVersionsComponent from '~/diffs/components/compare_versions.vue'; import CompareVersionsComponent from '~/diffs/components/compare_versions.vue';
import Icon from '~/vue_shared/components/icon.vue';
import { createStore } from '~/mr_notes/stores'; import { createStore } from '~/mr_notes/stores';
import diffsMockData from '../mock_data/merge_request_diffs'; import diffsMockData from '../mock_data/merge_request_diffs';
import getDiffWithCommit from '../mock_data/diff_with_commit'; import getDiffWithCommit from '../mock_data/diff_with_commit';
...@@ -51,7 +50,7 @@ describe('CompareVersions', () => { ...@@ -51,7 +50,7 @@ describe('CompareVersions', () => {
expect(treeListBtn.exists()).toBe(true); expect(treeListBtn.exists()).toBe(true);
expect(treeListBtn.attributes('title')).toBe('Hide file browser'); expect(treeListBtn.attributes('title')).toBe('Hide file browser');
expect(treeListBtn.find(Icon).props('name')).toBe('file-tree'); expect(treeListBtn.props('icon')).toBe('file-tree');
}); });
it('should render comparison dropdowns with correct values', () => { it('should render comparison dropdowns with correct values', () => {
......
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