Commit ccf2d16a authored by Juan J. Ramirez's avatar Juan J. Ramirez Committed by Ezekiel Kigbo

Migration monitoring button to gl-button in Environment table

parent c9450eab
<script>
import { GlDeprecatedButton, GlTooltipDirective, GlIcon } from '@gitlab/ui';
import { GlButton, GlTooltipDirective } from '@gitlab/ui';
import { __ } from '~/locale';
/**
* Renders the Monitoring (Metrics) link in environments table.
*/
export default {
components: {
GlIcon,
GlDeprecatedButton,
GlButton,
},
directives: {
GlTooltip: GlTooltipDirective,
......@@ -26,15 +25,14 @@ export default {
};
</script>
<template>
<gl-deprecated-button
<gl-button
v-gl-tooltip
:href="monitoringUrl"
:title="title"
:aria-label="title"
class="monitoring-url d-none d-sm-none d-md-block"
class="monitoring-url gl-display-none gl-display-sm-none gl-display-md-block"
icon="chart"
rel="noopener noreferrer nofollow"
variant="default"
>
<gl-icon name="chart" />
</gl-deprecated-button>
/>
</template>
---
title: Migrating to gl-button in Environments table
merge_request: 40444
author:
type: changed
import { shallowMount } from '@vue/test-utils';
import { GlIcon } from '@gitlab/ui';
import { GlButton } from '@gitlab/ui';
import MonitoringComponent from '~/environments/components/environment_monitoring.vue';
describe('Monitoring Component', () => {
......@@ -15,8 +15,8 @@ describe('Monitoring Component', () => {
});
};
const findIcons = () => wrapper.findAll(GlIcon);
const findIconsByName = name => findIcons().filter(icon => icon.props('name') === name);
const findButtons = () => wrapper.findAll(GlButton);
const findButtonsByIcon = icon => findButtons().filter(button => button.props('icon') === icon);
beforeEach(() => {
createWrapper();
......@@ -30,7 +30,7 @@ describe('Monitoring Component', () => {
it('should render a link to environment monitoring page', () => {
expect(wrapper.attributes('href')).toEqual(monitoringUrl);
expect(findIconsByName('chart').length).toBe(1);
expect(findButtonsByIcon('chart').length).toBe(1);
expect(wrapper.attributes('title')).toBe('Monitoring');
expect(wrapper.attributes('aria-label')).toBe('Monitoring');
});
......
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