2017-04-11 13:50:21 -04:00
|
|
|
import Vue from 'vue';
|
|
|
|
import CodeComponent from '~/notebook/cells/code.vue';
|
|
|
|
|
|
|
|
const Component = Vue.extend(CodeComponent);
|
|
|
|
|
|
|
|
describe('Code component', () => {
|
|
|
|
let vm;
|
2017-04-11 16:25:10 -04:00
|
|
|
let json;
|
|
|
|
|
|
|
|
beforeEach(() => {
|
|
|
|
json = getJSONFixture('blob/notebook/basic.json');
|
|
|
|
});
|
2017-04-11 13:50:21 -04:00
|
|
|
|
|
|
|
describe('without output', () => {
|
2018-10-17 03:13:26 -04:00
|
|
|
beforeEach(done => {
|
2017-04-11 13:50:21 -04:00
|
|
|
vm = new Component({
|
|
|
|
propsData: {
|
|
|
|
cell: json.cells[0],
|
|
|
|
},
|
|
|
|
});
|
|
|
|
vm.$mount();
|
|
|
|
|
|
|
|
setTimeout(() => {
|
|
|
|
done();
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
it('does not render output prompt', () => {
|
|
|
|
expect(vm.$el.querySelectorAll('.prompt').length).toBe(1);
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
describe('with output', () => {
|
2018-10-17 03:13:26 -04:00
|
|
|
beforeEach(done => {
|
2017-04-11 13:50:21 -04:00
|
|
|
vm = new Component({
|
|
|
|
propsData: {
|
|
|
|
cell: json.cells[2],
|
|
|
|
},
|
|
|
|
});
|
|
|
|
vm.$mount();
|
|
|
|
|
|
|
|
setTimeout(() => {
|
|
|
|
done();
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
it('does not render output prompt', () => {
|
|
|
|
expect(vm.$el.querySelectorAll('.prompt').length).toBe(2);
|
|
|
|
});
|
|
|
|
|
|
|
|
it('renders output cell', () => {
|
|
|
|
expect(vm.$el.querySelector('.output')).toBeDefined();
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|