Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor src/core/pdf_manager.js: rename pdfModel to pdfDocument #4481

Merged
merged 2 commits into from
Mar 19, 2014
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion src/core/worker.js
Original file line number Diff line number Diff line change
Expand Up @@ -294,7 +294,8 @@ var WorkerMessageHandler = PDFJS.WorkerMessageHandler = {

handler.on('GetPageIndex', function wphSetupGetPageIndex(data, deferred) {
var ref = new Ref(data.ref.num, data.ref.gen);
pdfManager.pdfModel.catalog.getPageIndex(ref).then(function (pageIndex) {
var catalog = pdfManager.pdfDocument.catalog;
catalog.getPageIndex(ref).then(function (pageIndex) {
deferred.resolve(pageIndex);
}, deferred.reject);
});
Expand Down
8 changes: 8 additions & 0 deletions test/unit/api_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,14 @@ describe('api', function() {
expect(true).toEqual(true);
});
});
it('gets page index', function() {
// reference to second page
var ref = {num: 17, gen: 0};
var promise = doc.getPageIndex(ref);
waitsForPromise(promise, function(pageIndex) {
expect(pageIndex).toEqual(1);
});
});
it('gets destinations', function() {
var promise = doc.getDestinations();
waitsForPromise(promise, function(data) {
Expand Down