@@ -684,5 +684,206 @@ describe('composeDeviceConfig', () => {
684684 } ) ;
685685 } ) ;
686686
687+ describe ( 'systemUI property validation' , ( ) => {
688+ beforeEach ( ( ) => {
689+ setConfig ( 'android.emulator' , 'aliased' ) ;
690+ givenConfigValidationSuccess ( ) ;
691+ } ) ;
692+
693+ describe ( 'valid configurations' , ( ) => {
694+ it ( 'should accept string "minimal"' , ( ) => {
695+ deviceConfig . systemUI = 'minimal' ;
696+ expect ( compose ) . not . toThrow ( ) ;
697+ } ) ;
698+
699+ it ( 'should accept string "genymotion"' , ( ) => {
700+ deviceConfig . systemUI = 'genymotion' ;
701+ expect ( compose ) . not . toThrow ( ) ;
702+ } ) ;
703+
704+ it ( 'should accept object with all properties' , ( ) => {
705+ deviceConfig . systemUI = {
706+ keyboard : 'hide' ,
707+ touches : 'show' ,
708+ pointerLocationBar : 'hide' ,
709+ navigationMode : '3-button' ,
710+ statusBar : {
711+ notifications : 'hide' ,
712+ wifiSignal : 'strong' ,
713+ cellSignal : 'strong' ,
714+ networkBar : 'hidden' ,
715+ batteryLevel : 'full' ,
716+ charging : true ,
717+ clock : '1234' ,
718+ } ,
719+ } ;
720+ expect ( compose ) . not . toThrow ( ) ;
721+ } ) ;
722+
723+ it ( 'should accept object with extends property (minimal)' , ( ) => {
724+ deviceConfig . systemUI = {
725+ extends : 'minimal' ,
726+ navigationMode : 'gesture' ,
727+ statusBar : {
728+ charging : false ,
729+ } ,
730+ } ;
731+ expect ( compose ) . not . toThrow ( ) ;
732+ } ) ;
733+
734+ it ( 'should accept object with extends property (genymotion)' , ( ) => {
735+ deviceConfig . systemUI = {
736+ extends : 'genymotion' ,
737+ keyboard : 'show' ,
738+ statusBar : {
739+ notifications : 'show' ,
740+ } ,
741+ } ;
742+ expect ( compose ) . not . toThrow ( ) ;
743+ } ) ;
744+
745+ it ( 'should accept partial object configuration' , ( ) => {
746+ deviceConfig . systemUI = {
747+ keyboard : 'hide' ,
748+ touches : 'show' ,
749+ } ;
750+ expect ( compose ) . not . toThrow ( ) ;
751+ } ) ;
752+
753+ it ( 'should accept empty object' , ( ) => {
754+ deviceConfig . systemUI = { } ;
755+ expect ( compose ) . not . toThrow ( ) ;
756+ } ) ;
757+
758+ it ( 'should accept valid statusBar.clock format' , ( ) => {
759+ deviceConfig . systemUI = {
760+ statusBar : {
761+ clock : '1234' ,
762+ } ,
763+ } ;
764+ expect ( compose ) . not . toThrow ( ) ;
765+ } ) ;
766+
767+ it ( 'should accept valid statusBar.cellSignal values' , ( ) => {
768+ [ 'strong' , 'weak' , 'none' ] . forEach ( cellSignal => {
769+ deviceConfig . systemUI = {
770+ statusBar : {
771+ cellSignal,
772+ } ,
773+ } ;
774+ expect ( compose ) . not . toThrow ( ) ;
775+ } ) ;
776+ } ) ;
777+ } ) ;
778+
779+ describe ( 'invalid configurations' , ( ) => {
780+ it ( 'should reject non-string, non-object values' , ( ) => {
781+ deviceConfig . systemUI = 42 ;
782+ expect ( compose ) . toThrow ( "Expected 'minimal', 'genymotion' or an object" ) ;
783+ } ) ;
784+
785+ it ( 'should reject invalid string values' , ( ) => {
786+ deviceConfig . systemUI = 'invalid' ;
787+ expect ( compose ) . toThrow ( "Expected 'minimal', 'genymotion' or an object" ) ;
788+ } ) ;
789+
790+ it ( 'should reject invalid extends value' , ( ) => {
791+ deviceConfig . systemUI = { extends : 'invalid' } ;
792+ expect ( compose ) . toThrow ( "Expected 'minimal', 'genymotion' or an object" ) ;
793+ } ) ;
794+
795+ it ( 'should reject invalid keyboard value' , ( ) => {
796+ deviceConfig . systemUI = { keyboard : 'invalid' } ;
797+ expect ( compose ) . toThrow ( "Expected 'minimal', 'genymotion' or an object" ) ;
798+ } ) ;
799+
800+ it ( 'should reject invalid touches value' , ( ) => {
801+ deviceConfig . systemUI = { touches : 'invalid' } ;
802+ expect ( compose ) . toThrow ( "Expected 'minimal', 'genymotion' or an object" ) ;
803+ } ) ;
804+
805+ it ( 'should reject invalid pointerLocationBar value' , ( ) => {
806+ deviceConfig . systemUI = { pointerLocationBar : 'invalid' } ;
807+ expect ( compose ) . toThrow ( "Expected 'minimal', 'genymotion' or an object" ) ;
808+ } ) ;
809+
810+ it ( 'should reject invalid navigationMode value' , ( ) => {
811+ deviceConfig . systemUI = { navigationMode : 'invalid' } ;
812+ expect ( compose ) . toThrow ( "Expected 'minimal', 'genymotion' or an object" ) ;
813+ } ) ;
814+
815+ it ( 'should reject non-object statusBar' , ( ) => {
816+ deviceConfig . systemUI = { statusBar : 'invalid' } ;
817+ expect ( compose ) . toThrow ( "Expected 'minimal', 'genymotion' or an object" ) ;
818+ } ) ;
819+
820+ it ( 'should reject invalid statusBar.notifications' , ( ) => {
821+ deviceConfig . systemUI = { statusBar : { notifications : 'invalid' } } ;
822+ expect ( compose ) . toThrow ( "Expected 'minimal', 'genymotion' or an object" ) ;
823+ } ) ;
824+
825+ it ( 'should reject invalid statusBar.wifiSignal' , ( ) => {
826+ deviceConfig . systemUI = { statusBar : { wifiSignal : 'invalid' } } ;
827+ expect ( compose ) . toThrow ( "Expected 'minimal', 'genymotion' or an object" ) ;
828+ } ) ;
829+
830+ it ( 'should reject invalid statusBar.cellSignal' , ( ) => {
831+ deviceConfig . systemUI = { statusBar : { cellSignal : 'invalid' } } ;
832+ expect ( compose ) . toThrow ( "Expected 'minimal', 'genymotion' or an object" ) ;
833+ } ) ;
834+
835+ it ( 'should reject invalid statusBar.batteryLevel' , ( ) => {
836+ deviceConfig . systemUI = { statusBar : { batteryLevel : 'invalid' } } ;
837+ expect ( compose ) . toThrow ( "Expected 'minimal', 'genymotion' or an object" ) ;
838+ } ) ;
839+
840+ it ( 'should reject invalid statusBar.charging' , ( ) => {
841+ deviceConfig . systemUI = { statusBar : { charging : 'invalid' } } ;
842+ expect ( compose ) . toThrow ( "Expected 'minimal', 'genymotion' or an object" ) ;
843+ } ) ;
844+
845+ it ( 'should reject invalid statusBar.clock (non-string)' , ( ) => {
846+ deviceConfig . systemUI = { statusBar : { clock : 1234 } } ;
847+ expect ( compose ) . toThrow ( "Expected 'minimal', 'genymotion' or an object" ) ;
848+ } ) ;
849+
850+ it ( 'should reject invalid statusBar.clock (wrong format)' , ( ) => {
851+ deviceConfig . systemUI = { statusBar : { clock : 'invalid' } } ;
852+ expect ( compose ) . toThrow ( "Expected 'minimal', 'genymotion' or an object" ) ;
853+ } ) ;
854+
855+ it ( 'should accept statusBar.clock' , ( ) => {
856+ deviceConfig . systemUI = { statusBar : { clock : '1234' } } ;
857+ expect ( compose ) . not . toThrow ( ) ;
858+ } ) ;
859+ } ) ;
860+
861+ describe ( 'device type restrictions' , ( ) => {
862+ it ( 'should reject systemUI for ios.simulator' , ( ) => {
863+ setConfig ( 'ios.simulator' , 'aliased' ) ;
864+ deviceConfig . systemUI = 'minimal' ;
865+ expect ( compose ) . toThrow ( 'does not support "systemUI" property' ) ;
866+ } ) ;
867+
868+ it ( 'should accept systemUI for android.attached' , ( ) => {
869+ setConfig ( 'android.attached' , 'aliased' ) ;
870+ deviceConfig . systemUI = 'minimal' ;
871+ expect ( compose ) . not . toThrow ( ) ;
872+ } ) ;
873+
874+ it ( 'should accept systemUI for android.emulator' , ( ) => {
875+ setConfig ( 'android.emulator' , 'aliased' ) ;
876+ deviceConfig . systemUI = 'minimal' ;
877+ expect ( compose ) . not . toThrow ( ) ;
878+ } ) ;
879+
880+ it ( 'should accept systemUI for android.genycloud' , ( ) => {
881+ setConfig ( 'android.genycloud' , 'aliased' ) ;
882+ deviceConfig . systemUI = 'minimal' ;
883+ expect ( compose ) . not . toThrow ( ) ;
884+ } ) ;
885+ } ) ;
886+ } ) ;
887+
687888 } ) ;
688889} ) ;
0 commit comments