Merge "Disable collapse when fragment is opened from search"
This commit is contained in:
committed by
Android (Google) Code Review
commit
b1427f0034
@@ -74,8 +74,8 @@ public class DashboardFragmentTest {
|
||||
mDashboardCategory.tiles = new ArrayList<>();
|
||||
mDashboardCategory.tiles.add(new Tile());
|
||||
mTestFragment = new TestFragment(ShadowApplication.getInstance().getApplicationContext());
|
||||
when(mFakeFeatureFactory.dashboardFeatureProvider
|
||||
.getProgressiveDisclosureMixin(any(Context.class), eq(mTestFragment)))
|
||||
when(mFakeFeatureFactory.dashboardFeatureProvider.getProgressiveDisclosureMixin(
|
||||
any(Context.class), eq(mTestFragment), any(Bundle.class)))
|
||||
.thenReturn(mDisclosureMixin);
|
||||
when(mFakeFeatureFactory.dashboardFeatureProvider.getTilesForCategory(anyString()))
|
||||
.thenReturn(mDashboardCategory);
|
||||
|
@@ -77,8 +77,7 @@ public class ProgressiveDisclosureTest {
|
||||
mAppContext = ShadowApplication.getInstance().getApplicationContext();
|
||||
mFakeFeatureFactory = (FakeFeatureFactory) FeatureFactory.getFactory(mContext);
|
||||
mMixin = new ProgressiveDisclosureMixin(mAppContext,
|
||||
mFakeFeatureFactory.metricsFeatureProvider,
|
||||
mPreferenceFragment);
|
||||
mPreferenceFragment, false /* keepExpanded */);
|
||||
ReflectionHelpers.setField(mMixin, "mExpandButton", mExpandButton);
|
||||
mPreference = new Preference(mAppContext);
|
||||
mPreference.setKey("test");
|
||||
@@ -93,6 +92,17 @@ public class ProgressiveDisclosureTest {
|
||||
assertThat(mMixin.shouldCollapse(mScreen)).isFalse();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void shouldNotCollapse_whenStartAsExpanded() {
|
||||
when(mScreen.getPreferenceCount()).thenReturn(5);
|
||||
|
||||
mMixin = new ProgressiveDisclosureMixin(mAppContext,
|
||||
mPreferenceFragment, true /* keepExpanded */);
|
||||
mMixin.setTileLimit(10);
|
||||
|
||||
assertThat(mMixin.shouldCollapse(mScreen)).isFalse();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void shouldCollapse_morePreferenceThanLimit() {
|
||||
when(mScreen.getPreferenceCount()).thenReturn(5);
|
||||
|
Reference in New Issue
Block a user