From b2246ad0898dfc8429cc165b62eb35d52814eb51 Mon Sep 17 00:00:00 2001 From: Manol Donev Date: Wed, 10 Oct 2018 15:52:23 +0300 Subject: [PATCH] chore: fix nav tests with cli next (#6374) --- tests/app/navigation/navigation-tests.ts | 2 +- tests/app/testRunner.ts | 14 ++++++-------- tests/app/ui/layouts/flexbox-layout-tests.ts | 10 +++++----- 3 files changed, 12 insertions(+), 14 deletions(-) diff --git a/tests/app/navigation/navigation-tests.ts b/tests/app/navigation/navigation-tests.ts index 49339a701..f601b13c1 100644 --- a/tests/app/navigation/navigation-tests.ts +++ b/tests/app/navigation/navigation-tests.ts @@ -146,7 +146,7 @@ export function test_ClearHistory_WithTransition() { // Test case for https://github.com/NativeScript/NativeScript/issues/1948 export function test_ClearHistoryWithTransitionDoesNotBreakNavigation() { let topmost = topmostFrame(); - let mainTestPage = topmost.currentPage; + let mainTestPage = new Page(); let mainPageFactory = function (): Page { return mainTestPage; }; diff --git a/tests/app/testRunner.ts b/tests/app/testRunner.ts index 337c33db9..f6c9982ca 100644 --- a/tests/app/testRunner.ts +++ b/tests/app/testRunner.ts @@ -1,17 +1,15 @@ /* tslint:disable */ import * as TKUnit from "./TKUnit"; -import { _resetRootView, getRootView } from "tns-core-modules/application"; +import { _resetRootView } from "tns-core-modules/application"; import { messageType } from "tns-core-modules/trace"; -import { topmost, Frame, NavigationEntry } from "tns-core-modules/ui/frame"; +import { topmost, Frame } from "tns-core-modules/ui/frame"; import { Page } from "tns-core-modules/ui/page"; import { TextView } from "tns-core-modules/ui/text-view"; import { Button } from "tns-core-modules/ui/button"; import { StackLayout } from "tns-core-modules/ui/layouts/stack-layout"; import * as platform from "tns-core-modules/platform"; import "./ui-test"; -import * as fs from "tns-core-modules/file-system"; -import { unsetValue } from "tns-core-modules/ui/core/properties"; -import { ad, ios } from "tns-core-modules/utils/utils"; +import { ios } from "tns-core-modules/utils/utils"; Frame.defaultAnimatedNavigation = false; @@ -148,12 +146,12 @@ if (platform.isIOS && ios.MajorVersion > 10) { import * as stylePropertiesTests from "./ui/styling/style-properties-tests"; allTests["STYLE-PROPERTIES"] = stylePropertiesTests; -import * as tabViewRootTests from "./ui/tab-view/tab-view-root-tests"; -allTests["TAB-VIEW-ROOT"] = tabViewRootTests; - import * as frameTests from "./ui/frame/frame-tests"; allTests["FRAME"] = frameTests; +import * as tabViewRootTests from "./ui/tab-view/tab-view-root-tests"; +allTests["TAB-VIEW-ROOT"] = tabViewRootTests; + import * as viewTests from "./ui/view/view-tests"; allTests["VIEW"] = viewTests; diff --git a/tests/app/ui/layouts/flexbox-layout-tests.ts b/tests/app/ui/layouts/flexbox-layout-tests.ts index af492c352..86ef59e54 100644 --- a/tests/app/ui/layouts/flexbox-layout-tests.ts +++ b/tests/app/ui/layouts/flexbox-layout-tests.ts @@ -849,7 +849,7 @@ export const testAlignContent_spaceBetween_withPadding = test( isBottomAlignedWith(text3, flexbox); isLeftAlignedWith(text3, flexbox); } -); +); export const testAlignContent_spaceAround = test( activity_align_content_test, @@ -862,9 +862,9 @@ export const testAlignContent_spaceAround = test( let spaceAround = height(flexbox) - height(text1) - height(text3); spaceAround /= 4; // Divide by the number of flex lines * 2 - isBelowWith(flexbox, text1, spaceAround); + isBelowWith(flexbox, text1, Math.ceil(spaceAround)); isBelowWith(text1, text3, height(text1) + 2 * spaceAround); - isAboveWith(text3, flexbox, spaceAround); + isAboveWith(text3, flexbox, Math.ceil(spaceAround)); isAboveWith(text1, text3, height(text3) + 2 * spaceAround); // TODO: equal(flexbox.getFlexLines().size(), is(2)); @@ -992,9 +992,9 @@ export const testAlignContent_spaceAround_flexDirection_column = test( let spaceAround = width(flexbox) - width(text1) - width(text3); spaceAround /= 4; // Divide by the number of flex lines * 2 - isLeftWith(flexbox, text1, spaceAround); + isLeftWith(flexbox, text1, Math.ceil(spaceAround)); isLeftWith(text1, text3, width(text1) + 2 * spaceAround); - isRightWith(text3, flexbox, spaceAround); + isRightWith(text3, flexbox, Math.ceil(spaceAround)); isRightWith(text1, text3, width(text3) + 2 * spaceAround); } );