Skip to content

Commit

Permalink
feat(kakao): reordering matchers
Browse files Browse the repository at this point in the history
  • Loading branch information
Vacxe committed Jul 3, 2023
1 parent 279170b commit 9321378
Show file tree
Hide file tree
Showing 6 changed files with 32 additions and 27 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,10 @@ open class KBaseView<T> : KDSLView<T>, BaseActions, BaseAssertions, Interceptabl
* @see ViewBuilder
*/
constructor(parent: Matcher<View>, function: ViewBuilder.() -> Unit) :
this({
isDescendantOfA { withMatcher(parent) }
function(this)
this(
{
isDescendantOfA { withMatcher(parent) }
function(this)
})

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,22 +19,22 @@ class KTextInputLayout : KBaseView<KTextInputLayout>, TextInputLayoutAssertions

constructor(function: ViewBuilder.() -> Unit) : super(function) {
edit = KEditText {
isDescendantOfA(function)
isAssignableFrom(EditText::class.java)
isDescendantOfA(function)
}
}

constructor(parent: Matcher<View>, function: ViewBuilder.() -> Unit) : super(parent, function) {
edit = KEditText {
isDescendantOfA(function)
isAssignableFrom(EditText::class.java)
isDescendantOfA(function)
}
}

constructor(parent: DataInteraction, function: ViewBuilder.() -> Unit) : super(parent, function) {
edit = KEditText {
isDescendantOfA(function)
isAssignableFrom(EditText::class.java)
isDescendantOfA(function)
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -60,10 +60,11 @@ class KAbsListView : ScrollViewActions, AbsListViewAdapterActions, BaseAssertion
constructor(
parent: Matcher<View>, builder: ViewBuilder.() -> Unit,
itemTypeBuilder: KAdapterItemTypeBuilder.() -> Unit
) : this({
isDescendantOfA { withMatcher(parent) }
builder(this)
}, itemTypeBuilder)
) : this(
{
builder(this)
isDescendantOfA { withMatcher(parent) }
}, itemTypeBuilder)

/**
* Constructs view class with parent and view interaction from given ViewBuilder
Expand All @@ -84,7 +85,7 @@ class KAbsListView : ScrollViewActions, AbsListViewAdapterActions, BaseAssertion

val vb = ViewBuilder().apply {
isDescendantOfA { withMatcher(parentMatcher as Matcher<View>) }
builder(this)

}

matcher = vb.getViewMatcher()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,10 +56,11 @@ class KViewPager2 : ViewPager2Actions, ViewPager2AdapterAssertions, SwipeableAct
constructor(
parent: Matcher<View>, builder: ViewBuilder.() -> Unit,
itemTypeBuilder: KViewPagerItemTypeBuilder.() -> Unit
) : this({
isDescendantOfA { withMatcher(parent) }
builder(this)
}, itemTypeBuilder)
) : this(
{
builder(this)
isDescendantOfA { withMatcher(parent) }
}, itemTypeBuilder)

/**
* Constructs view class with parent and view interaction from given ViewBuilder
Expand All @@ -79,8 +80,8 @@ class KViewPager2 : ViewPager2Actions, ViewPager2AdapterAssertions, SwipeableAct
val parentMatcher = makeTargetMatcher.invoke(parent)

val vb = ViewBuilder().apply {
isDescendantOfA { withMatcher(parentMatcher as Matcher<View>) }
builder(this)
isDescendantOfA { withMatcher(parentMatcher as Matcher<View>) }
}

matcher = vb.getViewMatcher()
Expand All @@ -106,8 +107,8 @@ class KViewPager2 : ViewPager2Actions, ViewPager2AdapterAssertions, SwipeableAct
}

val vb = ViewBuilder().apply {
isDescendantOfA { withMatcher(this@KViewPager2.matcher) }
isInstanceOf(RecyclerView::class.java)
isDescendantOfA { withMatcher(this@KViewPager2.matcher) }
}

function(provideItem(PositionMatcher(vb.getViewMatcher(), position)) as T)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,10 +62,11 @@ class KRecyclerView : RecyclerActions, BaseAssertions, RecyclerAdapterAssertions
constructor(
parent: Matcher<View>, builder: ViewBuilder.() -> Unit,
itemTypeBuilder: KRecyclerItemTypeBuilder.() -> Unit
) : this({
isDescendantOfA { withMatcher(parent) }
builder(this)
}, itemTypeBuilder)
) : this(
{
builder(this)
isDescendantOfA { withMatcher(parent) }
}, itemTypeBuilder)

/**
* Constructs view class with parent and view interaction from given ViewBuilder
Expand All @@ -85,8 +86,8 @@ class KRecyclerView : RecyclerActions, BaseAssertions, RecyclerAdapterAssertions
val parentMatcher = makeTargetMatcher.invoke(parent)

val vb = ViewBuilder().apply {
isDescendantOfA { withMatcher(parentMatcher as Matcher<View>) }
builder(this)
isDescendantOfA { withMatcher(parentMatcher as Matcher<View>) }
}

matcher = vb.getViewMatcher()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,10 +59,11 @@ class KSpinner : SpinnerAdapterActions, SpinnerAdapterAssertions, BaseAssertions
constructor(
parent: Matcher<View>, builder: ViewBuilder.() -> Unit,
itemTypeBuilder: KAdapterItemTypeBuilder.() -> Unit
) : this({
isDescendantOfA { withMatcher(parent) }
builder(this)
}, itemTypeBuilder)
) : this(
{
builder(this)
isDescendantOfA { withMatcher(parent) }
}, itemTypeBuilder)

/**
* Constructs view class with parent and view interaction from given ViewBuilder
Expand All @@ -82,8 +83,8 @@ class KSpinner : SpinnerAdapterActions, SpinnerAdapterAssertions, BaseAssertions
val parentMatcher = makeTargetMatcher.invoke(parent)

val vb = ViewBuilder().apply {
isDescendantOfA { withMatcher(parentMatcher as Matcher<View>) }
builder(this)
isDescendantOfA { withMatcher(parentMatcher as Matcher<View>) }
}

matcher = vb.getViewMatcher()
Expand Down

0 comments on commit 9321378

Please sign in to comment.