Code review feedback.
This commit is contained in:
@@ -329,9 +329,11 @@ def type_in_codemirror(index, text, find_prefix="$"):
|
||||
|
||||
|
||||
def get_codemirror_value(index=0, find_prefix="$"):
|
||||
return world.browser.driver.execute_script("""
|
||||
return world.browser.driver.execute_script(
|
||||
"""
|
||||
return {find_prefix}('div.CodeMirror:eq({index})').get(0).CodeMirror.getValue();
|
||||
""".format(index=index, find_prefix=find_prefix))
|
||||
""".format(index=index, find_prefix=find_prefix)
|
||||
)
|
||||
|
||||
|
||||
def upload_file(filename):
|
||||
|
||||
@@ -39,9 +39,8 @@ Feature: CMS.HTML Editor
|
||||
When I edit the page
|
||||
And type "<p class='title'>pages</p><style><!-- .title { color: red; } --></style>" in the code editor and press OK
|
||||
And I save the page
|
||||
Then the page text is:
|
||||
Then the page text contains:
|
||||
"""
|
||||
<p> </p>
|
||||
<p class="title">pages</p>
|
||||
<style><!--
|
||||
.title { color: red; }
|
||||
@@ -66,7 +65,7 @@ Feature: CMS.HTML Editor
|
||||
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 text is:
|
||||
Then the page text contains:
|
||||
"""
|
||||
<p><code>display as code</code></p>
|
||||
"""
|
||||
|
||||
@@ -99,9 +99,9 @@ def i_click_on_save(step):
|
||||
world.save_component(step)
|
||||
|
||||
|
||||
@step('the page text is:')
|
||||
@step('the page text contains:')
|
||||
def check_page_text(step):
|
||||
assert_equal(step.multiline, world.css_find('.xmodule_HtmlModule').html.strip())
|
||||
assert_in(step.multiline, world.css_find('.xmodule_HtmlModule').html)
|
||||
|
||||
|
||||
@step('the src link is rewritten to "(.*)"$')
|
||||
|
||||
@@ -81,12 +81,14 @@ class @HTMLEditingDescriptor
|
||||
@rewriteLinksFromStatic(e.target)
|
||||
|
||||
showCodeEditor: (codeEditor) =>
|
||||
# Called with the CodeMirror Editor is displayed to convert links to show satic prefix.
|
||||
# Called when the CodeMirror Editor is displayed to convert links to show satic prefix.
|
||||
# The input argument is the CodeMirror instance.
|
||||
content = rewriteStaticLinks(codeEditor.getValue(), @base_asset_url, '/static/')
|
||||
codeEditor.setValue(content)
|
||||
|
||||
saveCodeEditor: (codeEditor) =>
|
||||
# Called when the CodeMirror Editor is saved to convert links back to the full form.
|
||||
# The input argument is the CodeMirror instance.
|
||||
content = rewriteStaticLinks(codeEditor.getValue(), '/static/', @base_asset_url)
|
||||
codeEditor.setValue(content)
|
||||
|
||||
|
||||
@@ -110,14 +110,15 @@ function start()
|
||||
}
|
||||
|
||||
// Create legend for keyboard shortcuts for find & replace:
|
||||
var head = parent.document.querySelectorAll('.mce-foot')[0],
|
||||
div = parent.document.createElement('div'),
|
||||
td1 = '<td style="font-size:11px;background:#777;color:#fff;padding:0 4px">',
|
||||
td2 = '<td style="font-size:11px;padding-right:5px">';
|
||||
div.innerHTML = '<table cellspacing="0" cellpadding="0" style="border-spacing:4px"><tr>' + td1 + (isMac ? '⌘-F' : 'Ctrl-F</td>') + td2 + tinymce.translate('Start search') + '</td>' + td1 + (isMac ? '⌘-G' : 'Ctrl-G') + '</td>' + td2 + tinymce.translate('Find next') + '</td>' + td1 + (isMac ? '⌘-Alt-F' : 'Shift-Ctrl-F') + '</td>' + td2 + tinymce.translate('Find previous') + '</td></tr>' + '<tr>' + td1 + (isMac ? '⌘-Alt-F' : 'Shift-Ctrl-F') + '</td>' + td2 + tinymce.translate('Replace') + '</td>' + td1 + (isMac ? 'Shift-⌘-Alt-F' : 'Shift-Ctrl-R') +'</td>' + td2 + tinymce.translate('Replace all') + '</td></tr></table>';
|
||||
div.style.position = 'absolute';
|
||||
div.style.left = div.style.bottom = '5px';
|
||||
head.appendChild(div);
|
||||
// Disabled by EDX.
|
||||
// var head = parent.document.querySelectorAll('.mce-foot')[0],
|
||||
// div = parent.document.createElement('div'),
|
||||
// td1 = '<td style="font-size:11px;background:#777;color:#fff;padding:0 4px">',
|
||||
// td2 = '<td style="font-size:11px;padding-right:5px">';
|
||||
// div.innerHTML = '<table cellspacing="0" cellpadding="0" style="border-spacing:4px"><tr>' + td1 + (isMac ? '⌘-F' : 'Ctrl-F</td>') + td2 + tinymce.translate('Start search') + '</td>' + td1 + (isMac ? '⌘-G' : 'Ctrl-G') + '</td>' + td2 + tinymce.translate('Find next') + '</td>' + td1 + (isMac ? '⌘-Alt-F' : 'Shift-Ctrl-F') + '</td>' + td2 + tinymce.translate('Find previous') + '</td></tr>' + '<tr>' + td1 + (isMac ? '⌘-Alt-F' : 'Shift-Ctrl-F') + '</td>' + td2 + tinymce.translate('Replace') + '</td>' + td1 + (isMac ? 'Shift-⌘-Alt-F' : 'Shift-Ctrl-R') +'</td>' + td2 + tinymce.translate('Replace all') + '</td></tr></table>';
|
||||
// div.style.position = 'absolute';
|
||||
// div.style.left = div.style.bottom = '5px';
|
||||
// head.appendChild(div);
|
||||
|
||||
// Set CodeMirror cursor to same position as cursor was in TinyMCE:
|
||||
var html = editor.getContent({source_view: true});
|
||||
|
||||
Reference in New Issue
Block a user