@@ -459,6 +459,8 @@ class BrowserTabViewModelTest {
459459
460460 private val mockDuckAiFeatureStateInputScreenOpenAutomaticallyFlow = MutableStateFlow (false )
461461
462+ private val mockDuckAiFeatureStateFullScreenModeFlow = MutableStateFlow (false )
463+
462464 private val mockExternalIntentProcessingState: ExternalIntentProcessingState = mock()
463465
464466 private val mockVpnMenuStateProvider: VpnMenuStateProvider = mock()
@@ -607,6 +609,7 @@ class BrowserTabViewModelTest {
607609
608610 private val exampleUrl = " http://example.com"
609611 private val shortExampleUrl = " example.com"
612+ private val duckChatURL = " https://duckduckgo.com/?q=DuckDuckGo+AI+Chat&ia=chat&duckai=5"
610613
611614 private val selectedTab = TabEntity (" TAB_ID" , exampleUrl, position = 0 , sourceTabId = " TAB_ID_SOURCE" )
612615 private val flowSelectedTab = MutableStateFlow (selectedTab)
@@ -692,6 +695,7 @@ class BrowserTabViewModelTest {
692695 whenever(mockDuckAiFeatureState.showPopupMenuShortcut).thenReturn(MutableStateFlow (false ))
693696 whenever(mockDuckAiFeatureState.showInputScreen).thenReturn(mockDuckAiFeatureStateInputScreenFlow)
694697 whenever(mockDuckAiFeatureState.showInputScreenAutomaticallyOnNewTab).thenReturn(mockDuckAiFeatureStateInputScreenOpenAutomaticallyFlow)
698+ whenever(mockDuckAiFeatureState.showFullScreenMode).thenReturn(mockDuckAiFeatureStateFullScreenModeFlow)
695699 whenever(mockExternalIntentProcessingState.hasPendingTabLaunch).thenReturn(mockHasPendingTabLaunchFlow)
696700 whenever(mockExternalIntentProcessingState.hasPendingDuckAiOpen).thenReturn(mockHasPendingDuckAiOpenFlow)
697701 whenever(mockVpnMenuStateProvider.getVpnMenuState()).thenReturn(flowOf(VpnMenuState .Hidden ))
@@ -765,6 +769,8 @@ class BrowserTabViewModelTest {
765769
766770 fakeContentScopeScriptsSubscriptionEventPluginPoint = FakeContentScopeScriptsSubscriptionEventPluginPoint ()
767771
772+ whenever(mockDuckChat.getDuckChatUrl(any(), any())).thenReturn(duckChatURL)
773+
768774 testee =
769775 BrowserTabViewModel (
770776 statisticsUpdater = mockStatisticsUpdater,
@@ -6341,6 +6347,22 @@ class BrowserTabViewModelTest {
63416347 verify(mockDuckChat).openDuckChat()
63426348 }
63436349
6350+ @Test
6351+ fun whenDuckChatMenuItemClickedAndFullScreenModeThenDontOpenDuckChatScreen () =
6352+ runTest {
6353+ mockDuckAiFeatureStateFullScreenModeFlow.emit(true )
6354+ whenever(mockDuckChat.wasOpenedBefore()).thenReturn(false )
6355+ whenever(mockOmnibarConverter.convertQueryToUrl(duckChatURL, null )).thenReturn(duckChatURL)
6356+
6357+ testee.onDuckChatMenuClicked()
6358+
6359+ verify(mockCommandObserver, atLeastOnce()).onChanged(commandCaptor.capture())
6360+
6361+ assertTrue(commandCaptor.lastValue is Navigate )
6362+
6363+ verify(mockDuckChat, never()).openDuckChat()
6364+ }
6365+
63446366 @Test
63456367 fun whenDuckChatMenuItemClickedAndItWasUsedBeforeThenOpenDuckChatAndSendPixel () =
63466368 runTest {
0 commit comments