2017-03-14 00:58:26 +00:00
|
|
|
import Vue from 'vue';
|
2017-04-20 09:04:06 +00:00
|
|
|
import terminalComp from '~/environments/components/environment_terminal_button.vue';
|
2017-03-14 00:58:26 +00:00
|
|
|
|
|
|
|
describe('Stop Component', () => {
|
|
|
|
let component;
|
|
|
|
const terminalPath = '/path';
|
|
|
|
|
2018-12-20 09:39:09 +00:00
|
|
|
const mountWithProps = props => {
|
|
|
|
const TerminalComponent = Vue.extend(terminalComp);
|
2017-03-14 00:58:26 +00:00
|
|
|
component = new TerminalComponent({
|
2018-12-20 09:39:09 +00:00
|
|
|
propsData: props,
|
2017-03-14 00:58:26 +00:00
|
|
|
}).$mount();
|
2018-12-20 09:39:09 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
describe('enabled', () => {
|
|
|
|
beforeEach(() => {
|
|
|
|
mountWithProps({ terminalPath });
|
|
|
|
});
|
|
|
|
|
|
|
|
describe('computed', () => {
|
|
|
|
it('title', () => {
|
|
|
|
expect(component.title).toEqual('Terminal');
|
|
|
|
});
|
|
|
|
});
|
2017-03-14 00:58:26 +00:00
|
|
|
|
2018-12-20 09:39:09 +00:00
|
|
|
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);
|
|
|
|
});
|
|
|
|
|
|
|
|
it('should render a non-disabled button', () => {
|
|
|
|
expect(component.$el.classList).not.toContain('disabled');
|
2017-06-06 20:46:31 +00:00
|
|
|
});
|
|
|
|
});
|
|
|
|
|
2018-12-20 09:39:09 +00:00
|
|
|
describe('disabled', () => {
|
|
|
|
beforeEach(() => {
|
|
|
|
mountWithProps({ terminalPath, disabled: true });
|
|
|
|
});
|
|
|
|
|
|
|
|
it('should render a disabled button', () => {
|
|
|
|
expect(component.$el.classList).toContain('disabled');
|
|
|
|
});
|
2017-03-14 00:58:26 +00:00
|
|
|
});
|
|
|
|
});
|