|
@@ -2,12 +2,15 @@ package com.reactnativenavigation.views;
|
2
|
2
|
|
3
|
3
|
import android.app.Activity;
|
4
|
4
|
|
|
5
|
+import com.google.android.material.appbar.AppBarLayout;
|
5
|
6
|
import com.reactnativenavigation.BaseTest;
|
|
7
|
+import com.reactnativenavigation.interfaces.ScrollEventListener;
|
6
|
8
|
import com.reactnativenavigation.utils.UiUtils;
|
7
|
9
|
import com.reactnativenavigation.viewcontrollers.topbar.TopBarController;
|
8
|
10
|
import com.reactnativenavigation.views.topbar.TopBar;
|
9
|
11
|
|
10
|
12
|
import org.junit.Test;
|
|
13
|
+import org.mockito.Mockito;
|
11
|
14
|
import org.robolectric.annotation.Config;
|
12
|
15
|
|
13
|
16
|
import static org.assertj.core.api.Java6Assertions.assertThat;
|
|
@@ -42,4 +45,14 @@ public class TopBarTest extends BaseTest {
|
42
|
45
|
uut.setElevation(Double.valueOf(2));
|
43
|
46
|
assertThat(uut.getElevation()).isEqualTo(UiUtils.dpToPx(activity, 2));
|
44
|
47
|
}
|
|
48
|
+
|
|
49
|
+ @Test
|
|
50
|
+ public void disableCollapse_scrollIsDisabled() {
|
|
51
|
+ AppBarLayout.LayoutParams lp = (AppBarLayout.LayoutParams) uut.getChildAt(0).getLayoutParams();
|
|
52
|
+ uut.enableCollapse(Mockito.mock(ScrollEventListener.class));
|
|
53
|
+ assertThat(lp.getScrollFlags()).isEqualTo(AppBarLayout.LayoutParams.SCROLL_FLAG_SCROLL);
|
|
54
|
+
|
|
55
|
+ uut.disableCollapse();
|
|
56
|
+ assertThat(lp.getScrollFlags()).isZero();
|
|
57
|
+ }
|
45
|
58
|
}
|