def test_react_select_options_simple(self):
     mock_webelement = Mock()
     mock_webelement.tag_name = 'div'
     with patch('Zoomba.Helpers.ReactSelect.ReactSelect.expand_select_list'
                ) as mock_expand_select_list:
         ReactSelect.ReactSelect(mock_webelement).options()
         mock_expand_select_list.assert_called()
 def test_react_select_expand_select_list_already_expanded(self):
     mock_webelement = Mock()
     mock_webelement.tag_name = 'div'
     with patch('Zoomba.Helpers.ReactSelect.ReactSelect.is_expanded',
                return_value=True):
         ReactSelect.ReactSelect(mock_webelement).expand_select_list()
         mock_webelement.click.assert_not_called()
 def test_react_select_init_tag_check(self):
     mock_webelement = Mock()
     mock_webelement.tag_name = 'span'
     with self.assertRaises(
             UnexpectedTagNameException,
             msg="ReactSelect only works on <div> elements, not on <span>"):
         ReactSelect.ReactSelect(mock_webelement)
 def test_react_select_is_expanded_error(self):
     mock_webelement = Mock()
     mock_webelement.tag_name = 'div'
     mock_webelement.find_elements_by_xpath = Mock(
         return_value=["some child element", "another child element"])
     with self.assertRaises(
             LookupError,
             msg="ReactSelect.is_expanded: Multiple selection menus found"):
         ReactSelect.ReactSelect(mock_webelement).is_expanded()
 def test_react_select_options(self):
     mock_webelement = Mock()
     mock_webelement.tag_name = 'div'
     mock_webelement.find_elements_by_xpath = MagicMock(
         return_value=["some child element", "another child element"])
     with patch('Zoomba.Helpers.ReactSelect.ReactSelect.expand_select_list',
                return_value=True):
         assert ReactSelect.ReactSelect(mock_webelement).options() == [
             "some child element", "another child element"
         ]
 def test_react_select_is_expanded_no_elements(self):
     mock_webelement = Mock()
     mock_webelement.tag_name = 'div'
     mock_webelement.find_elements_by_xpath = Mock(return_value=[])
     assert not ReactSelect.ReactSelect(mock_webelement).is_expanded()
 def test_react_select_init(self):
     mock_webelement = Mock()
     mock_webelement.tag_name = 'div'
     RS = ReactSelect.ReactSelect(mock_webelement)
     self.assertEqual(RS._el, mock_webelement)