From b4ca671b6b150c36330f042fd5d2eb56a1131b13 Mon Sep 17 00:00:00 2001 From: Whymarrh Whitby Date: Thu, 16 Jan 2020 18:18:09 -0330 Subject: [PATCH] Fix propTypes and test props for Dropdown components (#7851) --- test/unit/responsive/components/dropdown-test.js | 15 +++------------ ui/app/components/app/menu-droppo.js | 2 +- 2 files changed, 4 insertions(+), 13 deletions(-) diff --git a/test/unit/responsive/components/dropdown-test.js b/test/unit/responsive/components/dropdown-test.js index 8b39a1481..3d0da520f 100644 --- a/test/unit/responsive/components/dropdown-test.js +++ b/test/unit/responsive/components/dropdown-test.js @@ -12,7 +12,6 @@ const mockState = { describe('Dropdown components', function () { let onClickOutside - let closeMenu let onClick const dropdownComponentProps = { @@ -32,7 +31,6 @@ describe('Dropdown components', function () { let component beforeEach(function () { onClickOutside = sinon.spy() - closeMenu = sinon.spy() onClick = sinon.spy() store = createMockStore(mockState) @@ -46,8 +44,8 @@ describe('Dropdown components', function () { ` } -
  • Item 1
  • -
  • Item 2
  • +
  • Item 1
  • +
  • Item 2
  • ), store) dropdownComponent = component @@ -58,17 +56,10 @@ describe('Dropdown components', function () { assert.equal(items.length, 2) }) - it('closes when item clicked', function () { - const items = dropdownComponent.find('li') - const node = items.at(0) - node.simulate('click') - assert.equal(node.props().closeMenu, closeMenu) - }) - it('invokes click handler when item clicked', function () { const items = dropdownComponent.find('li') const node = items.at(0) node.simulate('click') - assert.equal(onClick.calledOnce, true) + assert.ok(onClick.calledOnce) }) }) diff --git a/ui/app/components/app/menu-droppo.js b/ui/app/components/app/menu-droppo.js index ab149d48c..1a5d7138c 100644 --- a/ui/app/components/app/menu-droppo.js +++ b/ui/app/components/app/menu-droppo.js @@ -8,7 +8,7 @@ export default class MenuDroppoComponent extends Component { isOpen: PropTypes.bool.isRequired, innerStyle: PropTypes.object, children: PropTypes.node.isRequired, - onClickOutside: PropTypes.func.isRequired, + onClickOutside: PropTypes.func, containerClassName: PropTypes.string, zIndex: PropTypes.number, style: PropTypes.object.isRequired,