Commit 09643c87 by cahrens

Add test for code format toolbar button.

parent 07d54be6
...@@ -51,3 +51,14 @@ Feature: CMS.HTML Editor ...@@ -51,3 +51,14 @@ Feature: CMS.HTML Editor
And type "<img src="/static/image.jpg">" in the code editor and press OK And type "<img src="/static/image.jpg">" in the code editor and press OK
Then the image static link is rewritten to translate the path Then the image static link is rewritten to translate the path
And the code editor displays "<p><img src="/static/image.jpg" alt="" /></p>" And the code editor displays "<p><img src="/static/image.jpg" alt="" /></p>"
Scenario: Code format toolbar button wraps text with code tags
Given I have created a Blank HTML Page
When I edit the page
And I set the text to "display as code" and I select the text
And I select the code toolbar button
And I save the page
Then the page has text:
"""
<p><code>display as code</code></p>
"""
...@@ -95,7 +95,7 @@ def image_static_link_is_rewritten(step): ...@@ -95,7 +95,7 @@ def image_static_link_is_rewritten(step):
assert_in('c4x/MITx/999/asset/image.jpg', image['src']) assert_in('c4x/MITx/999/asset/image.jpg', image['src'])
@step('the expected toolbar buttons are displayed') @step('the expected toolbar buttons are displayed$')
def check_toolbar_buttons(step): def check_toolbar_buttons(step):
dropdowns = world.css_find('.mce-listbox') dropdowns = world.css_find('.mce-listbox')
assert_equal(2, len(dropdowns)) assert_equal(2, len(dropdowns))
...@@ -129,3 +129,18 @@ def check_toolbar_buttons(step): ...@@ -129,3 +129,18 @@ def check_toolbar_buttons(step):
check_class(11, 'unlink') check_class(11, 'unlink')
check_class(12, 'image') check_class(12, 'image')
check_class(13, 'code') check_class(13, 'code')
@step('I set the text to "(.*)" and I select the text$')
def set_text_and_select(step, text):
script = """
var editor = tinyMCE.activeEditor;
editor.setContent(arguments[0]);
editor.selection.select(editor.dom.select('p')[0]);"""
world.browser.driver.execute_script(script, str(text))
world.wait_for_ajax_complete()
@step('I select the code toolbar button$')
def select_code_button(step):
# This is our custom "code style" button. It uses an image instead of a class.
world.css_click(".mce-i-none")
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