Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
E
edx-platform
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
edx
edx-platform
Commits
d623a4e4
Commit
d623a4e4
authored
Mar 20, 2014
by
cahrens
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Updates from code review.
parent
fb6afc70
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
47 additions
and
44 deletions
+47
-44
cms/djangoapps/contentstore/features/html-editor.feature
+7
-7
cms/djangoapps/contentstore/features/html-editor.py
+40
-37
No files found.
cms/djangoapps/contentstore/features/html-editor.feature
View file @
d623a4e4
...
...
@@ -23,21 +23,21 @@ Feature: CMS.HTML Editor
Scenario
:
TinyMCE image plugin sets urls correctly
Given
I have created a Blank HTML Page
When
I edit the page
And
I add an image with
a static link
via the Image Plugin Icon
Then
the
image static link is rewritten to translate the path
And
I add an image with
static link
"/static/image.jpg"
via the Image Plugin Icon
Then
the
src link is rewritten to
"c4x/MITx/999/asset/image.jpg"
Scenario
:
TinyMCE link plugin sets urls correctly
Given
I have created a Blank HTML Page
When
I edit the page
And
I add a
n link with a static link
via the Link Plugin Icon
Then
the
link static link is rewritten to translate the path
And
I add a
link with static link
"/static/image.jpg"
via the Link Plugin Icon
Then
the
href link is rewritten to
"c4x/MITx/999/asset/image.jpg"
Scenario
:
TinyMCE and CodeMirror preserve style tags
Given
I have created a Blank HTML Page
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
has text
:
Then the page
text is
:
"""
<p> </p>
<p class="title">pages</p>
...
...
@@ -55,7 +55,7 @@ Feature: CMS.HTML Editor
Given
I have created a Blank HTML Page
When
I edit the page
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
src link is rewritten to
"c4x/MITx/999/asset/image.jpg"
And
the code editor displays
"<p><img src="
/static/image.jpg" alt="" /></p>"
Scenario
:
Code format toolbar button wraps text with code tags
...
...
@@ -64,7 +64,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
has text
:
Then the page
text is
:
"""
<p><code>display as code</code></p>
"""
cms/djangoapps/contentstore/features/html-editor.py
View file @
d623a4e4
...
...
@@ -5,6 +5,8 @@ from lettuce import world, step
from
nose.tools
import
assert_in
,
assert_equal
# pylint: disable=no-name-in-module
from
common
import
type_in_codemirror
,
get_codemirror_value
CODEMIRROR_SELECTOR_PREFIX
=
"$('iframe').contents().find"
@step
(
'I have created a Blank HTML Page$'
)
def
i_created_blank_html_page
(
step
):
...
...
@@ -37,18 +39,18 @@ def i_click_on_edit_icon(step):
world
.
edit_component
()
@step
(
'I add an image with
a static link
via the Image Plugin Icon$'
)
def
i_click_on_image_plugin_icon
(
step
):
@step
(
'I add an image with
static link "(.*)"
via the Image Plugin Icon$'
)
def
i_click_on_image_plugin_icon
(
step
,
path
):
use_plugin
(
'.mce-i-image'
,
lambda
:
world
.
css_fill
(
'.mce-textbox'
,
'/static/image.jpg'
,
0
)
lambda
:
world
.
css_fill
(
'.mce-textbox'
,
path
,
0
)
)
@step
(
'I add a
n link with a static link
via the Link Plugin Icon$'
)
def
i_click_on_link_plugin_icon
(
step
):
@step
(
'I add a
link with static link "(.*)"
via the Link Plugin Icon$'
)
def
i_click_on_link_plugin_icon
(
step
,
path
):
def
fill_in_link_fields
():
world
.
css_fill
(
'.mce-textbox'
,
'/static/image.jpg'
,
0
)
world
.
css_fill
(
'.mce-textbox'
,
path
,
0
)
world
.
css_fill
(
'.mce-textbox'
,
'picture'
,
1
)
use_plugin
(
'.mce-i-link'
,
fill_in_link_fields
)
...
...
@@ -58,7 +60,7 @@ def i_click_on_link_plugin_icon(step):
def
type_in_codemirror_plugin
(
step
,
text
):
use_plugin
(
'.mce-i-code'
,
lambda
:
type_in_codemirror
(
0
,
text
,
"$('iframe').contents().find"
)
lambda
:
type_in_codemirror
(
0
,
text
,
CODEMIRROR_SELECTOR_PREFIX
)
)
...
...
@@ -66,7 +68,7 @@ def type_in_codemirror_plugin(step, text):
def
verify_code_editor_text
(
step
,
text
):
use_plugin
(
'.mce-i-code'
,
lambda
:
assert_equal
(
text
,
get_codemirror_value
(
0
,
"$('iframe').contents().find"
))
lambda
:
assert_equal
(
text
,
get_codemirror_value
(
0
,
CODEMIRROR_SELECTOR_PREFIX
))
)
...
...
@@ -89,25 +91,25 @@ def i_click_on_save(step):
world
.
save_component
(
step
)
@step
(
'the page
has text
:'
)
@step
(
'the page
text is
:'
)
def
check_page_text
(
step
):
assert_equal
(
step
.
multiline
,
world
.
css_find
(
'.xmodule_HtmlModule'
)
.
html
.
strip
())
@step
(
'the
image static link is rewritten to translate the path
$'
)
def
image_static_link_is_rewritten
(
step
):
@step
(
'the
src link is rewritten to "(.*)"
$'
)
def
image_static_link_is_rewritten
(
step
,
path
):
# Find the TinyMCE iframe within the main window
with
world
.
browser
.
get_iframe
(
'mce_0_ifr'
)
as
tinymce
:
image
=
tinymce
.
find_by_tag
(
'img'
)
.
first
assert_in
(
'c4x/MITx/999/asset/image.jpg'
,
image
[
'src'
])
assert_in
(
path
,
image
[
'src'
])
@step
(
'the
link static link is rewritten to translate the path
$'
)
def
link_static_link_is_rewritten
(
step
):
@step
(
'the
href link is rewritten to "(.*)"
$'
)
def
link_static_link_is_rewritten
(
step
,
path
):
# Find the TinyMCE iframe within the main window
with
world
.
browser
.
get_iframe
(
'mce_0_ifr'
)
as
tinymce
:
link
=
tinymce
.
find_by_tag
(
'a'
)
.
first
assert_in
(
'c4x/MITx/999/asset/image.jpg'
,
link
[
'href'
])
assert_in
(
path
,
link
[
'href'
])
@step
(
'the expected toolbar buttons are displayed$'
)
...
...
@@ -117,33 +119,34 @@ def check_toolbar_buttons(step):
# Format dropdown
assert_equal
(
'Paragraph'
,
dropdowns
[
0
]
.
text
)
assert_equal
(
'Font Family'
,
dropdowns
[
1
]
.
text
)
# Font dropdown
assert_equal
(
'Font Family'
,
dropdowns
[
1
]
.
text
)
buttons
=
world
.
css_find
(
'.mce-ico'
)
assert_equal
(
14
,
len
(
buttons
))
def
check_class
(
index
,
button_name
):
expected_buttons
=
[
'bold'
,
'italic'
,
# This is our custom "code style" button, which uses an image instead of a class.
'none'
,
'underline'
,
'forecolor'
,
'bullist'
,
'numlist'
,
'outdent'
,
'indent'
,
'blockquote'
,
'link'
,
'unlink'
,
'image'
,
'code'
,
]
assert_equal
(
len
(
expected_buttons
),
len
(
buttons
))
for
index
,
button
in
enumerate
(
expected_buttons
):
class_names
=
buttons
[
index
]
.
_element
.
get_attribute
(
'class'
)
assert_equal
(
"mce-ico mce-i-"
+
button_name
,
class_names
)
check_class
(
0
,
'bold'
)
check_class
(
1
,
'italic'
)
# This is our custom "code style" button. It uses an image instead of a class.
check_class
(
2
,
'none'
)
check_class
(
3
,
'underline'
)
check_class
(
4
,
'forecolor'
)
check_class
(
5
,
'bullist'
)
check_class
(
6
,
'numlist'
)
check_class
(
7
,
'outdent'
)
check_class
(
8
,
'indent'
)
check_class
(
9
,
'blockquote'
)
check_class
(
10
,
'link'
)
check_class
(
11
,
'unlink'
)
check_class
(
12
,
'image'
)
check_class
(
13
,
'code'
)
assert_equal
(
"mce-ico mce-i-"
+
button
,
class_names
)
@step
(
'I set the text to "(.*)" and I select the text$'
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment