Commit eff78bfd by Peter Fogg

Add doc for `click_component_from_menu` and make sure css is present in any case.

parent ff0c56b7
......@@ -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
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment