Merge "Support suggestion UI card with a button."
This commit is contained in:
committed by
Android (Google) Code Review
commit
80fd58e3b6
@@ -143,6 +143,21 @@ public class SuggestionAdapterTest {
|
||||
.isEqualTo(R.layout.suggestion_tile);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void getItemType_hasButton_shouldReturnSuggestionWithButton() {
|
||||
final List<Suggestion> suggestions = new ArrayList<>();
|
||||
suggestions.add(new Suggestion.Builder("id")
|
||||
.setFlags(Suggestion.FLAG_HAS_BUTTON)
|
||||
.setTitle("123")
|
||||
.setSummary("456")
|
||||
.build());
|
||||
mSuggestionAdapter = new SuggestionAdapter(mContext, null /* suggestions */,
|
||||
suggestions, new ArrayList<>());
|
||||
|
||||
assertThat(mSuggestionAdapter.getItemViewType(0))
|
||||
.isEqualTo(R.layout.suggestion_tile_with_button);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void onBindViewHolder_shouldSetListener() {
|
||||
final View view = spy(LayoutInflater.from(mContext).inflate(
|
||||
|
||||
@@ -92,7 +92,7 @@ public class SuggestionDismissControllerTest {
|
||||
@Test
|
||||
public void getSwipeDirs_isSuggestionTileCard_shouldReturnDirection() {
|
||||
final RecyclerView.ViewHolder vh = mock(RecyclerView.ViewHolder.class);
|
||||
when(vh.getItemViewType()).thenReturn(R.layout.suggestion_tile_remote_container);
|
||||
when(vh.getItemViewType()).thenReturn(R.layout.suggestion_tile_with_button);
|
||||
|
||||
assertThat(mController.getSwipeDirs(mRecyclerView, vh))
|
||||
.isEqualTo(ItemTouchHelper.START | ItemTouchHelper.END);
|
||||
|
||||
Reference in New Issue
Block a user