1
0
Fork 0
mirror of https://github.com/mozilla/pdf.js.git synced 2025-04-21 15:48:06 +02:00

Move the isPortraitOrientation helper function from web/base_viewer.js to web/ui_utils.js

A couple of basic unit-tests are added, and a manual `isLandscape` check (in `web/base_viewer.js`) is also converted to use the helper function instead.
This commit is contained in:
Jonas Jenwald 2018-03-20 13:25:13 +01:00
parent 5c1a16ba6e
commit 77d025dc14
3 changed files with 33 additions and 11 deletions

View file

@ -15,7 +15,7 @@
import {
binarySearchFirstItem, EventBus, getPageSizeInches, getPDFFileNameFromURL,
isValidRotation, waitOnEventOrTimeout, WaitOnType
isPortraitOrientation, isValidRotation, waitOnEventOrTimeout, WaitOnType
} from '../../web/ui_utils';
import { createObjectURL } from '../../src/shared/util';
import isNodeJS from '../../src/shared/is_node';
@ -285,6 +285,27 @@ describe('ui_utils', function() {
});
});
describe('isPortraitOrientation', function() {
it('should be portrait orientation', function() {
expect(isPortraitOrientation({
width: 200,
height: 400,
})).toEqual(true);
expect(isPortraitOrientation({
width: 500,
height: 500,
})).toEqual(true);
});
it('should be landscape orientation', function() {
expect(isPortraitOrientation({
width: 600,
height: 300,
})).toEqual(false);
});
});
describe('waitOnEventOrTimeout', function() {
let eventBus;