mirror of
https://github.com/apache/cordova-plugin-screen-orientation.git
synced 2025-02-23 08:32:51 +08:00
CB-12286 Tests reworked
This commit is contained in:
parent
7fdc334a2f
commit
cd2ee4666d
@ -22,31 +22,38 @@
|
||||
/* jshint jasmine: true */
|
||||
|
||||
exports.defineAutoTests = function() {
|
||||
describe('Orientation Information (window.orientation)', function () {
|
||||
it("should exist", function() {
|
||||
expect(window.orientation).toBeDefined();
|
||||
});
|
||||
|
||||
it("should contain a platform specification that is a string", function() {
|
||||
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) {
|
||||
try {
|
||||
screen.lockOrientation('landscape').then(function () {
|
||||
expect(screen.unlockOrientation).not.toThrow();
|
||||
done();
|
||||
}, function (err) {
|
||||
fail('Promise was rejected: ' + err);
|
||||
done();
|
||||
describe('Orientation Information (window.screen.orientation)', function () {
|
||||
it('should exist', function() {
|
||||
if (window.screen) {
|
||||
expect(window.screen.orientation).toBeDefined();
|
||||
} else {
|
||||
fail('No screen object is present');
|
||||
}
|
||||
});
|
||||
|
||||
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 {
|
||||
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