From 03b73d84be16089d532201c1cc7390b9378a9c6e Mon Sep 17 00:00:00 2001 From: Renan Lukas <14964993+RenanLukas@users.noreply.github.com> Date: Wed, 5 Jun 2024 14:32:26 -0300 Subject: [PATCH] Update ReaderTopBarMenuHelperTest --- .../utils/ReaderTopBarMenuHelperTest.kt | 21 +++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/WordPress/src/test/java/org/wordpress/android/ui/reader/utils/ReaderTopBarMenuHelperTest.kt b/WordPress/src/test/java/org/wordpress/android/ui/reader/utils/ReaderTopBarMenuHelperTest.kt index 03e57616424e..e9850dab73b1 100644 --- a/WordPress/src/test/java/org/wordpress/android/ui/reader/utils/ReaderTopBarMenuHelperTest.kt +++ b/WordPress/src/test/java/org/wordpress/android/ui/reader/utils/ReaderTopBarMenuHelperTest.kt @@ -72,6 +72,27 @@ class ReaderTopBarMenuHelperTest { assertThat(customList3Item.text).isEqualTo(UiStringText("custom-list-3")) } + @Test + fun `GIVEN custom lists has 2 items or less WHEN createMenu THEN custom lists items are shown outside a submenu`() { + val tags = ReaderTagList().apply { + add(mockFollowingTag()) // item 0 + add(mockDiscoverTag()) // item 1 + add(mockSavedTag()) // item 2 + add(mockLikedTag()) // item 3 + add(mockA8CTag()) // item 4 + add(mockFollowedP2sTag()) // item 5 + add(createCustomListTag("custom-list-1")) // item 6 + add(createCustomListTag("custom-list-2")) // item 7 + } + val menu = helper.createMenu(tags) + + val customListItem1 = menu.findSingleItem { it.id == "6" }!! + assertThat(customListItem1.text).isEqualTo(UiStringText("custom-list-1")) + + val customListItem2 = menu.findSingleItem { it.id == "7" }!! + assertThat(customListItem2.text).isEqualTo(UiStringText("custom-list-2")) + } + @Test fun `GIVEN all tags are available and tags FF enabled WHEN createMenu THEN all items are created correctly`() { whenever(readerTagsFeedFeatureConfig.isEnabled()).thenReturn(true)