@@ -710,6 +710,96 @@ define(function (require, exports, module) {
710710 await cleanupTrialState ( ) ;
711711 }
712712 } ) ;
713+
714+ if ( Phoenix . isNativeApp ) {
715+ it ( "should show device-licensed Pro branding and popup when not logged in" , async function ( ) {
716+ console . log ( "llgT: Starting device license Pro branding test" ) ;
717+
718+ try {
719+ // Setup: Enable device license flag
720+ LoginServiceExports . setIsLicensedDevice ( true ) ;
721+
722+ // Setup mock that handles device ID requests (returns Pro entitlements)
723+ setupProUserMock ( true , false ) ;
724+
725+ // Ensure no trial is active
726+ await cleanupTrialState ( ) ;
727+
728+ // Ensure user is logged out
729+ if ( LoginServiceExports . LoginService . isLoggedIn ( ) ) {
730+ await performFullLogoutFlow ( ) ;
731+ }
732+
733+ // Clear and refresh entitlements to trigger device license check
734+ await LoginServiceExports . LoginService . clearEntitlements ( ) ;
735+ await LoginServiceExports . LoginService . getEffectiveEntitlements ( true ) ;
736+
737+ // Wait for branding to update in the navbar
738+ await awaitsFor (
739+ function ( ) {
740+ const $branding = testWindow . $ ( "#phcode-io-main-nav" ) ;
741+ return $branding . hasClass ( "phoenix-pro" ) ;
742+ } ,
743+ "navbar branding to show Phoenix Pro" ,
744+ 3000
745+ ) ;
746+
747+ // Verify navbar shows Pro branding (uses plan.name)
748+ await verifyProBranding ( true , "device license shows Phoenix Pro branding in navbar" ) ;
749+
750+ // Verify entitlements API shows Pro access
751+ await verifyPlanEntitlements (
752+ { paidSubscriber : true , name : "Phoenix Pro" } ,
753+ "device license provides Pro plan"
754+ ) ;
755+ await verifyIsInProTrialEntitlement ( false , "device license is not a trial" ) ;
756+ await verifyLiveEditEntitlement ( { activated : true } , "live edit activated via device license" ) ;
757+
758+ // Verify raw entitlements are present (not null)
759+ const rawEntitlements = await EntitlementsExports . getRawEntitlements ( ) ;
760+ expect ( rawEntitlements ) . toBeDefined ( ) ;
761+ expect ( rawEntitlements ) . not . toBeNull ( ) ;
762+ expect ( rawEntitlements . plan . paidSubscriber ) . toBe ( true ) ;
763+
764+ // Verify login popup shows Pro branding with fullName
765+ const $profileButton = testWindow . $ ( "#user-profile-button" ) ;
766+ $profileButton . trigger ( 'click' ) ;
767+ await popupToAppear ( SIGNIN_POPUP ) ;
768+
769+ // Wait for Pro branding to appear in popup (async entitlements load)
770+ await awaitsFor (
771+ function ( ) {
772+ const $popup = testWindow . $ ( '.profile-popup' ) ;
773+ const $proInfo = $popup . find ( '.trial-plan-info' ) ;
774+ return $proInfo . length > 0 ;
775+ } ,
776+ "Pro branding to appear in login popup" ,
777+ 3000
778+ ) ;
779+
780+ // Check for Pro branding in popup (uses plan.fullName)
781+ const $popup = testWindow . $ ( '.profile-popup' ) ;
782+ const $proInfo = $popup . find ( '.trial-plan-info' ) ;
783+ expect ( $proInfo . length ) . toBe ( 1 ) ;
784+
785+ const proText = $proInfo . text ( ) ;
786+ expect ( proText ) . toContain ( "Phoenix Pro Test Edu" ) ;
787+
788+ // Verify feather icon is present
789+ const $featherIcon = $proInfo . find ( '.fa-feather' ) ;
790+ expect ( $featherIcon . length ) . toBe ( 1 ) ;
791+
792+ // Close popup
793+ $profileButton . trigger ( 'click' ) ;
794+
795+ console . log ( "llgT: Device license Pro branding test completed successfully" ) ;
796+ } finally {
797+ // Cleanup: Reset device license flag
798+ LoginServiceExports . setIsLicensedDevice ( false ) ;
799+ await LoginServiceExports . LoginService . clearEntitlements ( ) ;
800+ }
801+ } ) ;
802+ }
713803 }
714804
715805 exports . setup = setup ;
0 commit comments