From 5902ab4981634091164d21c6888495f958048d21 Mon Sep 17 00:00:00 2001 From: vakrilov Date: Mon, 27 Jul 2015 16:52:35 +0300 Subject: [PATCH] Invalid CSS style tests --- apps/tests/ui/style/style-tests.ts | 34 +++++++++++++++++++++++++++--- 1 file changed, 31 insertions(+), 3 deletions(-) diff --git a/apps/tests/ui/style/style-tests.ts b/apps/tests/ui/style/style-tests.ts index 9bc6ba6a9..29361141d 100644 --- a/apps/tests/ui/style/style-tests.ts +++ b/apps/tests/ui/style/style-tests.ts @@ -756,7 +756,7 @@ export function test_setStyle_throws() { }, "View.style property is read-only."); } -export var test_CSS_isAppliedOnPage = function () { +export function test_CSS_isAppliedOnPage() { var testButton = new buttonModule.Button(); 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(); 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(); 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) { + var page: pageModule.Page = views[1]; + TKUnit.assertEqual(30, testButton.style.fontSize); + }, invalidCSS); +} + // // For information and example how to use style properties please refer to special [**Styling**](../../../styling.md) topic. //