debian-mirror-gitlab/spec/frontend/environments/environment_terminal_button_spec.js

35 lines
971 B
JavaScript
Raw Normal View History

2020-01-01 13:55:28 +05:30
import { shallowMount } from '@vue/test-utils';
import TerminalComponent from '~/environments/components/environment_terminal_button.vue';
describe('Stop Component', () => {
let wrapper;
const terminalPath = '/path';
2021-03-08 18:12:59 +05:30
const mountWithProps = (props) => {
2020-01-01 13:55:28 +05:30
wrapper = shallowMount(TerminalComponent, {
propsData: props,
});
};
beforeEach(() => {
mountWithProps({ terminalPath });
});
describe('computed', () => {
it('title', () => {
expect(wrapper.vm.title).toEqual('Terminal');
});
});
it('should render a link to open a web terminal with the provided path', () => {
2020-11-24 15:15:51 +05:30
expect(wrapper.element.tagName).toBe('A');
2020-03-13 15:44:24 +05:30
expect(wrapper.attributes('title')).toBe('Terminal');
2020-01-01 13:55:28 +05:30
expect(wrapper.attributes('aria-label')).toBe('Terminal');
expect(wrapper.attributes('href')).toBe(terminalPath);
});
it('should render a non-disabled button', () => {
expect(wrapper.classes()).not.toContain('disabled');
});
});