react-native-navigation的迁移库

NavigationOptions.test.js 964B

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. const NavigationOptions = require('./NavigationOptions');
  2. const TabBar = require('./TabBar');
  3. const TopBar = require('./TopBar');
  4. const TAB_BAR = {};
  5. const TOP_BAR = {};
  6. const RIGHT_BUTTONS = [
  7. {
  8. id: 'myBtn',
  9. testID: 'BTN',
  10. title: 'My Button',
  11. color: 'red'
  12. }
  13. ];
  14. const LEFT_BUTTONS = [
  15. {
  16. id: 'myBtn',
  17. testID: 'BTN',
  18. title: 'My Button',
  19. color: 'red'
  20. }
  21. ];
  22. const NAVIGATION_OPTIONS = {
  23. topBar: TOP_BAR,
  24. bottomTabs: TAB_BAR,
  25. orientation: 'portrait',
  26. rightButtons: RIGHT_BUTTONS,
  27. leftButtons: LEFT_BUTTONS
  28. };
  29. describe('NavigationOptions', () => {
  30. it('parses navigationOptions correctly', () => {
  31. const uut = new NavigationOptions(NAVIGATION_OPTIONS);
  32. expect(uut.bottomTabs).toBeInstanceOf(TabBar);
  33. expect(uut.topBar).toBeInstanceOf(TopBar);
  34. expect(uut.orientation).toEqual('portrait');
  35. expect(uut.rightButtons).toEqual(RIGHT_BUTTONS);
  36. expect(uut.leftButtons).toEqual(LEFT_BUTTONS);
  37. });
  38. });