mirror of
https://github.com/NativeScript/NativeScript.git
synced 2025-11-05 13:26:48 +08:00
Fix: CSS border-color does not recognize rgb and rgba values
Resolves #2781
This commit is contained in:
@@ -9,7 +9,7 @@ Label {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#s1 {
|
#s1 {
|
||||||
border-width: 5; border-color: red;
|
border-width: 5; border-color: rgba(255,0,0,1);
|
||||||
}
|
}
|
||||||
|
|
||||||
#s2 {
|
#s2 {
|
||||||
@@ -25,7 +25,7 @@ Label {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#s5 {
|
#s5 {
|
||||||
border-width: 5 10 15 20; border-color: red;
|
border-width: 5 10 15 20; border-color: rgb(255, 0, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
#s6 {
|
#s6 {
|
||||||
|
|||||||
@@ -81,6 +81,14 @@ export function test_setting_borderColor_property_from_CSS_is_applied_to_Style()
|
|||||||
test_property_from_CSS_is_applied_to_style("borderColor", "border-color", new color.Color("#FF0000"), "#FF0000");
|
test_property_from_CSS_is_applied_to_style("borderColor", "border-color", new color.Color("#FF0000"), "#FF0000");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function test_setting_borderColorRGB_property_from_CSS_is_applied_to_Style() {
|
||||||
|
test_property_from_CSS_is_applied_to_style("borderColor", "border-color", new color.Color("#FF0000"), "rgb(255, 0, 0)");
|
||||||
|
}
|
||||||
|
|
||||||
|
export function test_setting_borderColorRGBA_property_from_CSS_is_applied_to_Style() {
|
||||||
|
test_property_from_CSS_is_applied_to_style("borderColor", "border-color", new color.Color("#FF0000"), "rgba(255,0,0,1)");
|
||||||
|
}
|
||||||
|
|
||||||
export function test_setting_borderRadius_property_from_CSS_is_applied_to_Style() {
|
export function test_setting_borderRadius_property_from_CSS_is_applied_to_Style() {
|
||||||
test_property_from_CSS_is_applied_to_style("borderRadius", "border-radius", 20);
|
test_property_from_CSS_is_applied_to_style("borderRadius", "border-radius", 20);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1613,6 +1613,11 @@ function parseBorderColor(value: any): definition.BorderColor {
|
|||||||
var result: definition.BorderColor = { top: undefined, right: undefined, bottom: undefined, left: undefined };
|
var result: definition.BorderColor = { top: undefined, right: undefined, bottom: undefined, left: undefined };
|
||||||
try {
|
try {
|
||||||
if (types.isString(value)) {
|
if (types.isString(value)) {
|
||||||
|
if (value.indexOf("rgb") === 0){
|
||||||
|
result.top = result.right = result.bottom = result.left = new Color(value);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
let arr = value.split(/[ ,]+/);
|
let arr = value.split(/[ ,]+/);
|
||||||
if (arr.length === 1){
|
if (arr.length === 1){
|
||||||
let arr0 = new Color(arr[0]);
|
let arr0 = new Color(arr[0]);
|
||||||
|
|||||||
Reference in New Issue
Block a user