Add doc for click_component_from_menu and make sure css is present in any case.
This commit is contained in:
@@ -20,13 +20,20 @@ def click_new_component_button(step, component_button_css):
|
||||
|
||||
@world.absorb
|
||||
def click_component_from_menu(instance_id, expected_css):
|
||||
"""
|
||||
Creates a component from `instance_id`. For components with more
|
||||
than one template, clicks on `elem_css` to create the new
|
||||
component. Components with only one template are created as soon
|
||||
as the user clicks the appropriate button, so we assert that the
|
||||
expected component is present.
|
||||
"""
|
||||
elem_css = "a[data-location='%s']" % instance_id
|
||||
elements = world.css_find(elem_css)
|
||||
if len(elements) == 1: # Multiple templates
|
||||
world.css_click(elem_css)
|
||||
assert_equal(1, len(world.css_find(expected_css)))
|
||||
else: # Single template
|
||||
assert(len(filter(lambda ele: ele.has_class('single_template'), elements)) == 1)
|
||||
assert_equal(1, len(world.css_find(expected_css)))
|
||||
|
||||
|
||||
@world.absorb
|
||||
|
||||
Reference in New Issue
Block a user