| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -2,7 +2,7 @@ import * as helper from "../helper"; | |||
| 2 | 2 | import TKUnit = require("../../TKUnit"); | |
| 3 | 3 | import { isIOS, isAndroid } from "tns-core-modules/platform"; | |
| 4 | 4 | import { _resetRootView } from "tns-core-modules/application/"; | |
| 5 | - import { Frame, NavigationEntry } from "tns-core-modules/ui/frame"; | ||
| 5 | + import { Frame, NavigationEntry, topmost } from "tns-core-modules/ui/frame"; | ||
| 6 | 6 | import { Page } from "tns-core-modules/ui/page"; | |
| 7 | 7 | import { TabView, TabViewItem } from "tns-core-modules/ui/tab-view"; | |
| 8 | 8 | ||
@@ -56,7 +56,26 @@ function createTabItemsWithFrames(count: number) { | |||
| 56 | 56 | return items; | |
| 57 | 57 | } | |
| 58 | 58 | ||
| 59 | - export function test_ios_and_android_offset_zero_should_raise_same_events() { | ||
| 59 | + export function test_frame_topmost_matches_selectedIndex() { | ||
| 60 | + const items = createTabItemsWithFrames(3); | ||
| 61 | + const tabView = new TabView(); | ||
| 62 | + tabView.items = items.map(item => item.tabItem); | ||
| 63 | + tabView.selectedIndex = 0; | ||
| 64 | + | ||
| 65 | + const entry: NavigationEntry = { | ||
| 66 | + create: () => tabView | ||
| 67 | + }; | ||
| 68 | + | ||
| 69 | + helper.waitUntilNavigatedTo(items[0].page, () => _resetRootView(entry)); | ||
| 70 | + | ||
| 71 | + TKUnit.assertEqual(topmost().id, "Tab0 Frame0"); | ||
| 72 | + | ||
| 73 | + helper.waitUntilNavigatedTo(items[1].page, () => tabView.selectedIndex = 1); | ||
| 74 | + | ||
| 75 | + TKUnit.assertEqual(topmost().id, "Tab1 Frame1"); | ||
| 76 | + } | ||
| 77 | + | ||
| 78 | + export function test_offset_zero_should_raise_same_events() { | ||
| 60 | 79 | let actualEventsRaised = []; | |
| 61 | 80 | ||
| 62 | 81 | function resetActualEventsRaised() { | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -6,10 +6,10 @@ | |||
| 6 | 6 | "nativescript": { | |
| 7 | 7 | "id": "org.nativescript.UnitTestApp", | |
| 8 | 8 | "tns-ios": { | |
| 9 | - "version": "3.4.1" | ||
| 9 | + "version": "4.1.0" | ||
| 10 | 10 | }, | |
| 11 | 11 | "tns-android": { | |
| 12 | - "version": "3.4.1" | ||
| 12 | + "version": "4.1.1" | ||
| 13 | 13 | } | |
| 14 | 14 | }, | |
| 15 | 15 | "dependencies": { | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -213,6 +213,13 @@ export class TabView extends TabViewBase { | |||
| 213 | 213 | @profile | |
| 214 | 214 | public onLoaded() { | |
| 215 | 215 | super.onLoaded(); | |
| 216 | + | ||
| 217 | + const selectedIndex = this.selectedIndex; | ||
| 218 | + const selectedView = this.items && this.items[selectedIndex] && this.items[selectedIndex].view; | ||
| 219 | + if (selectedView instanceof Frame) { | ||
| 220 | + selectedView._pushInFrameStack(); | ||
| 221 | + } | ||
| 222 | + | ||
| 216 | 223 | this._ios.delegate = this._delegate; | |
| 217 | 224 | } | |
| 218 | 225 | ||
| Back | FazBrowse Home | New Git URL |
0 commit comments