CB-12286 Tests reworked

This commit is contained in:
Alexander Sorokin 2016-12-21 14:46:01 +03:00
parent 7fdc334a2f
commit cd2ee4666d

View File

@ -22,22 +22,29 @@
/* jshint jasmine: true */ /* jshint jasmine: true */
exports.defineAutoTests = function() { exports.defineAutoTests = function() {
describe('Orientation Information (window.orientation)', function () { describe('Orientation Information (window.screen.orientation)', function () {
it("should exist", function() { it('should exist', function() {
expect(window.orientation).toBeDefined(); if (window.screen) {
}); expect(window.screen.orientation).toBeDefined();
} else {
it("should contain a platform specification that is a string", function() { fail('No screen object is present');
expect(window.orientation).toBeDefined();
if (window.orientation) {
expect((String(window.orientation.type)).length > 0).toBe(true);
} }
}); });
it("should successfully lock and unlock screen orientation", function (done) { it('should contain a platform specification that is a string', function() {
if (window.screen && window.screen.orientation) {
expect((String(window.screen.orientation.type)).length > 0).toBe(true);
} else {
fail('No orientation object is present');
}
});
});
describe('Screen functions', function () {
it('should successfully lock and unlock screen orientation', function (done) {
try { try {
screen.lockOrientation('landscape').then(function () { window.screen.lockOrientation('landscape').then(function () {
expect(screen.unlockOrientation).not.toThrow(); expect(window.screen.unlockOrientation).not.toThrow();
done(); done();
}, function (err) { }, function (err) {
fail('Promise was rejected: ' + err); fail('Promise was rejected: ' + err);