import * as TKUnit from "../../tk-unit"; import * as helper from "../../ui-helper"; import { Builder } from "@nativescript/core/ui/builder"; import { Label } from "@nativescript/core/ui/label"; import { Button } from "@nativescript/core/ui/button"; import { Page } from "@nativescript/core/ui/page"; import { View, isIOS } from "@nativescript/core/ui/core/view"; import { fromObject } from "@nativescript/core/data/observable"; import { Frame } from "@nativescript/core/ui/frame"; // >> actionbar-common-require import * as actionBarModule from "@nativescript/core/ui/action-bar"; // << actionbar-common-require export function test_actionItem_inherit_bindingContext() { let page: Page; let label: Label; const context = { text: "item" }; const pageFactory = function (): Page { page = new Page(); page.bindingContext = context; const actionItem = new actionBarModule.ActionItem(); actionItem.bind({ sourceProperty: "text", targetProperty: "text" }); page.actionBar.actionItems.addItem(actionItem); label = new Label(); label.text = "Text"; page.content = label; return page; }; helper.navigate(pageFactory); TKUnit.assertEqual(page.actionBar.actionItems.getItemAt(0).text, "item", "actionItem.text"); } export function test_actionBar_inherit_bindingContext_inXML() { const p = Builder.parse( " "); p.bindingContext = { myProp: "success" }; TKUnit.assertEqual(p.actionBar.title, "success", "actionBar.title"); } export function test_actionItem_inherit_bindingContext_inXML() { const p = Builder.parse( " " + "" + " "); p.bindingContext = { myProp: "success" }; const actionItem = p.actionBar.actionItems.getItemAt(0); TKUnit.assertEqual(actionItem.text, "success", "actionItem.text"); } export function test_actionItem_page_property_inXML() { const p = Builder.parse( " " + "" + " "); const actionItem = p.actionBar.actionItems.getItemAt(0); TKUnit.assertEqual(actionItem.page, p, "actionItem.page"); } export function test_actionItem_actionView_inXML() { const p = Builder.parse( " " + " "); const label =