|
@@ -38,12 +38,13 @@ public class TitleBarTest extends BaseTest {
|
38
|
38
|
private Button textButton;
|
39
|
39
|
private Button customButton;
|
40
|
40
|
private Map<String, TopBarButtonController> buttonControllers;
|
|
41
|
+ private TitleBarReactViewController reactViewController;
|
41
|
42
|
|
42
|
43
|
@Override
|
43
|
44
|
public void beforeEach() {
|
44
|
45
|
final TopBarButtonCreatorMock buttonCreator = new TopBarButtonCreatorMock();
|
45
|
46
|
final Activity activity = newActivity();
|
46
|
|
- TitleBarReactViewController reactViewController = new TitleBarReactViewController(activity, new TitleBarReactViewCreatorMock());
|
|
47
|
+ reactViewController = spy(new TitleBarReactViewController(activity, new TitleBarReactViewCreatorMock()));
|
47
|
48
|
createButtons();
|
48
|
49
|
buttonControllers = new HashMap<>();
|
49
|
50
|
uut = spy(new TitleBar(activity, buttonCreator, reactViewController, (buttonId -> {})) {
|
|
@@ -132,7 +133,7 @@ public class TitleBarTest extends BaseTest {
|
132
|
133
|
@Test
|
133
|
134
|
public void setComponent_addsComponentToTitleBar() throws Exception {
|
134
|
135
|
uut.setComponent("com.rnn.CustomView", TitleOptions.Alignment.Center);
|
135
|
|
- verify(uut, times(1)).addView(any(TitleBarReactView.class));
|
|
136
|
+ verify(uut, times(1)).addView(any(TitleBarReactView.class), any(Toolbar.LayoutParams.class));
|
136
|
137
|
}
|
137
|
138
|
|
138
|
139
|
@Test
|
|
@@ -154,6 +155,15 @@ public class TitleBarTest extends BaseTest {
|
154
|
155
|
assertThat(lpCaptor.getValue().gravity == Gravity.CENTER);
|
155
|
156
|
}
|
156
|
157
|
|
|
158
|
+ @Test
|
|
159
|
+ public void clear() throws Exception {
|
|
160
|
+ uut.clear();
|
|
161
|
+ assertThat(uut.getTitle()).isNullOrEmpty();
|
|
162
|
+ assertThat(uut.getMenu().size()).isZero();
|
|
163
|
+ assertThat(uut.getNavigationIcon()).isNull();
|
|
164
|
+ verify(reactViewController, times(1)).destroy();
|
|
165
|
+ }
|
|
166
|
+
|
157
|
167
|
private List<Button> leftButton(Button leftButton) {
|
158
|
168
|
return Collections.singletonList(leftButton);
|
159
|
169
|
}
|