@@ -4,8 +4,9 @@ import * as builder from "tns-core-modules/ui/builder";
44import { Label } from "tns-core-modules/ui/label" ;
55import { Button } from "tns-core-modules/ui/button" ;
66import { Page } from "tns-core-modules/ui/page" ;
7- import { View } from "tns-core-modules/ui/core/view" ;
7+ import { View , isIOS } from "tns-core-modules/ui/core/view" ;
88import { fromObject } from "tns-core-modules/data/observable" ;
9+ import { topmost } from "tns-core-modules/ui/frame" ;
910
1011// >> actionbar-common-require
1112import * as actionBarModule from "tns-core-modules/ui/action-bar" ;
@@ -302,6 +303,87 @@ export function test_LoadedEventsOrder_WithoutPageContent() {
302303 TKUnit . arrayAssert ( loadedEvents , new Array < string > ( "action-bar" , "page" ) ) ;
303304}
304305
306+ export function test_ActionBarVisibility_Never_ShouldNotShowDeclaredActionBar ( ) {
307+ const frame = topmost ( ) ;
308+ frame . actionBarVisibility = "never" ;
309+
310+ const page = < Page > builder . parse (
311+ `<Page>
312+ <ActionBar>
313+ <ActionBar.titleView>
314+ <Button text="test" />
315+ </ActionBar.titleView>
316+ </ActionBar>
317+ </Page>
318+ ` ) ;
319+
320+ helper . navigate ( ( ) => page ) ;
321+ let actionBarHidden = false ;
322+ if ( isIOS ) {
323+ actionBarHidden = page . actionBar . nativeView . hidden ;
324+ } else {
325+ actionBarHidden = ! page . actionBar . nativeView . isShown ( ) ;
326+ }
327+ TKUnit . assertTrue ( actionBarHidden , `ActionBar hidden: expected true, actual ${ actionBarHidden } ` ) ;
328+
329+ // restore default actionBarVisibility
330+ frame . actionBarVisibility = "auto" ;
331+ }
332+
333+ export function test_ActionBarVisibility_Always_ShouldShownHiddenActionBar ( ) {
334+ const frame = topmost ( ) ;
335+ frame . actionBarVisibility = "always" ;
336+
337+ const page = < Page > builder . parse (
338+ `<Page actionBarHidden="true">
339+ <ActionBar>
340+ <ActionBar.titleView>
341+ <Button text="test" />
342+ </ActionBar.titleView>
343+ </ActionBar>
344+ </Page>
345+ ` ) ;
346+
347+ helper . navigate ( ( ) => page ) ;
348+ let actionBarHidden = false ;
349+ if ( isIOS ) {
350+ actionBarHidden = page . actionBar . nativeView . hidden ;
351+ } else {
352+ actionBarHidden = ! page . actionBar . nativeView . isShown ( ) ;
353+ }
354+ TKUnit . assertFalse ( actionBarHidden , `ActionBar hidden: expected false, actual ${ actionBarHidden } ` ) ;
355+
356+ // restore default actionBarVisibility
357+ frame . actionBarVisibility = "auto" ;
358+ }
359+
360+ export function test_ActionBarVisibility_Auto_ShouldRespectPageActionBarHiddenProperty ( ) {
361+ const frame = topmost ( ) ;
362+ frame . actionBarVisibility = "auto" ;
363+
364+ const page = < Page > builder . parse (
365+ `<Page actionBarHidden="true">
366+ <ActionBar>
367+ <ActionBar.titleView>
368+ <Button text="test" />
369+ </ActionBar.titleView>
370+ </ActionBar>
371+ </Page>
372+ ` ) ;
373+
374+ helper . navigate ( ( ) => page ) ;
375+ let actionBarHidden = false ;
376+ if ( isIOS ) {
377+ actionBarHidden = page . actionBar . nativeView . hidden ;
378+ } else {
379+ actionBarHidden = ! page . actionBar . nativeView . isShown ( ) ;
380+ }
381+ TKUnit . assertTrue ( actionBarHidden , `ActionBar hidden: expected true, actual ${ actionBarHidden } ` ) ;
382+
383+ // restore default actionBarVisibility
384+ frame . actionBarVisibility = "auto" ;
385+ }
386+
305387export function test_setId ( ) {
306388 const pageFactory = function ( ) : Page {
307389 const page = new Page ( ) ;
0 commit comments