2017-04-12 02:44:22 +00:00
|
|
|
import Vue from 'vue';
|
|
|
|
|
2019-04-25 12:22:00 +00:00
|
|
|
import { FIXTURES_PATH } from 'spec/test_constants';
|
2019-12-11 09:08:12 +00:00
|
|
|
import PDFLab from '~/pdf/index.vue';
|
2019-04-25 12:22:00 +00:00
|
|
|
|
|
|
|
const pdf = `${FIXTURES_PATH}/blob/pdf/test.pdf`;
|
2017-04-12 02:44:22 +00:00
|
|
|
|
|
|
|
const Component = Vue.extend(PDFLab);
|
|
|
|
|
|
|
|
describe('PDF component', () => {
|
|
|
|
let vm;
|
|
|
|
|
2018-10-17 07:13:26 +00:00
|
|
|
const checkLoaded = done => {
|
2017-04-12 02:44:22 +00:00
|
|
|
if (vm.loading) {
|
|
|
|
setTimeout(() => {
|
|
|
|
checkLoaded(done);
|
|
|
|
}, 100);
|
|
|
|
} else {
|
|
|
|
done();
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
describe('without PDF data', () => {
|
2018-10-17 07:13:26 +00:00
|
|
|
beforeEach(done => {
|
2017-04-12 02:44:22 +00:00
|
|
|
vm = new Component({
|
|
|
|
propsData: {
|
|
|
|
pdf: '',
|
|
|
|
},
|
|
|
|
});
|
|
|
|
|
|
|
|
vm.$mount();
|
|
|
|
|
|
|
|
checkLoaded(done);
|
|
|
|
});
|
|
|
|
|
|
|
|
it('does not render', () => {
|
|
|
|
expect(vm.$el.tagName).toBeUndefined();
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
describe('with PDF data', () => {
|
2018-10-17 07:13:26 +00:00
|
|
|
beforeEach(done => {
|
2017-04-12 02:44:22 +00:00
|
|
|
vm = new Component({
|
|
|
|
propsData: {
|
|
|
|
pdf,
|
|
|
|
},
|
|
|
|
});
|
|
|
|
|
|
|
|
vm.$mount();
|
|
|
|
|
|
|
|
checkLoaded(done);
|
|
|
|
});
|
|
|
|
|
|
|
|
it('renders pdf component', () => {
|
|
|
|
expect(vm.$el.tagName).toBeDefined();
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|