Commit 7b241726 by cahrens

Update tests for minor UI changes.

Code editor button no longer shows an icon, and code style toolbar button location has moved.
parent 1cd6e1dc
...@@ -81,16 +81,14 @@ def check_link_in_link_plugin(step, path): ...@@ -81,16 +81,14 @@ def check_link_in_link_plugin(step, path):
@step('type "(.*)" in the code editor and press OK$') @step('type "(.*)" in the code editor and press OK$')
def type_in_codemirror_plugin(step, text): def type_in_codemirror_plugin(step, text):
use_plugin( use_code_editor(
'.mce-i-code',
lambda: type_in_codemirror(0, text, CODEMIRROR_SELECTOR_PREFIX) lambda: type_in_codemirror(0, text, CODEMIRROR_SELECTOR_PREFIX)
) )
@step('and the code editor displays "(.*)"$') @step('and the code editor displays "(.*)"$')
def verify_code_editor_text(step, text): def verify_code_editor_text(step, text):
use_plugin( use_code_editor(
'.mce-i-code',
lambda: assert_equal(text, get_codemirror_value(0, CODEMIRROR_SELECTOR_PREFIX)) lambda: assert_equal(text, get_codemirror_value(0, CODEMIRROR_SELECTOR_PREFIX))
) )
...@@ -98,8 +96,22 @@ def verify_code_editor_text(step, text): ...@@ -98,8 +96,22 @@ def verify_code_editor_text(step, text):
def use_plugin(button_class, action): def use_plugin(button_class, action):
# Click on plugin button # Click on plugin button
world.css_click(button_class) world.css_click(button_class)
perform_action_in_plugin(action)
def use_code_editor(action):
# Click on plugin button
buttons = world.css_find('div.mce-widget>button')
code_editor = [button for button in buttons if button.text == 'HTML']
assert_equal(1, len(code_editor))
code_editor[0].click()
# Wait for the editing window to open. perform_action_in_plugin(action)
def perform_action_in_plugin(action):
# Wait for the plugin window to open.
world.wait_for_visible('.mce-window') world.wait_for_visible('.mce-window')
# Trigger the action # Trigger the action
...@@ -147,13 +159,15 @@ def check_toolbar_buttons(step): ...@@ -147,13 +159,15 @@ def check_toolbar_buttons(step):
buttons = world.css_find('.mce-ico') buttons = world.css_find('.mce-ico')
# Note that the code editor icon is not present because we are now showing text instead of an icon.
# However, other test points user the code editor, so we have already verified its presence.
expected_buttons = [ expected_buttons = [
'bold', 'bold',
'italic', 'italic',
# This is our custom "code style" button, which uses an image instead of a class.
'none',
'underline', 'underline',
'forecolor', 'forecolor',
# This is our custom "code style" button, which uses an image instead of a class.
'none',
'bullist', 'bullist',
'numlist', 'numlist',
'outdent', 'outdent',
...@@ -161,8 +175,7 @@ def check_toolbar_buttons(step): ...@@ -161,8 +175,7 @@ def check_toolbar_buttons(step):
'blockquote', 'blockquote',
'link', 'link',
'unlink', 'unlink',
'image', 'image'
'code',
] ]
assert_equal(len(expected_buttons), len(buttons)) assert_equal(len(expected_buttons), len(buttons))
......
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