Skip to content

Commit

Permalink
Fix Globe icon not always shown (#5586)
Browse files Browse the repository at this point in the history
Task/Issue URL:https://app.asana.com/0/1205008441501016/1209289567264349

### Description
Fix Globe icon not always shown on error pages

### Steps to test this PR

_Feature 1_
- [ ] Open
https://privacy-test-pages.site/security/badware/phishing.html
- [ ] On the error page, try focusing the omnibar, clearing text,
opening and closing the context menu
- [ ] Check the icon is still the globe one
- [ ] Repeat the process for error view and SSL warning as well

### UI changes
| Before  | After |
| ------ | ----- |
!(Upload before screenshot)|(Upload after screenshot)|
  • Loading branch information
CrisBarreiro authored Feb 4, 2025
1 parent 14d78cf commit 58f7566
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -310,6 +310,7 @@ class OmnibarLayoutViewModel @Inject constructor(

_viewState.update {
it.copy(
viewMode = viewMode,
leadingIconState = leadingIcon,
scrollingEnabled = scrollingEnabled,
showVoiceSearch = shouldShowVoiceSearch(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -287,6 +287,7 @@ class OmnibarLayoutViewModelTest {
val viewState = awaitItem()
assertTrue(viewState.leadingIconState == LeadingIconState.GLOBE)
assertTrue(viewState.scrollingEnabled)
assertTrue(viewState.viewMode is ViewMode.Error)
}
}

Expand All @@ -298,6 +299,7 @@ class OmnibarLayoutViewModelTest {
val viewState = awaitItem()
assertTrue(viewState.leadingIconState == LeadingIconState.GLOBE)
assertTrue(viewState.scrollingEnabled)
assertTrue(viewState.viewMode is ViewMode.SSLWarning)
}
}

Expand All @@ -309,6 +311,7 @@ class OmnibarLayoutViewModelTest {
val viewState = awaitItem()
assertTrue(viewState.leadingIconState == LeadingIconState.GLOBE)
assertTrue(viewState.scrollingEnabled)
assertTrue(viewState.viewMode is ViewMode.MaliciousSiteWarning)
}
}

Expand All @@ -320,6 +323,7 @@ class OmnibarLayoutViewModelTest {
val viewState = awaitItem()
assertTrue(viewState.leadingIconState == LeadingIconState.SEARCH)
assertFalse(viewState.scrollingEnabled)
assertTrue(viewState.viewMode is ViewMode.NewTab)
}
}

Expand All @@ -331,6 +335,7 @@ class OmnibarLayoutViewModelTest {
val viewState = awaitItem()
assertTrue(viewState.leadingIconState == LeadingIconState.SEARCH)
assertTrue(viewState.scrollingEnabled)
assertTrue(viewState.viewMode is ViewMode.Browser)
}
}

Expand All @@ -342,6 +347,7 @@ class OmnibarLayoutViewModelTest {
testee.viewState.test {
val viewState = expectMostRecentItem()
assertTrue(viewState.leadingIconState == LeadingIconState.SEARCH)
assertTrue(viewState.viewMode is ViewMode.Error)
}
}

Expand All @@ -353,6 +359,7 @@ class OmnibarLayoutViewModelTest {
testee.viewState.test {
val viewState = expectMostRecentItem()
assertTrue(viewState.leadingIconState == LeadingIconState.SEARCH)
assertTrue(viewState.viewMode is ViewMode.SSLWarning)
}
}

Expand All @@ -364,6 +371,7 @@ class OmnibarLayoutViewModelTest {
testee.viewState.test {
val viewState = expectMostRecentItem()
assertTrue(viewState.leadingIconState == LeadingIconState.SEARCH)
assertTrue(viewState.viewMode is ViewMode.MaliciousSiteWarning)
}
}

Expand All @@ -375,6 +383,7 @@ class OmnibarLayoutViewModelTest {
testee.viewState.test {
val viewState = expectMostRecentItem()
assertTrue(viewState.leadingIconState == LeadingIconState.SEARCH)
assertTrue(viewState.viewMode is ViewMode.NewTab)
}
}

Expand All @@ -386,6 +395,7 @@ class OmnibarLayoutViewModelTest {
testee.viewState.test {
val viewState = awaitItem()
assertTrue(viewState.leadingIconState == LeadingIconState.SEARCH)
assertTrue(viewState.viewMode is ViewMode.Browser)
}
}

Expand Down

0 comments on commit 58f7566

Please sign in to comment.