Commit 766da6c5 authored by Enrique Alcántara's avatar Enrique Alcántara

Merge branch...

Merge branch '229281-migrate-bootstrap-button-to-gitlab-ui-glbutton-in-app-assets-javascripts-ide-components' into 'master'

Migrate button to GlButton in empty_state.vue

See merge request gitlab-org/gitlab!46105
parents 87e5db95 bdbd9b3d
<script> <script>
/* eslint-disable vue/no-v-html */ /* eslint-disable vue/no-v-html */
import { GlLoadingIcon } from '@gitlab/ui'; import { GlLoadingIcon, GlButton } from '@gitlab/ui';
export default { export default {
components: { components: {
GlLoadingIcon, GlLoadingIcon,
GlButton,
}, },
props: { props: {
isLoading: { isLoading: {
...@@ -41,24 +42,24 @@ export default { ...@@ -41,24 +42,24 @@ export default {
}; };
</script> </script>
<template> <template>
<div class="text-center p-3"> <div class="gl-text-center gl-p-5">
<div v-if="illustrationPath" class="svg-content svg-130"><img :src="illustrationPath" /></div> <div v-if="illustrationPath" class="svg-content svg-130"><img :src="illustrationPath" /></div>
<h4>{{ __('Web Terminal') }}</h4> <h4>{{ __('Web Terminal') }}</h4>
<gl-loading-icon v-if="isLoading" size="lg" class="gl-mt-3" /> <gl-loading-icon v-if="isLoading" size="lg" class="gl-mt-3" />
<template v-else> <template v-else>
<p>{{ __('Run tests against your code live using the Web Terminal') }}</p> <p>{{ __('Run tests against your code live using the Web Terminal') }}</p>
<p> <p>
<button <gl-button
:disabled="!isValid" :disabled="!isValid"
class="btn btn-info" category="primary"
type="button" variant="info"
data-qa-selector="start_web_terminal_button" data-qa-selector="start_web_terminal_button"
@click="onStart" @click="onStart"
> >
{{ __('Start Web Terminal') }} {{ __('Start Web Terminal') }}
</button> </gl-button>
</p> </p>
<div v-if="!isValid && message" class="bs-callout text-left" v-html="message"></div> <div v-if="!isValid && message" class="bs-callout gl-text-left" v-html="message"></div>
<p v-else> <p v-else>
<a <a
v-if="helpPath" v-if="helpPath"
......
import { shallowMount } from '@vue/test-utils'; import { shallowMount } from '@vue/test-utils';
import { GlLoadingIcon } from '@gitlab/ui'; import { GlLoadingIcon, GlButton } from '@gitlab/ui';
import { TEST_HOST } from 'spec/test_constants'; import { TEST_HOST } from 'spec/test_constants';
import TerminalEmptyState from '~/ide/components/terminal/empty_state.vue'; import TerminalEmptyState from '~/ide/components/terminal/empty_state.vue';
...@@ -36,7 +36,7 @@ describe('IDE TerminalEmptyState', () => { ...@@ -36,7 +36,7 @@ describe('IDE TerminalEmptyState', () => {
const img = wrapper.find('.svg-content img'); const img = wrapper.find('.svg-content img');
expect(img.exists()).toBe(true); expect(img.exists()).toBe(true);
expect(img.attributes('src')).toEqual(TEST_PATH); expect(img.attributes('src')).toBe(TEST_PATH);
}); });
it('when loading, shows loading icon', () => { it('when loading, shows loading icon', () => {
...@@ -71,24 +71,23 @@ describe('IDE TerminalEmptyState', () => { ...@@ -71,24 +71,23 @@ describe('IDE TerminalEmptyState', () => {
}, },
}); });
button = wrapper.find('button'); button = wrapper.find(GlButton);
}); });
it('shows button', () => { it('shows button', () => {
expect(button.text()).toEqual('Start Web Terminal'); expect(button.text()).toBe('Start Web Terminal');
expect(button.attributes('disabled')).toBeFalsy(); expect(button.props('disabled')).toBe(false);
}); });
it('emits start when button is clicked', () => { it('emits start when button is clicked', () => {
expect(wrapper.emitted().start).toBeFalsy(); expect(wrapper.emitted().start).toBeUndefined();
button.vm.$emit('click');
button.trigger('click');
expect(wrapper.emitted().start).toHaveLength(1); expect(wrapper.emitted().start).toHaveLength(1);
}); });
it('shows help path link', () => { it('shows help path link', () => {
expect(wrapper.find('a').attributes('href')).toEqual(TEST_HELP_PATH); expect(wrapper.find('a').attributes('href')).toBe(TEST_HELP_PATH);
}); });
}); });
...@@ -101,7 +100,7 @@ describe('IDE TerminalEmptyState', () => { ...@@ -101,7 +100,7 @@ describe('IDE TerminalEmptyState', () => {
}, },
}); });
expect(wrapper.find('button').attributes('disabled')).not.toBe(null); expect(wrapper.find(GlButton).props('disabled')).toBe(true);
expect(wrapper.find('.bs-callout').element.innerHTML).toEqual(TEST_HTML_MESSAGE); expect(wrapper.find('.bs-callout').element.innerHTML).toBe(TEST_HTML_MESSAGE);
}); });
}); });
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