|
|
|
@@ -139,7 +139,7 @@ export function test_class_selector() {
|
|
|
|
|
|
|
|
|
|
//// Will be styled
|
|
|
|
|
btnWithClass = new buttonModule.Button();
|
|
|
|
|
btnWithClass.cssClass = "test";
|
|
|
|
|
btnWithClass.className = "test";
|
|
|
|
|
|
|
|
|
|
//// Won't be styled
|
|
|
|
|
btnWithNoClass = new buttonModule.Button();
|
|
|
|
@@ -172,7 +172,7 @@ export function test_multiple_class_selector() {
|
|
|
|
|
|
|
|
|
|
//// Will be styled
|
|
|
|
|
btnWithClasses = new buttonModule.Button();
|
|
|
|
|
btnWithClasses.cssClass = "style1 style2";
|
|
|
|
|
btnWithClasses.className = "style1 style2";
|
|
|
|
|
|
|
|
|
|
var stack = new stackModule.StackLayout();
|
|
|
|
|
page.content = stack;
|
|
|
|
@@ -290,7 +290,7 @@ export function test_class_and_state_selector() {
|
|
|
|
|
page.content = testStack;
|
|
|
|
|
|
|
|
|
|
btn = new buttonModule.Button();
|
|
|
|
|
btn.cssClass = "test"
|
|
|
|
|
btn.className = "test"
|
|
|
|
|
testStack.addChild(btn);
|
|
|
|
|
|
|
|
|
|
page.css = ".test:pressed { color: red; }";
|
|
|
|
@@ -315,7 +315,7 @@ export function test_class_and_state_selector_with_multiple_classes() {
|
|
|
|
|
page.content = testStack;
|
|
|
|
|
|
|
|
|
|
btn = new buttonModule.Button();
|
|
|
|
|
btn.cssClass = "test otherClass"
|
|
|
|
|
btn.className = "test otherClass"
|
|
|
|
|
testStack.addChild(btn);
|
|
|
|
|
|
|
|
|
|
page.css = ".test:pressed { color: red; }";
|
|
|
|
@@ -392,14 +392,14 @@ export function test_restore_original_values_when_state_is_changed() {
|
|
|
|
|
// testPage.content = testStack;
|
|
|
|
|
|
|
|
|
|
// var btnWithClass = new button.Button();
|
|
|
|
|
// btnWithClass.cssClass = "test";
|
|
|
|
|
// btnWithClass.className = "test";
|
|
|
|
|
// testStack.addChild(btnWithClass);
|
|
|
|
|
|
|
|
|
|
// var btnWithNoClass = new button.Button();
|
|
|
|
|
// testStack.addChild(btnWithNoClass);
|
|
|
|
|
|
|
|
|
|
// var lblWithClass = new label.Label();
|
|
|
|
|
// lblWithClass.cssClass = "test";
|
|
|
|
|
// lblWithClass.className = "test";
|
|
|
|
|
// testStack.addChild(lblWithClass);
|
|
|
|
|
|
|
|
|
|
// testPage.css = "button.test { color: red; }";
|
|
|
|
@@ -431,14 +431,14 @@ export function test_restore_original_values_when_state_is_changed() {
|
|
|
|
|
// testPage.content = testStack;
|
|
|
|
|
|
|
|
|
|
// var btnWithClass = new button.Button();
|
|
|
|
|
// btnWithClass.cssClass = "test";
|
|
|
|
|
// btnWithClass.className = "test";
|
|
|
|
|
// testStack.addChild(btnWithClass);
|
|
|
|
|
|
|
|
|
|
// var btnWithNoClass = new button.Button();
|
|
|
|
|
// testStack.addChild(btnWithNoClass);
|
|
|
|
|
|
|
|
|
|
// var lblWithClass = new label.Label();
|
|
|
|
|
// lblWithClass.cssClass = "test";
|
|
|
|
|
// lblWithClass.className = "test";
|
|
|
|
|
// testStack.addChild(lblWithClass);
|
|
|
|
|
|
|
|
|
|
// testPage.css = "button.test:pressed { color: red; }";
|
|
|
|
@@ -506,7 +506,7 @@ export function test_styles_are_updated_when_cssCalss_is_set() {
|
|
|
|
|
helper.assertViewBackgroundColor(btn, "#111111");
|
|
|
|
|
helper.assertViewBackgroundColor(btn2, "#111111");
|
|
|
|
|
|
|
|
|
|
btn.cssClass = "button-class";
|
|
|
|
|
btn.className = "button-class";
|
|
|
|
|
|
|
|
|
|
helper.assertViewBackgroundColor(btn, "#222222");
|
|
|
|
|
helper.assertViewBackgroundColor(btn2, "#111111");
|
|
|
|
@@ -518,7 +518,7 @@ export function test_styles_are_updated_when_cssCalss_is_set() {
|
|
|
|
|
export function test_styles_are_updated_when_cssCalss_is_changed() {
|
|
|
|
|
var testStack = new stackModule.StackLayout();
|
|
|
|
|
var btn = new buttonModule.Button();
|
|
|
|
|
btn.cssClass = "button-class";
|
|
|
|
|
btn.className = "button-class";
|
|
|
|
|
var btn2 = new buttonModule.Button();
|
|
|
|
|
testStack.addChild(btn);
|
|
|
|
|
testStack.addChild(btn2);
|
|
|
|
@@ -527,7 +527,7 @@ export function test_styles_are_updated_when_cssCalss_is_changed() {
|
|
|
|
|
helper.assertViewBackgroundColor(btn, "#222222");
|
|
|
|
|
helper.assertViewBackgroundColor(btn2, "#111111");
|
|
|
|
|
|
|
|
|
|
btn.cssClass = "button-class-two";
|
|
|
|
|
btn.className = "button-class-two";
|
|
|
|
|
|
|
|
|
|
helper.assertViewBackgroundColor(btn, "#333333");
|
|
|
|
|
helper.assertViewBackgroundColor(btn2, "#111111");
|
|
|
|
@@ -539,7 +539,7 @@ export function test_styles_are_updated_when_cssCalss_is_changed() {
|
|
|
|
|
export function test_styles_are_updated_when_cssCalss_is_cleared() {
|
|
|
|
|
var testStack = new stackModule.StackLayout();
|
|
|
|
|
var btn = new buttonModule.Button();
|
|
|
|
|
btn.cssClass = "button-class";
|
|
|
|
|
btn.className = "button-class";
|
|
|
|
|
var btn2 = new buttonModule.Button();
|
|
|
|
|
testStack.addChild(btn);
|
|
|
|
|
testStack.addChild(btn2);
|
|
|
|
@@ -548,7 +548,7 @@ export function test_styles_are_updated_when_cssCalss_is_cleared() {
|
|
|
|
|
helper.assertViewBackgroundColor(btn, "#222222");
|
|
|
|
|
helper.assertViewBackgroundColor(btn2, "#111111");
|
|
|
|
|
|
|
|
|
|
btn.cssClass = undefined;
|
|
|
|
|
btn.className = undefined;
|
|
|
|
|
|
|
|
|
|
helper.assertViewBackgroundColor(btn, "#111111");
|
|
|
|
|
helper.assertViewBackgroundColor(btn2, "#111111");
|
|
|
|
@@ -661,11 +661,11 @@ function testSelectorsPrioritiesTemplate(css: string) {
|
|
|
|
|
testStack.addChild(btn);
|
|
|
|
|
|
|
|
|
|
btnWithClass = new buttonModule.Button();
|
|
|
|
|
btnWithClass.cssClass = "button-class";
|
|
|
|
|
btnWithClass.className = "button-class";
|
|
|
|
|
testStack.addChild(btnWithClass);
|
|
|
|
|
|
|
|
|
|
btnWithId = new buttonModule.Button();
|
|
|
|
|
btnWithId.cssClass = "button-class";
|
|
|
|
|
btnWithId.className = "button-class";
|
|
|
|
|
btnWithId.id = "myButton"
|
|
|
|
|
testStack.addChild(btnWithId);
|
|
|
|
|
|
|
|
|
@@ -817,7 +817,7 @@ var invalidCSS = ".invalid { " +
|
|
|
|
|
export function test_set_invalid_CSS_values_dont_cause_crash() {
|
|
|
|
|
var testButton = new buttonModule.Button();
|
|
|
|
|
testButton.text = "Test";
|
|
|
|
|
testButton.cssClass = "invalid";
|
|
|
|
|
testButton.className = "invalid";
|
|
|
|
|
|
|
|
|
|
helper.buildUIAndRunTest(testButton, function (views: Array<viewModule.View>) {
|
|
|
|
|
TKUnit.assertEqual(30, testButton.style.fontSize);
|
|
|
|
@@ -834,7 +834,7 @@ var casedCSS = ".cased {" +
|
|
|
|
|
export function test_set_mixed_CSS_cases_works() {
|
|
|
|
|
var testButton = new buttonModule.Button();
|
|
|
|
|
testButton.text = "Test";
|
|
|
|
|
testButton.cssClass = "cased";
|
|
|
|
|
testButton.className = "cased";
|
|
|
|
|
|
|
|
|
|
helper.buildUIAndRunTest(testButton, function (views: Array<viewModule.View>) {
|
|
|
|
|
TKUnit.assertEqual(30, testButton.style.fontSize);
|
|
|
|
|