| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -10,6 +10,7 @@ export class MyControl extends stackLayoutModule.StackLayout { | |||
| 10 | 10 | var counter: number = 0; | |
| 11 | 11 | ||
| 12 | 12 | var lbl = new label.Label(); | |
| 13 | + lbl.id = "my-test-label"; | ||
| 13 | 14 | var btn = new button.Button(); | |
| 14 | 15 | btn.text = "Tap me!"; | |
| 15 | 16 | btn.on(button.Button.tapEvent, (args: observable.EventData) => { | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1,2 +1,3 @@ | |||
| 1 | 1 | <GridLayout class="MyStackLayoutRoot"> | |
| 2 | + <Label text="I'm here!!!" id="my-test-label"/> | ||
| 2 | 3 | </GridLayout> | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -3,7 +3,7 @@ | |||
| 3 | 3 | ||
| 4 | 4 | <TabViewItem title="Tab"> | |
| 5 | 5 | <TabViewItem.view> | |
| 6 | - <Label text="Tab" /> | ||
| 6 | + <Label text="Tab" id="my-test-label"/> | ||
| 7 | 7 | </TabViewItem.view> | |
| 8 | 8 | </TabViewItem> | |
| 9 | 9 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1,5 +1,5 @@ | |||
| 1 | 1 | import * as TKUnit from "../../TKUnit"; | |
| 2 | - import { Page } from "tns-core-modules/ui/page"; | ||
| 2 | + import { Page, View } from "tns-core-modules/ui/page"; | ||
| 3 | 3 | import { Frame, NavigationEntry, stack } from "tns-core-modules/ui/frame"; | |
| 4 | 4 | import { _resetRootView, getRootView } from "tns-core-modules/application"; | |
| 5 | 5 | import { TabView, TabViewItem } from "tns-core-modules/ui/tab-view"; | |
@@ -65,10 +65,42 @@ export function test_gridlayout_rootview_css_applied() { | |||
| 65 | 65 | helper.assertViewBackgroundColor(rootView, "#0000FF"); | |
| 66 | 66 | }; | |
| 67 | 67 | ||
| 68 | + export function test_gridlayout_rootview_layout_updates() { | ||
| 69 | + layout_invalidate_test("ui/root-view/root-modules/gridlayout-root"); | ||
| 70 | + } | ||
| 71 | + | ||
| 72 | + export function test_custom_component_rootview_layout_updates() { | ||
| 73 | + layout_invalidate_test("ui/root-view/root-modules/custom-component-root"); | ||
| 74 | + } | ||
| 75 | + | ||
| 76 | + export function test_tabview_rootview_layout_updates() { | ||
| 77 | + layout_invalidate_test("ui/root-view/root-modules/gridlayout-root"); | ||
| 78 | + } | ||
| 79 | + | ||
| 80 | + function layout_invalidate_test(moduleName: string) { | ||
| 81 | + var entry = { moduleName }; | ||
| 82 | + | ||
| 83 | + _resetRootView(entry); | ||
| 84 | + | ||
| 85 | + var rootView = getRootView(); | ||
| 86 | + TKUnit.waitUntilReady(() => rootView.isLayoutValid); | ||
| 87 | + | ||
| 88 | + const lbl = <View>rootView.getViewById("my-test-label"); | ||
| 89 | + | ||
| 90 | + lbl.visibility = "collapse"; | ||
| 91 | + TKUnit.assertFalse(rootView.isLayoutValid); | ||
| 92 | + TKUnit.waitUntilReady(() => rootView.isLayoutValid); | ||
| 93 | + | ||
| 94 | + lbl.visibility = "visible"; | ||
| 95 | + TKUnit.assertFalse(rootView.isLayoutValid); | ||
| 96 | + TKUnit.waitUntilReady(() => rootView.isLayoutValid); | ||
| 97 | + TKUnit.waitUntilReady(() => lbl.isLayoutValid); | ||
| 98 | + } | ||
| 99 | + | ||
| 68 | 100 | export function tearDownModule() { | |
| 69 | 101 | // reset the root to frame for other tests | |
| 70 | 102 | const resetFrameRoot = createTestFrameRootEntry(); | |
| 71 | 103 | ||
| 72 | 104 | _resetRootView(resetFrameRoot.entry); | |
| 73 | 105 | TKUnit.waitUntilReady(() => resetFrameRoot.page.isLoaded); | |
| 74 | - } | ||
| 106 | + } | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -59,6 +59,10 @@ export class View extends ViewCommon { | |||
| 59 | 59 | if (nativeView) { | |
| 60 | 60 | nativeView.setNeedsLayout(); | |
| 61 | 61 | } | |
| 62 | + | ||
| 63 | + if (this.viewController && this.viewController.view !== nativeView) { | ||
| 64 | + this.viewController.view.setNeedsLayout(); | ||
| 65 | + } | ||
| 62 | 66 | } | |
| 63 | 67 | ||
| 64 | 68 | public measure(widthMeasureSpec: number, heightMeasureSpec: number): void { | |
| Back | FazBrowse Home | New Git URL |
0 commit comments