summaryrefslogtreecommitdiff
path: root/spec/javascripts/blob
diff options
context:
space:
mode:
authorJacob Schatz <jschatz@gitlab.com>2017-04-06 11:18:28 +0000
committerJacob Schatz <jschatz@gitlab.com>2017-04-06 11:18:28 +0000
commita1db7c5b9fec34c9d4f5b262eeb836387b926e80 (patch)
treedd1aedd8af763407ddc32b5e1be7bde177fcd316 /spec/javascripts/blob
parentaba1c226dfb5f4b84b31573ea41f4329ac82e70c (diff)
parent5e67b2fdb0d4d308b82a22290c1ac46d41d09469 (diff)
downloadgitlab-ce-a1db7c5b9fec34c9d4f5b262eeb836387b926e80.tar.gz
Merge branch 'pdf-js-spec-loading-wait' into 'master'
Wait for the PDF to be loaded before doing anything Closes #30531 See merge request !10493
Diffstat (limited to 'spec/javascripts/blob')
-rw-r--r--spec/javascripts/blob/pdf/index_spec.js24
1 files changed, 16 insertions, 8 deletions
diff --git a/spec/javascripts/blob/pdf/index_spec.js b/spec/javascripts/blob/pdf/index_spec.js
index 19a4e55a9db..d3a4d04345b 100644
--- a/spec/javascripts/blob/pdf/index_spec.js
+++ b/spec/javascripts/blob/pdf/index_spec.js
@@ -3,6 +3,18 @@ import testPDF from './test.pdf';
describe('PDF renderer', () => {
let viewer;
+ let app;
+
+ const checkLoaded = (done) => {
+ if (app.loading) {
+ setTimeout(() => {
+ checkLoaded(done);
+ }, 100);
+ } else {
+ done();
+ }
+ };
+
preloadFixtures('static/pdf_viewer.html.raw');
beforeEach(() => {
@@ -21,11 +33,9 @@ describe('PDF renderer', () => {
describe('successful response', () => {
beforeEach((done) => {
- renderPDF();
+ app = renderPDF();
- setTimeout(() => {
- done();
- }, 500);
+ checkLoaded(done);
});
it('does not show loading icon', () => {
@@ -50,11 +60,9 @@ describe('PDF renderer', () => {
describe('error getting file', () => {
beforeEach((done) => {
viewer.dataset.endpoint = 'invalid/endpoint';
- renderPDF();
+ app = renderPDF();
- setTimeout(() => {
- done();
- }, 500);
+ checkLoaded(done);
});
it('does not show loading icon', () => {