Add test for code format toolbar button.
This commit is contained in:
@@ -51,3 +51,14 @@ Feature: CMS.HTML Editor
|
||||
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
|
||||
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):
|
||||
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):
|
||||
dropdowns = world.css_find('.mce-listbox')
|
||||
assert_equal(2, len(dropdowns))
|
||||
@@ -129,3 +129,18 @@ def check_toolbar_buttons(step):
|
||||
check_class(11, 'unlink')
|
||||
check_class(12, 'image')
|
||||
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")
|
||||
|
||||
Reference in New Issue
Block a user