Commit 99ce008c authored by Jose Ivan Vargas's avatar Jose Ivan Vargas

Merge branch '229205-stop-environment-button' into 'master'

Migrate external link and stop environment button templates

Closes #229205

See merge request gitlab-org/gitlab!38845
parents e5d666a7 8912867d
<script> <script>
import { GlTooltipDirective } from '@gitlab/ui'; import { GlTooltipDirective, GlButton } from '@gitlab/ui';
import Icon from '~/vue_shared/components/icon.vue';
import { s__ } from '~/locale'; import { s__ } from '~/locale';
/** /**
...@@ -8,7 +7,7 @@ import { s__ } from '~/locale'; ...@@ -8,7 +7,7 @@ import { s__ } from '~/locale';
*/ */
export default { export default {
components: { components: {
Icon, GlButton,
}, },
directives: { directives: {
GlTooltip: GlTooltipDirective, GlTooltip: GlTooltipDirective,
...@@ -27,15 +26,14 @@ export default { ...@@ -27,15 +26,14 @@ export default {
}; };
</script> </script>
<template> <template>
<a <gl-button
v-gl-tooltip v-gl-tooltip
:title="title" :title="title"
:aria-label="title" :aria-label="title"
:href="externalUrl" :href="externalUrl"
class="btn external-url" class="external-url"
target="_blank" target="_blank"
icon="external-link"
rel="noopener noreferrer nofollow" rel="noopener noreferrer nofollow"
> />
<icon name="external-link" />
</a>
</template> </template>
...@@ -5,16 +5,13 @@ ...@@ -5,16 +5,13 @@
*/ */
import $ from 'jquery'; import $ from 'jquery';
import { GlTooltipDirective } from '@gitlab/ui'; import { GlTooltipDirective, GlButton } from '@gitlab/ui';
import Icon from '~/vue_shared/components/icon.vue';
import { s__ } from '~/locale'; import { s__ } from '~/locale';
import eventHub from '../event_hub'; import eventHub from '../event_hub';
import LoadingButton from '../../vue_shared/components/loading_button.vue';
export default { export default {
components: { components: {
Icon, GlButton,
LoadingButton,
}, },
directives: { directives: {
GlTooltip: GlTooltipDirective, GlTooltip: GlTooltipDirective,
...@@ -55,16 +52,16 @@ export default { ...@@ -55,16 +52,16 @@ export default {
}; };
</script> </script>
<template> <template>
<loading-button <gl-button
v-gl-tooltip v-gl-tooltip
:loading="isLoading" :loading="isLoading"
:title="title" :title="title"
:aria-label="title" :aria-label="title"
container-class="btn btn-danger d-none d-sm-none d-md-block" icon="stop"
category="primary"
variant="danger"
data-toggle="modal" data-toggle="modal"
data-target="#stop-environment-modal" data-target="#stop-environment-modal"
@click="onClick" @click="onClick"
> />
<icon name="stop" />
</loading-button>
</template> </template>
...@@ -37,7 +37,7 @@ RSpec.describe 'Environments page', :js do ...@@ -37,7 +37,7 @@ RSpec.describe 'Environments page', :js do
expect(page).to have_css('.environments-container') expect(page).to have_css('.environments-container')
expect(page.all('.environment-name').length).to eq(1) expect(page.all('.environment-name').length).to eq(1)
expect(page.all('.ic-stop').length).to eq(1) expect(page.all('[data-testid="stop-icon"]').length).to eq(1)
end end
end end
......
import { shallowMount } from '@vue/test-utils'; import { mount } from '@vue/test-utils';
import ExternalUrlComp from '~/environments/components/environment_external_url.vue'; import ExternalUrlComp from '~/environments/components/environment_external_url.vue';
describe('External URL Component', () => { describe('External URL Component', () => {
...@@ -6,7 +6,7 @@ describe('External URL Component', () => { ...@@ -6,7 +6,7 @@ describe('External URL Component', () => {
const externalUrl = 'https://gitlab.com'; const externalUrl = 'https://gitlab.com';
beforeEach(() => { beforeEach(() => {
wrapper = shallowMount(ExternalUrlComp, { propsData: { externalUrl } }); wrapper = mount(ExternalUrlComp, { propsData: { externalUrl } });
}); });
it('should link to the provided externalUrl prop', () => { it('should link to the provided externalUrl prop', () => {
......
import $ from 'jquery'; import $ from 'jquery';
import { shallowMount } from '@vue/test-utils'; import { shallowMount } from '@vue/test-utils';
import StopComponent from '~/environments/components/environment_stop.vue'; import StopComponent from '~/environments/components/environment_stop.vue';
import LoadingButton from '~/vue_shared/components/loading_button.vue'; import { GlButton } from '@gitlab/ui';
import eventHub from '~/environments/event_hub'; import eventHub from '~/environments/event_hub';
$.fn.tooltip = () => {}; $.fn.tooltip = () => {};
...@@ -17,7 +17,7 @@ describe('Stop Component', () => { ...@@ -17,7 +17,7 @@ describe('Stop Component', () => {
}); });
}; };
const findButton = () => wrapper.find(LoadingButton); const findButton = () => wrapper.find(GlButton);
beforeEach(() => { beforeEach(() => {
jest.spyOn(window, 'confirm'); jest.spyOn(window, 'confirm');
......
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