You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by st...@apache.org on 2016/07/27 01:04:24 UTC
[05/12] ios commit: CB-9371: Fix how prepare handles orientation on
ios
CB-9371: Fix how prepare handles orientation on ios
Update unit tests. This closes #233
Signed-off-by: Shazron Abdullah <sh...@gmail.com>
Project: http://git-wip-us.apache.org/repos/asf/cordova-ios/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-ios/commit/c17ed6fd
Tree: http://git-wip-us.apache.org/repos/asf/cordova-ios/tree/c17ed6fd
Diff: http://git-wip-us.apache.org/repos/asf/cordova-ios/diff/c17ed6fd
Branch: refs/heads/4.2.x
Commit: c17ed6fdc39c61d83985433221e822592f8fbf69
Parents: d536d8c
Author: Connor Pearson <cj...@gmail.com>
Authored: Thu Jun 30 20:27:12 2016 -0400
Committer: Steve Gill <st...@gmail.com>
Committed: Tue Jul 26 16:24:51 2016 -0700
----------------------------------------------------------------------
.../project/__PROJECT_NAME__/__PROJECT_NAME__-Info.plist | 2 ++
bin/templates/scripts/cordova/lib/prepare.js | 8 ++++----
tests/spec/unit/prepare.spec.js | 7 ++++---
3 files changed, 10 insertions(+), 7 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/c17ed6fd/bin/templates/project/__PROJECT_NAME__/__PROJECT_NAME__-Info.plist
----------------------------------------------------------------------
diff --git a/bin/templates/project/__PROJECT_NAME__/__PROJECT_NAME__-Info.plist b/bin/templates/project/__PROJECT_NAME__/__PROJECT_NAME__-Info.plist
index 2b5e1fe..30bada6 100644
--- a/bin/templates/project/__PROJECT_NAME__/__PROJECT_NAME__-Info.plist
+++ b/bin/templates/project/__PROJECT_NAME__/__PROJECT_NAME__-Info.plist
@@ -35,6 +35,8 @@
<key>UISupportedInterfaceOrientations</key>
<array>
<string>UIInterfaceOrientationPortrait</string>
+ <string>UIInterfaceOrientationLandscapeLeft</string>
+ <string>UIInterfaceOrientationLandscapeRight</string>
</array>
<key>UISupportedInterfaceOrientations~ipad</key>
<array>
http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/c17ed6fd/bin/templates/scripts/cordova/lib/prepare.js
----------------------------------------------------------------------
diff --git a/bin/templates/scripts/cordova/lib/prepare.js b/bin/templates/scripts/cordova/lib/prepare.js
index 8bc4d60..f3d6b79 100644
--- a/bin/templates/scripts/cordova/lib/prepare.js
+++ b/bin/templates/scripts/cordova/lib/prepare.js
@@ -267,9 +267,9 @@ function handleOrientationSettings(platformConfig, infoPlist) {
infoPlist['UISupportedInterfaceOrientations'] = [ 'UIInterfaceOrientationPortrait', 'UIInterfaceOrientationPortraitUpsideDown', 'UIInterfaceOrientationLandscapeLeft', 'UIInterfaceOrientationLandscapeRight' ];
infoPlist['UISupportedInterfaceOrientations~ipad'] = [ 'UIInterfaceOrientationPortrait', 'UIInterfaceOrientationPortraitUpsideDown', 'UIInterfaceOrientationLandscapeLeft', 'UIInterfaceOrientationLandscapeRight' ];
break;
- default:
- delete infoPlist['UISupportedInterfaceOrientations'];
- delete infoPlist['UISupportedInterfaceOrientations~ipad'];
+ case 'default':
+ infoPlist['UISupportedInterfaceOrientations'] = [ 'UIInterfaceOrientationPortrait', 'UIInterfaceOrientationLandscapeLeft', 'UIInterfaceOrientationLandscapeRight' ];
+ infoPlist['UISupportedInterfaceOrientations~ipad'] = [ 'UIInterfaceOrientationPortrait', 'UIInterfaceOrientationPortraitUpsideDown', 'UIInterfaceOrientationLandscapeLeft', 'UIInterfaceOrientationLandscapeRight' ];
delete infoPlist['UIInterfaceOrientation'];
}
}
@@ -471,7 +471,7 @@ function getOrientationValue(platformConfig) {
var orientation = platformConfig.getPreference('orientation');
if (!orientation) {
- return ORIENTATION_DEFAULT;
+ return '';
}
orientation = orientation.toLowerCase();
http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/c17ed6fd/tests/spec/unit/prepare.spec.js
----------------------------------------------------------------------
diff --git a/tests/spec/unit/prepare.spec.js b/tests/spec/unit/prepare.spec.js
index 8776b15..ec2a976 100644
--- a/tests/spec/unit/prepare.spec.js
+++ b/tests/spec/unit/prepare.spec.js
@@ -150,8 +150,8 @@ describe('prepare', function () {
it('should handle default orientation', function(done) {
cfg.getPreference.andReturn('default');
wrapper(updateProject(cfg, p.locations), done, function() {
- expect(plist.build.mostRecentCall.args[0].UISupportedInterfaceOrientations).toBeUndefined();
- expect(plist.build.mostRecentCall.args[0]['UISupportedInterfaceOrientations~ipad']).toBeUndefined();
+ expect(plist.build.mostRecentCall.args[0].UISupportedInterfaceOrientations).toEqual([ 'UIInterfaceOrientationPortrait', 'UIInterfaceOrientationLandscapeLeft', 'UIInterfaceOrientationLandscapeRight' ]);
+ expect(plist.build.mostRecentCall.args[0]['UISupportedInterfaceOrientations~ipad']).toEqual([ 'UIInterfaceOrientationPortrait', 'UIInterfaceOrientationPortraitUpsideDown', 'UIInterfaceOrientationLandscapeLeft', 'UIInterfaceOrientationLandscapeRight' ]);
expect(plist.build.mostRecentCall.args[0].UIInterfaceOrientation).toBeUndefined();
});
});
@@ -179,7 +179,8 @@ describe('prepare', function () {
it('should handle custom orientation', function(done) {
cfg.getPreference.andReturn('some-custom-orientation');
wrapper(updateProject(cfg, p.locations), done, function() {
- expect(plist.build.mostRecentCall.args[0].UISupportedInterfaceOrientations).toBeUndefined();
+ expect(plist.build.mostRecentCall.args[0].UISupportedInterfaceOrientations).toEqual([ 'UIInterfaceOrientationPortrait', 'UIInterfaceOrientationLandscapeLeft', 'UIInterfaceOrientationLandscapeRight' ]);
+ expect(plist.build.mostRecentCall.args[0]['UISupportedInterfaceOrientations~ipad']).toEqual([ 'UIInterfaceOrientationPortrait', 'UIInterfaceOrientationPortraitUpsideDown', 'UIInterfaceOrientationLandscapeLeft', 'UIInterfaceOrientationLandscapeRight' ]);
expect(plist.build.mostRecentCall.args[0].UIInterfaceOrientation).toBeUndefined();
});
});
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org
For additional commands, e-mail: commits-help@cordova.apache.org