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
1e2e0af6
Commit
1e2e0af6
authored
Aug 23, 2018
by
Winnie Hellmann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove waiting from PDF page component test
parent
a78c443d
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
27 additions
and
35 deletions
+27
-35
spec/javascripts/pdf/page_spec.js
spec/javascripts/pdf/page_spec.js
+27
-35
No files found.
spec/javascripts/pdf/page_spec.js
View file @
1e2e0af6
...
...
@@ -3,53 +3,45 @@ import pdfjsLib from 'vendor/pdf';
import
workerSrc
from
'
vendor/pdf.worker.min
'
;
import
PageComponent
from
'
~/pdf/page/index.vue
'
;
import
testPDF
from
'
../fixtures/blob/pdf/test.pdf
'
;
const
Component
=
Vue
.
extend
(
PageComponent
);
import
mountComponent
from
'
spec/helpers/vue_mount_component_helper
'
;
import
testPDF
from
'
spec/fixtures/blob/pdf/test.pdf
'
;
describe
(
'
Page component
'
,
()
=>
{
const
Component
=
Vue
.
extend
(
PageComponent
);
let
vm
;
let
testPage
;
pdfjsLib
.
PDFJS
.
workerSrc
=
workerSrc
;
const
checkRendered
=
(
done
)
=>
{
if
(
vm
.
rendering
)
{
setTimeout
(()
=>
{
checkRendered
(
done
);
},
100
);
}
else
{
done
();
}
};
beforeEach
((
done
)
=>
{
pdfjsLib
.
getDocument
(
testPDF
)
beforeEach
(
done
=>
{
pdfjsLib
.
PDFJS
.
workerSrc
=
workerSrc
;
pdfjsLib
.
getDocument
(
testPDF
)
.
then
(
pdf
=>
pdf
.
getPage
(
1
))
.
then
(
(
page
)
=>
{
.
then
(
page
=>
{
testPage
=
page
;
done
();
})
.
catch
((
error
)
=>
{
done
.
fail
(
error
);
});
.
then
(
done
)
.
catch
(
done
.
fail
);
});
describe
(
'
render
'
,
()
=>
{
beforeEach
((
done
)
=>
{
vm
=
new
Component
({
propsData
:
{
page
:
testPage
,
number
:
1
,
},
});
vm
.
$mount
();
afterEach
(()
=>
{
vm
.
$destroy
();
});
checkRendered
(
done
);
it
(
'
renders the page when mounting
'
,
done
=>
{
const
promise
=
Promise
.
resolve
();
spyOn
(
testPage
,
'
render
'
).
and
.
callFake
(()
=>
promise
);
vm
=
mountComponent
(
Component
,
{
page
:
testPage
,
number
:
1
,
});
expect
(
vm
.
rendering
).
toBe
(
true
);
it
(
'
renders first page
'
,
()
=>
{
expect
(
vm
.
$el
.
tagName
).
toBeDefined
();
});
promise
.
then
(()
=>
{
expect
(
testPage
.
render
).
toHaveBeenCalledWith
(
vm
.
renderContext
);
expect
(
vm
.
rendering
).
toBe
(
false
);
})
.
then
(
done
)
.
catch
(
done
.
fail
);
});
});
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