2017-08-17 22:00:37 +05:30
|
|
|
import Vue from 'vue';
|
|
|
|
import terminalComp from '~/environments/components/environment_terminal_button.vue';
|
|
|
|
|
|
|
|
describe('Stop Component', () => {
|
|
|
|
let component;
|
|
|
|
const terminalPath = '/path';
|
|
|
|
|
2019-02-15 15:39:39 +05:30
|
|
|
const mountWithProps = props => {
|
|
|
|
const TerminalComponent = Vue.extend(terminalComp);
|
2017-08-17 22:00:37 +05:30
|
|
|
component = new TerminalComponent({
|
2019-02-15 15:39:39 +05:30
|
|
|
propsData: props,
|
2017-08-17 22:00:37 +05:30
|
|
|
}).$mount();
|
2019-02-15 15:39:39 +05:30
|
|
|
};
|
|
|
|
|
2019-09-30 21:07:59 +05:30
|
|
|
beforeEach(() => {
|
|
|
|
mountWithProps({ terminalPath });
|
|
|
|
});
|
2019-02-15 15:39:39 +05:30
|
|
|
|
2019-09-30 21:07:59 +05:30
|
|
|
describe('computed', () => {
|
|
|
|
it('title', () => {
|
|
|
|
expect(component.title).toEqual('Terminal');
|
2017-09-10 17:25:29 +05:30
|
|
|
});
|
|
|
|
});
|
|
|
|
|
2019-09-30 21:07:59 +05:30
|
|
|
it('should render a link to open a web terminal with the provided path', () => {
|
|
|
|
expect(component.$el.tagName).toEqual('A');
|
|
|
|
expect(component.$el.getAttribute('data-original-title')).toEqual('Terminal');
|
|
|
|
expect(component.$el.getAttribute('aria-label')).toEqual('Terminal');
|
|
|
|
expect(component.$el.getAttribute('href')).toEqual(terminalPath);
|
|
|
|
});
|
2019-02-15 15:39:39 +05:30
|
|
|
|
2019-09-30 21:07:59 +05:30
|
|
|
it('should render a non-disabled button', () => {
|
|
|
|
expect(component.$el.classList).not.toContain('disabled');
|
2017-08-17 22:00:37 +05:30
|
|
|
});
|
|
|
|
});
|