-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
added title and subtitle testIds (#7866)
--------- Co-authored-by: d4vidi <[email protected]>
- Loading branch information
Showing
11 changed files
with
128 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
51 changes: 51 additions & 0 deletions
51
lib/android/app/src/test/java/com/reactnativenavigation/views/TitleSubTitleLayoutTest.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
package com.reactnativenavigation.views | ||
|
||
import android.app.Activity | ||
import android.view.ViewGroup | ||
import android.widget.FrameLayout | ||
import com.reactnativenavigation.BaseTest | ||
import com.reactnativenavigation.views.stack.topbar.titlebar.TitleSubTitleLayout | ||
import org.assertj.core.api.AssertionsForInterfaceTypes.* | ||
import org.junit.Test | ||
|
||
private const val UUT_WIDTH = 1000 | ||
private const val UUT_HEIGHT = 100 | ||
|
||
|
||
class TitleSubTitleLayoutTest : BaseTest() { | ||
private val testId = "mock-testId" | ||
|
||
lateinit var uut: TitleSubTitleLayout | ||
private lateinit var activity: Activity | ||
|
||
override fun beforeEach() { | ||
super.beforeEach() | ||
setup() | ||
} | ||
|
||
private fun setup() { | ||
activity = newActivity() | ||
|
||
uut = TitleSubTitleLayout(activity) | ||
|
||
activity.setContentView(FrameLayout(activity).apply { | ||
addView(uut, ViewGroup.LayoutParams(UUT_WIDTH, UUT_HEIGHT)) | ||
}) | ||
idleMainLooper() | ||
} | ||
|
||
@Test | ||
fun `should set Test ID canonically`(){ | ||
uut.setTestId(testId) | ||
assertThat(uut.getTitleTxtView().tag).isEqualTo("$testId.title") | ||
assertThat(uut.getSubTitleTxtView().tag).isEqualTo("$testId.subtitle") | ||
} | ||
|
||
@Test | ||
fun `should clear test ID`() { | ||
uut.setTestId(testId) | ||
uut.setTestId("") | ||
assertThat(uut.getTitleTxtView().tag).isNull() | ||
assertThat(uut.getSubTitleTxtView().tag).isNull() | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters