CB-11836 Allow setting of 'ForegroundText' property via config.xml #195
Conversation
Current coverage is 74.34% (diff: 100%)@@ master #195 diff @@
==========================================
Files 14 14
Lines 1942 1949 +7
Methods 362 366 +4
Messages 0 0
Branches 391 392 +1
==========================================
+ Hits 1442 1449 +7
Misses 500 500
Partials 0 0
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, thanks for your contribution!
I've documented this in apache/cordova-docs#638
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK, actually there are some points which need to be updated:
- Windows 10 does not support
ForegroundText
(so we'll get a build failure if manifest contains ForegroundText), - It is better to avoid
color
argument reassignment, - It would be nice to cover the feature with some tests.
@tsschaffert, please let me know if you plan to address the comments. |
@daserge I will look into it |
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the update!
I've left some comments.
@@ -390,11 +390,6 @@ AppxManifest.prototype.getVisualElements = function () { | |||
}, | |||
setForegroundText: function (color) { | |||
if (color) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Instead of if (color) { visualElements.attrib.ForegroundText = color; }
would it be better to use visualElements.attrib.ForegroundText = color || 'light'
so that ForegroundText would be reset as default light
if we set dark
via preference for example and then remove the preference from config.xml entirely?
// Set to 'dark' | ||
visualElementsWindows.setForegroundText(foregroundTextDark); | ||
expect(visualElementsWindows.getForegroundText()).toEqual(foregroundTextDark); | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It also would be good to add a case for missing preference:
// Simulate the absence of preference, should default to 'light'
visualElementsWindows.setForegroundText(undefined);
expect(visualElementsWindows.getForegroundText()).toEqual(foregroundTextLight);
Good points, I updated the changes accordingly. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me, thanks @tsschaffert!
I'm going to test and merge this.
We had a problem when trying to release an app in the Windows Store with BackgroundColor set to white because of the contrast between background and foreground color. With this PR, you can set the foreground color to 'dark' in these cases to pass store certification.