Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
P
problem-builder
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
OpenEdx
problem-builder
Commits
9af13c34
Commit
9af13c34
authored
Sep 03, 2015
by
Tim Krones
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #59 from open-craft/fix-invalid-links-in-tables
Fix: Translate links in table column headers
parents
d500a621
07586e6d
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
29 additions
and
1 deletions
+29
-1
problem_builder/table.py
+5
-1
problem_builder/tests/integration/test_table.py
+15
-0
problem_builder/tests/integration/xml/table_3.xml
+9
-0
No files found.
problem_builder/table.py
View file @
9af13c34
...
@@ -113,7 +113,11 @@ class MentoringTableBlock(
...
@@ -113,7 +113,11 @@ class MentoringTableBlock(
for
child_id
in
self
.
children
:
for
child_id
in
self
.
children
:
child
=
self
.
runtime
.
get_block
(
child_id
)
child
=
self
.
runtime
.
get_block
(
child_id
)
# Child should be an instance of MentoringTableColumn
# Child should be an instance of MentoringTableColumn
header_values
.
append
(
child
.
header
)
header
=
child
.
header
# Make sure /jump_to_id/ URLs are expanded correctly
if
getattr
(
self
.
runtime
,
'replace_jump_to_id_urls'
,
None
):
header
=
self
.
runtime
.
replace_jump_to_id_urls
(
header
)
header_values
.
append
(
header
)
child_frag
=
child
.
render
(
'mentoring_view'
,
context
)
child_frag
=
child
.
render
(
'mentoring_view'
,
context
)
content_values
.
append
(
child_frag
.
content
)
content_values
.
append
(
child_frag
.
content
)
context
[
'header_values'
]
=
header_values
if
any
(
header_values
)
else
None
context
[
'header_values'
]
=
header_values
if
any
(
header_values
)
else
None
...
...
problem_builder/tests/integration/test_table.py
View file @
9af13c34
...
@@ -20,6 +20,8 @@
...
@@ -20,6 +20,8 @@
# Imports ###########################################################
# Imports ###########################################################
from
mock
import
patch
from
workbench.runtime
import
WorkbenchRuntime
from
.base_test
import
MentoringBaseTest
from
.base_test
import
MentoringBaseTest
...
@@ -54,3 +56,16 @@ class MentoringTableBlockTest(MentoringBaseTest):
...
@@ -54,3 +56,16 @@ class MentoringTableBlockTest(MentoringBaseTest):
self
.
assertEqual
(
len
(
rows
),
2
)
self
.
assertEqual
(
len
(
rows
),
2
)
self
.
assertEqual
(
rows
[
0
]
.
text
,
'This is the answer #1'
)
self
.
assertEqual
(
rows
[
0
]
.
text
,
'This is the answer #1'
)
self
.
assertEqual
(
rows
[
1
]
.
text
,
'This is the answer #2'
)
self
.
assertEqual
(
rows
[
1
]
.
text
,
'This is the answer #2'
)
# Ensure that table block makes an effort to translate URLs in column headers
link_template
=
"<a href='http://www.test.com'>{}</a> in a column header."
original_contents
=
link_template
.
format
(
'Link'
)
updated_contents
=
link_template
.
format
(
'Updated link'
)
with
patch
.
object
(
WorkbenchRuntime
,
'replace_jump_to_id_urls'
,
create
=
True
)
as
patched_method
:
patched_method
.
return_value
=
updated_contents
table
=
self
.
go_to_page
(
'Table 3'
,
css_selector
=
'.mentoring-table'
)
patched_method
.
assert_called_once_with
(
original_contents
)
link
=
table
.
find_element_by_css_selector
(
'a'
)
self
.
assertEquals
(
link
.
text
,
'Updated link'
)
problem_builder/tests/integration/xml/table_3.xml
0 → 100644
View file @
9af13c34
<vertical_demo>
<problem-builder
display_submit=
"false"
enforce_dependency=
"false"
>
<pb-table>
<pb-column
header=
"<a href='http://www.test.com'>Link</a> in a column header."
>
<pb-answer-recap
name=
"table_3_answer_1"
/>
</pb-column>
</pb-table>
</problem-builder>
</vertical_demo>
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