You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by da...@apache.org on 2016/01/28 13:05:48 UTC

cordova-windows git commit: CB-10440 Add CSS color names support for BackgroundColor on Windows

Repository: cordova-windows
Updated Branches:
  refs/heads/master 0977140a2 -> 35f48b4ea


CB-10440 Add CSS color names support for BackgroundColor on Windows


Project: http://git-wip-us.apache.org/repos/asf/cordova-windows/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-windows/commit/35f48b4e
Tree: http://git-wip-us.apache.org/repos/asf/cordova-windows/tree/35f48b4e
Diff: http://git-wip-us.apache.org/repos/asf/cordova-windows/diff/35f48b4e

Branch: refs/heads/master
Commit: 35f48b4ea005b92a8b956f313a66ca3beabc82a9
Parents: 0977140
Author: daserge <v-...@microsoft.com>
Authored: Tue Jan 26 11:32:16 2016 +0300
Committer: daserge <v-...@microsoft.com>
Committed: Thu Jan 28 14:57:22 2016 +0300

----------------------------------------------------------------------
 spec/unit/AppxManifest.spec.js       | 8 ++++++++
 template/cordova/lib/AppxManifest.js | 8 ++++++++
 2 files changed, 16 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-windows/blob/35f48b4e/spec/unit/AppxManifest.spec.js
----------------------------------------------------------------------
diff --git a/spec/unit/AppxManifest.spec.js b/spec/unit/AppxManifest.spec.js
index c79d9f2..48fb514 100644
--- a/spec/unit/AppxManifest.spec.js
+++ b/spec/unit/AppxManifest.spec.js
@@ -22,9 +22,11 @@ var et = require('elementtree');
 var xml = require('cordova-common').xmlHelpers;
 var AppxManifest = rewire('../../template/cordova/lib/AppxManifest');
 var Win10AppxManifest = AppxManifest.__get__('Win10AppxManifest');
+var refineColor = AppxManifest.__get__('refineColor');
 
 var WINDOWS_MANIFEST = 'template/package.windows.appxmanifest';
 var WINDOWS_PHONE_MANIFEST = 'template/package.phone.appxmanifest';
+var CSS_COLOR_NAME = 'turquoise';
 
 describe('AppxManifest', function () {
 
@@ -130,5 +132,11 @@ describe('AppxManifest', function () {
             });
         });
     });
+
+    describe('getVisualElements methods', function () {
+        it('refineColor should leave CSS color name as is', function () {
+            expect(refineColor(CSS_COLOR_NAME)).toEqual(CSS_COLOR_NAME);
+        });
+    });
 });
 

http://git-wip-us.apache.org/repos/asf/cordova-windows/blob/35f48b4e/template/cordova/lib/AppxManifest.js
----------------------------------------------------------------------
diff --git a/template/cordova/lib/AppxManifest.js b/template/cordova/lib/AppxManifest.js
index 3dc618d..8c934e6 100644
--- a/template/cordova/lib/AppxManifest.js
+++ b/template/cordova/lib/AppxManifest.js
@@ -382,7 +382,15 @@ AppxManifest.prototype.getCapabilities = function () {
     });
 };
 
+function isCSSColorName(color) {
+    return color.indexOf('0x') === -1 && color.indexOf('#') === -1;
+}
+
 function refineColor(color) {
+    if (isCSSColorName(color)) {
+        return color;
+    }
+
     // return three-byte hexadecimal number preceded by "#" (required for Windows)
     color = color.replace('0x', '').replace('#', '');
     if (color.length == 3) {


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org
For additional commands, e-mail: commits-help@cordova.apache.org