@@ -365,13 +365,13 @@ class BrowserTabViewModelTest {
365365
366366 @Test
367367 fun whenViewModelNotifiedThatUrlGotFocusThenViewStateIsUpdated () {
368- testee.onOmnibarInputStateChanged(" " , true )
368+ testee.onOmnibarInputStateChanged(" " , true , hasQueryChanged = false )
369369 assertTrue(omnibarViewState().isEditing)
370370 }
371371
372372 @Test
373373 fun whenViewModelNotifiedThatUrlLostFocusThenViewStateIsUpdated () {
374- testee.onOmnibarInputStateChanged(" " , false )
374+ testee.onOmnibarInputStateChanged(" " , false , hasQueryChanged = false )
375375 assertFalse(omnibarViewState().isEditing)
376376 }
377377
@@ -468,27 +468,27 @@ class BrowserTabViewModelTest {
468468 fun whenOmnibarInputDoesNotHaveFocusAndAppConfigDownloadedAndBrowserShownThenPrivacyGradeIsShown () {
469469 testee.onUserSubmittedQuery(" foo" )
470470 testee.appConfigurationObserver.onChanged(AppConfigurationEntity (appConfigurationDownloaded = true ))
471- testee.onOmnibarInputStateChanged(query = " " , hasFocus = false )
471+ testee.onOmnibarInputStateChanged(query = " " , hasFocus = false , hasQueryChanged = false )
472472 assertTrue(browserViewState().showPrivacyGrade)
473473 }
474474
475475 @Test
476476 fun whenOmnibarInputDoesNotHaveFocusAndAppConfigDownloadedButBrowserNotShownThenPrivacyGradeIsHidden () {
477477 testee.appConfigurationObserver.onChanged(AppConfigurationEntity (appConfigurationDownloaded = true ))
478- testee.onOmnibarInputStateChanged(query = " " , hasFocus = false )
478+ testee.onOmnibarInputStateChanged(query = " " , hasFocus = false , hasQueryChanged = false )
479479 assertFalse(browserViewState().showPrivacyGrade)
480480 }
481481
482482 @Test
483483 fun whenOmnibarInputDoesNotHaveFocusAndAppConfigNotDownloadedThenPrivacyGradeIsNotShown () {
484484 testee.appConfigurationObserver.onChanged(AppConfigurationEntity (appConfigurationDownloaded = false ))
485- testee.onOmnibarInputStateChanged(" " , false )
485+ testee.onOmnibarInputStateChanged(" " , false , hasQueryChanged = false )
486486 assertFalse(browserViewState().showPrivacyGrade)
487487 }
488488
489489 @Test
490490 fun whenOmnibarInputHasFocusThenPrivacyGradeIsNotShown () {
491- testee.onOmnibarInputStateChanged(" " , true )
491+ testee.onOmnibarInputStateChanged(" " , true , hasQueryChanged = false )
492492 assertFalse(browserViewState().showPrivacyGrade)
493493 }
494494
@@ -499,25 +499,25 @@ class BrowserTabViewModelTest {
499499
500500 @Test
501501 fun whenOmnibarInputDoesNotHaveFocusAndHasQueryThenFireButtonIsShown () {
502- testee.onOmnibarInputStateChanged(" query" , false )
502+ testee.onOmnibarInputStateChanged(" query" , false , hasQueryChanged = false )
503503 assertTrue(browserViewState().showFireButton)
504504 }
505505
506506 @Test
507507 fun whenOmnibarInputDoesNotHaveFocusOrQueryThenFireButtonIsShown () {
508- testee.onOmnibarInputStateChanged(" " , false )
508+ testee.onOmnibarInputStateChanged(" " , false , hasQueryChanged = false )
509509 assertTrue(browserViewState().showFireButton)
510510 }
511511
512512 @Test
513513 fun whenOmnibarInputHasFocusAndNoQueryThenFireButtonIsShown () {
514- testee.onOmnibarInputStateChanged(" " , true )
514+ testee.onOmnibarInputStateChanged(" " , true , hasQueryChanged = false )
515515 assertTrue(browserViewState().showFireButton)
516516 }
517517
518518 @Test
519519 fun whenOmnibarInputHasFocusAndQueryThenFireButtonIsHidden () {
520- testee.onOmnibarInputStateChanged(" query" , true )
520+ testee.onOmnibarInputStateChanged(" query" , true , hasQueryChanged = false )
521521 assertFalse(browserViewState().showFireButton)
522522 }
523523
@@ -528,25 +528,25 @@ class BrowserTabViewModelTest {
528528
529529 @Test
530530 fun whenOmnibarInputDoesNotHaveFocusOrQueryThenTabsButtonIsShown () {
531- testee.onOmnibarInputStateChanged(" " , false )
531+ testee.onOmnibarInputStateChanged(" " , false , hasQueryChanged = false )
532532 assertTrue(browserViewState().showTabsButton)
533533 }
534534
535535 @Test
536536 fun whenOmnibarInputDoesNotHaveFocusAndHasQueryThenTabsButtonIsShown () {
537- testee.onOmnibarInputStateChanged(" query" , false )
537+ testee.onOmnibarInputStateChanged(" query" , false , hasQueryChanged = false )
538538 assertTrue(browserViewState().showTabsButton)
539539 }
540540
541541 @Test
542542 fun whenOmnibarInputHasFocusAndNoQueryThenTabsButtonIsShown () {
543- testee.onOmnibarInputStateChanged(" " , true )
543+ testee.onOmnibarInputStateChanged(" " , true , hasQueryChanged = false )
544544 assertTrue(browserViewState().showTabsButton)
545545 }
546546
547547 @Test
548548 fun whenOmnibarInputHasFocusAndQueryThenTabsButtonIsHidden () {
549- testee.onOmnibarInputStateChanged(" query" , true )
549+ testee.onOmnibarInputStateChanged(" query" , true , hasQueryChanged = false )
550550 assertFalse(browserViewState().showTabsButton)
551551 }
552552
@@ -557,53 +557,60 @@ class BrowserTabViewModelTest {
557557
558558 @Test
559559 fun whenOmnibarInputDoesNotHaveFocusOrQueryThenMenuButtonIsShown () {
560- testee.onOmnibarInputStateChanged(" " , false )
560+ testee.onOmnibarInputStateChanged(" " , false , hasQueryChanged = false )
561561 assertTrue(browserViewState().showMenuButton)
562562 }
563563
564564 @Test
565565 fun whenOmnibarInputDoesNotHaveFocusAndHasQueryThenMenuButtonIsShown () {
566- testee.onOmnibarInputStateChanged(" query" , false )
566+ testee.onOmnibarInputStateChanged(" query" , false , hasQueryChanged = false )
567567 assertTrue(browserViewState().showMenuButton)
568568 }
569569
570570 @Test
571571 fun whenOmnibarInputHasFocusAndNoQueryThenMenuButtonIsShown () {
572- testee.onOmnibarInputStateChanged(" " , true )
572+ testee.onOmnibarInputStateChanged(" " , true , hasQueryChanged = false )
573573 assertTrue(browserViewState().showMenuButton)
574574 }
575575
576576 @Test
577577 fun whenOmnibarInputHasFocusAndQueryThenMenuButtonIsHidden () {
578- testee.onOmnibarInputStateChanged(" query" , true )
578+ testee.onOmnibarInputStateChanged(" query" , true , hasQueryChanged = false )
579579 assertFalse(browserViewState().showMenuButton)
580580 }
581581
582582 @Test
583583 fun whenEnteringQueryWithAutoCompleteEnabledThenAutoCompleteSuggestionsShown () {
584584 doReturn(true ).whenever(mockSettingsStore).autoCompleteSuggestionsEnabled
585- testee.onOmnibarInputStateChanged(" foo" , true )
585+ testee.onOmnibarInputStateChanged(" foo" , true , hasQueryChanged = true )
586586 assertTrue(autoCompleteViewState().showSuggestions)
587587 }
588588
589+ @Test
590+ fun whenOmnibarInputStateChangedWithAutoCompleteEnabledButNoQueryChangeThenAutoCompleteSuggestionsNotShown () {
591+ doReturn(true ).whenever(mockSettingsStore).autoCompleteSuggestionsEnabled
592+ testee.onOmnibarInputStateChanged(" foo" , true , hasQueryChanged = false )
593+ assertFalse(autoCompleteViewState().showSuggestions)
594+ }
595+
589596 @Test
590597 fun whenEnteringQueryWithAutoCompleteDisabledThenAutoCompleteSuggestionsNotShown () {
591598 doReturn(false ).whenever(mockSettingsStore).autoCompleteSuggestionsEnabled
592- testee.onOmnibarInputStateChanged(" foo" , true )
599+ testee.onOmnibarInputStateChanged(" foo" , true , hasQueryChanged = true )
593600 assertFalse(autoCompleteViewState().showSuggestions)
594601 }
595602
596603 @Test
597604 fun whenEnteringEmptyQueryWithAutoCompleteEnabledThenAutoCompleteSuggestionsNotShown () {
598605 doReturn(true ).whenever(mockSettingsStore).autoCompleteSuggestionsEnabled
599- testee.onOmnibarInputStateChanged(" " , true )
606+ testee.onOmnibarInputStateChanged(" " , true , hasQueryChanged = true )
600607 assertFalse(autoCompleteViewState().showSuggestions)
601608 }
602609
603610 @Test
604611 fun whenEnteringEmptyQueryWithAutoCompleteDisabledThenAutoCompleteSuggestionsNotShown () {
605612 doReturn(false ).whenever(mockSettingsStore).autoCompleteSuggestionsEnabled
606- testee.onOmnibarInputStateChanged(" " , true )
613+ testee.onOmnibarInputStateChanged(" " , true , hasQueryChanged = true )
607614 assertFalse(autoCompleteViewState().showSuggestions)
608615 }
609616
0 commit comments