mirror of
https://github.com/NativeScript/NativeScript.git
synced 2025-08-15 11:01:21 +08:00
test: page background color
This commit is contained in:
@ -24,6 +24,9 @@ import { Color } from "tns-core-modules/color";
|
|||||||
import { TabView, TabViewItem } from "tns-core-modules/ui/tab-view/tab-view";
|
import { TabView, TabViewItem } from "tns-core-modules/ui/tab-view/tab-view";
|
||||||
import { _resetRootView } from "tns-core-modules/application";
|
import { _resetRootView } from "tns-core-modules/application";
|
||||||
import { Button } from "tns-core-modules/ui/button/button";
|
import { Button } from "tns-core-modules/ui/button/button";
|
||||||
|
import { ios } from "tns-core-modules/utils/utils";
|
||||||
|
|
||||||
|
const majorVersion = ios.MajorVersion;
|
||||||
|
|
||||||
export function addLabelToPage(page: Page, text?: string) {
|
export function addLabelToPage(page: Page, text?: string) {
|
||||||
const label = new Label();
|
const label = new Label();
|
||||||
@ -376,15 +379,18 @@ export function test_cssShouldBeAppliedAfterChangeToAllNestedElements() {
|
|||||||
TKUnit.assertEqual(stackLayout.style.backgroundColor.hex, "#0000FF");
|
TKUnit.assertEqual(stackLayout.style.backgroundColor.hex, "#0000FF");
|
||||||
}
|
}
|
||||||
|
|
||||||
export function test_page_backgroundColor_is_white() {
|
export function test_page_backgroundColor() {
|
||||||
const page = new Page();
|
const page = new Page();
|
||||||
page.id = "page_test_page_backgroundColor_is_white";
|
page.id = "page_test_page_backgroundColor";
|
||||||
|
|
||||||
const factory = () => page;
|
const factory = () => page;
|
||||||
helper.navigate(factory);
|
helper.navigate(factory);
|
||||||
const whiteColor = new Color("white");
|
|
||||||
if (isIOS) {
|
if (isIOS) {
|
||||||
TKUnit.assertTrue(whiteColor.ios.CGColor.isEqual(page.nativeViewProtected.backgroundColor.CGColor), "page default backgroundColor should be white");
|
const backgroundColor = majorVersion <= 12 ? UIColor.whiteColor : UIColor.systemBackgroundColor;
|
||||||
|
TKUnit.assertEqual(page.nativeView.backgroundColor, backgroundColor, "page backgroundColor is wrong");
|
||||||
} else {
|
} else {
|
||||||
|
const whiteColor = new Color("white");
|
||||||
TKUnit.assertEqual(page.nativeViewProtected.getBackground().getColor(), whiteColor.android, "page default backgroundColor should be white");
|
TKUnit.assertEqual(page.nativeViewProtected.getBackground().getColor(), whiteColor.android, "page default backgroundColor should be white");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user