mirror of
https://github.com/NativeScript/NativeScript.git
synced 2025-08-17 21:01:34 +08:00
Invalid CSS style tests
This commit is contained in:
@ -756,7 +756,7 @@ export function test_setStyle_throws() {
|
|||||||
}, "View.style property is read-only.");
|
}, "View.style property is read-only.");
|
||||||
}
|
}
|
||||||
|
|
||||||
export var test_CSS_isAppliedOnPage = function () {
|
export function test_CSS_isAppliedOnPage() {
|
||||||
var testButton = new buttonModule.Button();
|
var testButton = new buttonModule.Button();
|
||||||
testButton.text = "Test";
|
testButton.text = "Test";
|
||||||
|
|
||||||
@ -767,7 +767,7 @@ export var test_CSS_isAppliedOnPage = function () {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
export var test_CSS_isAppliedOnPage_From_Import = function () {
|
export function test_CSS_isAppliedOnPage_From_Import() {
|
||||||
var testButton = new buttonModule.Button();
|
var testButton = new buttonModule.Button();
|
||||||
testButton.text = "Test";
|
testButton.text = "Test";
|
||||||
|
|
||||||
@ -778,7 +778,7 @@ export var test_CSS_isAppliedOnPage_From_Import = function () {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
export var test_CSS_isAppliedOnPage_From_addCssFile = function () {
|
export function test_CSS_isAppliedOnPage_From_addCssFile() {
|
||||||
var testButton = new buttonModule.Button();
|
var testButton = new buttonModule.Button();
|
||||||
testButton.text = "Test";
|
testButton.text = "Test";
|
||||||
|
|
||||||
@ -789,6 +789,34 @@ export var test_CSS_isAppliedOnPage_From_addCssFile = function () {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var invalidCSS = ".invalid { " +
|
||||||
|
"color: invalidValue; " +
|
||||||
|
"background-color: invalidValue; " +
|
||||||
|
"border-color: invalidValue; " +
|
||||||
|
"border-width: invalidValue; " +
|
||||||
|
"border-radius: invalidValue; " +
|
||||||
|
"font: invalidValue; " +
|
||||||
|
"font-style: invalidValue; " +
|
||||||
|
"font-weight: invalidValue; " +
|
||||||
|
"text-align: invalidValue; " +
|
||||||
|
"min-width: invalidValue; " +
|
||||||
|
"min-height: invalidValue; " +
|
||||||
|
"visibility: invalidValue; " +
|
||||||
|
"opacity: invalidValue; " +
|
||||||
|
"font-size: 30;" + // set one valid value to test it is applied
|
||||||
|
"}";
|
||||||
|
|
||||||
|
export function test_set_invalid_CSS_values_dont_cause_crash() {
|
||||||
|
var testButton = new buttonModule.Button();
|
||||||
|
testButton.text = "Test";
|
||||||
|
testButton.cssClass = "invalid";
|
||||||
|
|
||||||
|
helper.buildUIAndRunTest(testButton, function (views: Array<viewModule.View>) {
|
||||||
|
var page: pageModule.Page = <pageModule.Page> views[1];
|
||||||
|
TKUnit.assertEqual(30, testButton.style.fontSize);
|
||||||
|
}, invalidCSS);
|
||||||
|
}
|
||||||
|
|
||||||
// <snippet module="ui/styling" title="styling">
|
// <snippet module="ui/styling" title="styling">
|
||||||
// For information and example how to use style properties please refer to special [**Styling**](../../../styling.md) topic.
|
// For information and example how to use style properties please refer to special [**Styling**](../../../styling.md) topic.
|
||||||
// </snippet>
|
// </snippet>
|
||||||
|
Reference in New Issue
Block a user