| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -226,7 +226,7 @@ import * as cssAnimationTests from "./ui/animation/css-animation-tests"; | |||
| 226 | 226 | allTests["CSS-ANIMATION"] = cssAnimationTests; | |
| 227 | 227 | ||
| 228 | 228 | import * as transitionTests from "./navigation/transition-tests"; | |
| 229 | - allTests["TANSITIONS"] = transitionTests; | ||
| 229 | + allTests["TRANSITIONS"] = transitionTests; | ||
| 230 | 230 | import * as searchBarTests from "./ui/search-bar/search-bar-tests"; | |
| 231 | 231 | allTests["SEARCH-BAR"] = searchBarTests; | |
| 232 | 232 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -19,7 +19,7 @@ import * as helper from "../helper"; | |||
| 19 | 19 | import { GridLayout } from "tns-core-modules/ui/layouts/grid-layout"; | |
| 20 | 20 | import { StackLayout } from "tns-core-modules/ui/layouts/stack-layout"; | |
| 21 | 21 | import { View, PercentLength, Observable, unsetValue, EventData, isIOS } from "tns-core-modules/ui/core/view"; | |
| 22 | - import { Frame } from "tns-core-modules/ui/frame"; | ||
| 22 | + import { Frame, stack } from "tns-core-modules/ui/frame"; | ||
| 23 | 23 | import { Label } from "tns-core-modules/ui/label"; | |
| 24 | 24 | import { Color } from "tns-core-modules/color"; | |
| 25 | 25 | ||
@@ -548,6 +548,7 @@ export function test_WhenModalPageShownHostPageNavigationEventsShouldNotBeRaised | |||
| 548 | 548 | let ready = false; | |
| 549 | 549 | ||
| 550 | 550 | const modalCloseCallback = function (returnValue: any) { | |
| 551 | + TKUnit.assertEqual(stack().length, 1, "Single frame should be instantiated at this point!"); | ||
| 551 | 552 | ready = true; | |
| 552 | 553 | } | |
| 553 | 554 | ||
@@ -567,6 +568,10 @@ export function test_WhenModalPageShownHostPageNavigationEventsShouldNotBeRaised | |||
| 567 | 568 | hostNavigatedFromCount++; | |
| 568 | 569 | }; | |
| 569 | 570 | ||
| 571 | + const modalPageShownModallyEventHandler = function() { | ||
| 572 | + TKUnit.assertEqual(stack().length, 1, "Single frame should be instantiated at this point!"); | ||
| 573 | + } | ||
| 574 | + | ||
| 570 | 575 | const hostNavigatedToEventHandler2 = function(args: NavigatedData) { | |
| 571 | 576 | const page = <Page>args.object; | |
| 572 | 577 | page.off(Page.navigatedToEvent, hostNavigatedToEventHandler2); | |
@@ -576,7 +581,11 @@ export function test_WhenModalPageShownHostPageNavigationEventsShouldNotBeRaised | |||
| 576 | 581 | moduleName: basePath + "modal-page" | |
| 577 | 582 | }; | |
| 578 | 583 | ||
| 584 | + TKUnit.assertEqual(stack().length, 1, "Single frame should be instantiated at this point!"); | ||
| 585 | + | ||
| 579 | 586 | const modalPage = createViewFromEntry(entry) as Page; | |
| 587 | + modalPage.on(Frame.shownModallyEvent, modalPageShownModallyEventHandler); | ||
| 588 | + | ||
| 580 | 589 | page.showModal(modalPage, {}, modalCloseCallback, false, false); | |
| 581 | 590 | } | |
| 582 | 591 | ||
@@ -694,6 +703,7 @@ export function test_WhenModalFrameShownModalEventsRaisedOnRootModalFrame() { | |||
| 694 | 703 | let ready = false; | |
| 695 | 704 | ||
| 696 | 705 | const modalCloseCallback = function (returnValue: any) { | |
| 706 | + TKUnit.assertEqual(stack().length, 1, "Single frame should be instantiated at this point!"); | ||
| 697 | 707 | ready = true; | |
| 698 | 708 | } | |
| 699 | 709 | ||
@@ -703,6 +713,7 @@ export function test_WhenModalFrameShownModalEventsRaisedOnRootModalFrame() { | |||
| 703 | 713 | ||
| 704 | 714 | const modalFrameShownModallyEventHandler = function(args: ShownModallyData) { | |
| 705 | 715 | shownModallyCount++; | |
| 716 | + TKUnit.assertEqual(stack().length, 2, "Host and modal frame should be instantiated at this point!"); | ||
| 706 | 717 | ||
| 707 | 718 | args.closeCallback("return value"); | |
| 708 | 719 | } | |
@@ -720,11 +731,15 @@ export function test_WhenModalFrameShownModalEventsRaisedOnRootModalFrame() { | |||
| 720 | 731 | ||
| 721 | 732 | const modalPage = createViewFromEntry(entry) as Page; | |
| 722 | 733 | ||
| 734 | + TKUnit.assertEqual(stack().length, 1, "Single frame should be instantiated at this point!"); | ||
| 735 | + | ||
| 723 | 736 | modalFrame = new Frame(); | |
| 724 | 737 | modalFrame.on(Frame.showingModallyEvent, modalFrameShowingModallyEventHandler); | |
| 725 | 738 | modalFrame.on(Frame.shownModallyEvent, modalFrameShownModallyEventHandler); | |
| 726 | 739 | modalFrame.navigate(() => modalPage); | |
| 727 | 740 | ||
| 741 | + TKUnit.assertEqual(stack().length, 2, "Host and modal frame should be instantiated at this point!"); | ||
| 742 | + | ||
| 728 | 743 | page.showModal(modalFrame, {}, modalCloseCallback, false, false); | |
| 729 | 744 | } | |
| 730 | 745 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -263,6 +263,10 @@ export abstract class ViewBase extends Observable { | |||
| 263 | 263 | */ | |
| 264 | 264 | public _removeViewCore(view: ViewBase): void; | |
| 265 | 265 | public _parentChanged(oldParent: ViewBase): void; | |
| 266 | + /** | ||
| 267 | + * Method is intended to be overridden by inheritors and used as "protected" | ||
| 268 | + */ | ||
| 269 | + public _dialogClosed(): void; | ||
| 266 | 270 | ||
| 267 | 271 | _domId: number; | |
| 268 | 272 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -956,6 +956,10 @@ export abstract class ViewBase extends Observable implements ViewBaseDefinition | |||
| 956 | 956 | parent.closeModal(); | |
| 957 | 957 | } | |
| 958 | 958 | } | |
| 959 | + | ||
| 960 | + public _dialogClosed(): void { | ||
| 961 | + return; | ||
| 962 | + } | ||
| 959 | 963 | } | |
| 960 | 964 | ||
| 961 | 965 | ViewBase.prototype.isCollapsed = false; | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -251,10 +251,12 @@ export abstract class ViewCommon extends ViewBase implements ViewDefinition { | |||
| 251 | 251 | const modalIndex = _rootModalViews.indexOf(that); | |
| 252 | 252 | _rootModalViews.splice(modalIndex); | |
| 253 | 253 | that._hideNativeModalView(parent); | |
| 254 | - that._modalParent = null | ||
| 254 | + that._modalParent = null; | ||
| 255 | 255 | that._modalContext = null; | |
| 256 | 256 | that._closeModalCallback = null; | |
| 257 | + that._dialogClosed(); | ||
| 257 | 258 | parent._modal = null; | |
| 259 | + | ||
| 258 | 260 | if (typeof closeCallback === "function") { | |
| 259 | 261 | closeCallback.apply(undefined, arguments); | |
| 260 | 262 | } | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -58,18 +58,10 @@ export class FrameBase extends CustomLayoutView implements FrameDefinition { | |||
| 58 | 58 | @profile | |
| 59 | 59 | public onLoaded() { | |
| 60 | 60 | super.onLoaded(); | |
| 61 | - | ||
| 62 | - this._pushInFrameStack(); | ||
| 61 | + | ||
| 63 | 62 | this._processNextNavigationEntry(); | |
| 64 | 63 | } | |
| 65 | 64 | ||
| 66 | - @profile | ||
| 67 | - public onUnloaded() { | ||
| 68 | - super.onUnloaded(); | ||
| 69 | - | ||
| 70 | - this._popFromFrameStack(); | ||
| 71 | - } | ||
| 72 | - | ||
| 73 | 65 | public canGoBack(): boolean { | |
| 74 | 66 | let backstack = this._backStack.length; | |
| 75 | 67 | let previousForwardNotInBackstack = false; | |
@@ -192,6 +184,8 @@ export class FrameBase extends CustomLayoutView implements FrameDefinition { | |||
| 192 | 184 | // app.on(app.orientationChangedEvent, (data) => this._onOrientationChanged()); | |
| 193 | 185 | // } | |
| 194 | 186 | ||
| 187 | + this._pushInFrameStack(); | ||
| 188 | + | ||
| 195 | 189 | const backstackEntry: BackstackEntry = { | |
| 196 | 190 | entry: entry, | |
| 197 | 191 | resolvedPage: page, | |
@@ -430,6 +424,10 @@ export class FrameBase extends CustomLayoutView implements FrameDefinition { | |||
| 430 | 424 | this._isInFrameStack = false; | |
| 431 | 425 | } | |
| 432 | 426 | ||
| 427 | + public _dialogClosed(): void { | ||
| 428 | + this._popFromFrameStack(); | ||
| 429 | + } | ||
| 430 | + | ||
| 433 | 431 | get _childrenCount(): number { | |
| 434 | 432 | if (this.currentPage) { | |
| 435 | 433 | return 1; | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -243,7 +243,9 @@ export class Frame extends FrameBase { | |||
| 243 | 243 | if (this.canGoBack()) { | |
| 244 | 244 | this.goBack(); | |
| 245 | 245 | return true; | |
| 246 | - } else if (!this.navigationQueueIsEmpty()) { | ||
| 246 | + } | ||
| 247 | + | ||
| 248 | + if (!this.navigationQueueIsEmpty()) { | ||
| 247 | 249 | const manager = this._getFragmentManager(); | |
| 248 | 250 | if (manager) { | |
| 249 | 251 | manager.executePendingTransactions(); | |
| Back | FazBrowse Home | New Git URL |
0 commit comments