|
@@ -8,14 +8,13 @@ import android.view.ViewGroup.LayoutParams;
|
8
|
8
|
|
9
|
9
|
import com.reactnativenavigation.BaseTest;
|
10
|
10
|
import com.reactnativenavigation.mocks.SimpleComponentViewController;
|
11
|
|
-import com.reactnativenavigation.parse.Options;
|
12
|
|
-import com.reactnativenavigation.parse.SideMenuOptions;
|
|
11
|
+import com.reactnativenavigation.parse.*;
|
13
|
12
|
import com.reactnativenavigation.parse.params.Bool;
|
14
|
13
|
import com.reactnativenavigation.parse.params.Number;
|
15
|
14
|
import com.reactnativenavigation.parse.params.Text;
|
16
|
15
|
import com.reactnativenavigation.presentation.Presenter;
|
17
|
16
|
import com.reactnativenavigation.presentation.SideMenuPresenter;
|
18
|
|
-import com.reactnativenavigation.utils.CommandListenerAdapter;
|
|
17
|
+import com.reactnativenavigation.utils.*;
|
19
|
18
|
import com.reactnativenavigation.viewcontrollers.ChildControllersRegistry;
|
20
|
19
|
import com.reactnativenavigation.viewcontrollers.ParentController;
|
21
|
20
|
import com.reactnativenavigation.viewcontrollers.ViewController;
|
|
@@ -250,6 +249,31 @@ public class SideMenuControllerTest extends BaseTest {
|
250
|
249
|
verify(spy).onViewDisappear();
|
251
|
250
|
}
|
252
|
251
|
|
|
252
|
+ @Test
|
|
253
|
+ public void onDrawerOpened_drawerOpenedWIthSwipe_visibilityIsUpdated() {
|
|
254
|
+ uut.setLeftController(left);
|
|
255
|
+ uut.setRightController(right);
|
|
256
|
+ uut.ensureViewIsCreated();
|
|
257
|
+
|
|
258
|
+ openDrawerAndAssertVisibility(right, (side) -> side.resolveCurrentOptions().sideMenuRootOptions.right);
|
|
259
|
+ closeDrawerAndAssertVisibility(right, (side) -> side.resolveCurrentOptions().sideMenuRootOptions.right);
|
|
260
|
+
|
|
261
|
+ openDrawerAndAssertVisibility(left, (side) -> side.resolveCurrentOptions().sideMenuRootOptions.left);
|
|
262
|
+ closeDrawerAndAssertVisibility(left, (side) -> side.resolveCurrentOptions().sideMenuRootOptions.left);
|
|
263
|
+ }
|
|
264
|
+
|
|
265
|
+ private void openDrawerAndAssertVisibility(ViewController side, Functions.FuncR1<ViewController, SideMenuOptions> opt) {
|
|
266
|
+ assertThat(opt.run(side).visible.isTrue()).isFalse();
|
|
267
|
+ uut.onDrawerOpened(side.getView());
|
|
268
|
+ assertThat(opt.run(side).visible.isTrue()).isTrue();
|
|
269
|
+ }
|
|
270
|
+
|
|
271
|
+ private void closeDrawerAndAssertVisibility(ViewController side, Functions.FuncR1<ViewController, SideMenuOptions> opt) {
|
|
272
|
+ assertThat(opt.run(side).visible.isTrue()).isTrue();
|
|
273
|
+ uut.onDrawerClosed(side.getView());
|
|
274
|
+ assertThat(opt.run(side).visible.isTrue()).isFalse();
|
|
275
|
+ }
|
|
276
|
+
|
253
|
277
|
private void openLeftMenu() {
|
254
|
278
|
Options options = new Options();
|
255
|
279
|
options.sideMenuRootOptions.left.visible = new Bool(true);
|