mirror of
https://github.com/apache/cordova-plugin-screen-orientation.git
synced 2025-02-24 00:52:50 +08:00
CB-12286 Tests reworked
This commit is contained in:
parent
7fdc334a2f
commit
cd2ee4666d
@ -22,31 +22,38 @@
|
|||||||
/* 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 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);
|
||||||
it("should successfully lock and unlock screen orientation", function (done) {
|
} else {
|
||||||
try {
|
fail('No orientation object is present');
|
||||||
screen.lockOrientation('landscape').then(function () {
|
}
|
||||||
expect(screen.unlockOrientation).not.toThrow();
|
});
|
||||||
done();
|
});
|
||||||
}, function (err) {
|
|
||||||
fail('Promise was rejected: ' + err);
|
describe('Screen functions', function () {
|
||||||
done();
|
it('should successfully lock and unlock screen orientation', function (done) {
|
||||||
|
try {
|
||||||
|
window.screen.lockOrientation('landscape').then(function () {
|
||||||
|
expect(window.screen.unlockOrientation).not.toThrow();
|
||||||
|
done();
|
||||||
|
}, function (err) {
|
||||||
|
fail('Promise was rejected: ' + err);
|
||||||
|
done();
|
||||||
|
});
|
||||||
|
} catch (e) {
|
||||||
|
fail(e);
|
||||||
|
done();
|
||||||
|
}
|
||||||
});
|
});
|
||||||
} catch (e) {
|
|
||||||
fail(e);
|
|
||||||
done();
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
});
|
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user