Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Boxiang Sun
gitlab-ce
Commits
5e67b2fd
Commit
5e67b2fd
authored
Apr 06, 2017
by
Phil Hughes
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Wait for the PDF to be loaded before doing anything
Closes #30531
parent
49bdd8d6
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
17 additions
and
9 deletions
+17
-9
app/assets/javascripts/blob/pdf/index.js
app/assets/javascripts/blob/pdf/index.js
+1
-1
spec/javascripts/blob/pdf/index_spec.js
spec/javascripts/blob/pdf/index_spec.js
+16
-8
No files found.
app/assets/javascripts/blob/pdf/index.js
View file @
5e67b2fd
...
@@ -10,7 +10,7 @@ Vue.use(PDFLab, {
...
@@ -10,7 +10,7 @@ Vue.use(PDFLab, {
export
default
()
=>
{
export
default
()
=>
{
const
el
=
document
.
getElementById
(
'
js-pdf-viewer
'
);
const
el
=
document
.
getElementById
(
'
js-pdf-viewer
'
);
new
Vue
({
return
new
Vue
({
el
,
el
,
data
()
{
data
()
{
return
{
return
{
...
...
spec/javascripts/blob/pdf/index_spec.js
View file @
5e67b2fd
...
@@ -3,6 +3,18 @@ import testPDF from './test.pdf';
...
@@ -3,6 +3,18 @@ import testPDF from './test.pdf';
describe
(
'
PDF renderer
'
,
()
=>
{
describe
(
'
PDF renderer
'
,
()
=>
{
let
viewer
;
let
viewer
;
let
app
;
const
checkLoaded
=
(
done
)
=>
{
if
(
app
.
loading
)
{
setTimeout
(()
=>
{
checkLoaded
(
done
);
},
100
);
}
else
{
done
();
}
};
preloadFixtures
(
'
static/pdf_viewer.html.raw
'
);
preloadFixtures
(
'
static/pdf_viewer.html.raw
'
);
beforeEach
(()
=>
{
beforeEach
(()
=>
{
...
@@ -21,11 +33,9 @@ describe('PDF renderer', () => {
...
@@ -21,11 +33,9 @@ describe('PDF renderer', () => {
describe
(
'
successful response
'
,
()
=>
{
describe
(
'
successful response
'
,
()
=>
{
beforeEach
((
done
)
=>
{
beforeEach
((
done
)
=>
{
renderPDF
();
app
=
renderPDF
();
setTimeout
(()
=>
{
checkLoaded
(
done
);
done
();
},
500
);
});
});
it
(
'
does not show loading icon
'
,
()
=>
{
it
(
'
does not show loading icon
'
,
()
=>
{
...
@@ -50,11 +60,9 @@ describe('PDF renderer', () => {
...
@@ -50,11 +60,9 @@ describe('PDF renderer', () => {
describe
(
'
error getting file
'
,
()
=>
{
describe
(
'
error getting file
'
,
()
=>
{
beforeEach
((
done
)
=>
{
beforeEach
((
done
)
=>
{
viewer
.
dataset
.
endpoint
=
'
invalid/endpoint
'
;
viewer
.
dataset
.
endpoint
=
'
invalid/endpoint
'
;
renderPDF
();
app
=
renderPDF
();
setTimeout
(()
=>
{
checkLoaded
(
done
);
done
();
},
500
);
});
});
it
(
'
does not show loading icon
'
,
()
=>
{
it
(
'
does not show loading icon
'
,
()
=>
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment