mirror of
https://github.com/apache/cordova-plugin-screen-orientation.git
synced 2025-05-05 01:32:59 +08:00
CB-12271 (windows) Fixed "platform add" error, added new tests
This commit is contained in:
parent
c704de462d
commit
77d471833e
@ -20,11 +20,11 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
var DisplayInfo = Windows.Graphics.Display.DisplayInformation;
|
var DisplayInfo = Windows.Graphics.Display.DisplayInformation;
|
||||||
var Orientations = Windows.Graphics.Display.DisplayOrientations;
|
var Orientations = Windows.Graphics.Display.DisplayOrientations;
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
setAllowedOrientations: function (win, fail, args) {
|
screenOrientation: function (win, fail, args) {
|
||||||
//console.log("setAllowedOrientations proxy called with " + args);
|
//console.log("screenOrientation proxy called with " + args);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
var prefOrients = args[0];
|
var prefOrients = args[0];
|
@ -29,8 +29,24 @@ exports.defineAutoTests = function() {
|
|||||||
|
|
||||||
it("should contain a platform specification that is a string", function() {
|
it("should contain a platform specification that is a string", function() {
|
||||||
expect(window.orientation).toBeDefined();
|
expect(window.orientation).toBeDefined();
|
||||||
expect((String(window.orientation.type)).length > 0).toBe(true);
|
if (window.orientation) {
|
||||||
|
expect((String(window.orientation.type)).length > 0).toBe(true);
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it("should successfully lock and unlock screen orientation", function (done) {
|
||||||
|
try {
|
||||||
|
screen.lockOrientation('landscape').then(function () {
|
||||||
|
expect(screen.unlockOrientation).not.toThrow();
|
||||||
|
done();
|
||||||
|
}, function (err) {
|
||||||
|
fail('Promise was rejected: ' + err);
|
||||||
|
done();
|
||||||
|
});
|
||||||
|
} catch (e) {
|
||||||
|
fail(e);
|
||||||
|
done();
|
||||||
|
}
|
||||||
|
});
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
Loading…
x
Reference in New Issue
Block a user