From cb92ca07af72f4ae4c976f1217dfad868e90a485 Mon Sep 17 00:00:00 2001 From: Vasil Chimev Date: Tue, 17 Sep 2019 18:07:55 +0300 Subject: [PATCH] test: page background color --- tests/app/ui/page/page-tests-common.ts | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/tests/app/ui/page/page-tests-common.ts b/tests/app/ui/page/page-tests-common.ts index 0ffcaf6da..ae98cab6a 100644 --- a/tests/app/ui/page/page-tests-common.ts +++ b/tests/app/ui/page/page-tests-common.ts @@ -24,6 +24,9 @@ import { Color } from "tns-core-modules/color"; import { TabView, TabViewItem } from "tns-core-modules/ui/tab-view/tab-view"; import { _resetRootView } from "tns-core-modules/application"; 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) { const label = new Label(); @@ -376,15 +379,18 @@ export function test_cssShouldBeAppliedAfterChangeToAllNestedElements() { TKUnit.assertEqual(stackLayout.style.backgroundColor.hex, "#0000FF"); } -export function test_page_backgroundColor_is_white() { +export function test_page_backgroundColor() { const page = new Page(); - page.id = "page_test_page_backgroundColor_is_white"; + page.id = "page_test_page_backgroundColor"; + const factory = () => page; helper.navigate(factory); - const whiteColor = new Color("white"); + 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 { + const whiteColor = new Color("white"); TKUnit.assertEqual(page.nativeViewProtected.getBackground().getColor(), whiteColor.android, "page default backgroundColor should be white"); } }