Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion common/lib/capa/capa/templates/textline.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<section id="inputtype_${id}" class="${'text-input-dynamath' if do_math else ''} capa_inputtype ${doinline} textline" >

% if preprocessor is not None:
<div class="text-input-dynamath_data" data-preprocessor="${preprocessor['class_name']}"/>
<div class="text-input-dynamath_data ${doinline}" data-preprocessor="${preprocessor['class_name']}"/>
<div class="script_placeholder" data-src="${preprocessor['script_src']}"/>
% endif

Expand Down
2 changes: 1 addition & 1 deletion common/lib/capa/capa/tests/test_input_templates.py
Original file line number Diff line number Diff line change
Expand Up @@ -431,7 +431,7 @@ def test_preprocessor(self):
'script_src': 'test_script'}
xml = self.render_to_xml(self.context)

xpath = "//div[@class='text-input-dynamath_data' and @data-preprocessor='test_class']"
xpath = "//div[@class='text-input-dynamath_data ' and @data-preprocessor='test_class']"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This trailing space seems error-prone. Best is to treat the class attribute as a set of space-separated words. That's awkward to do in XPath, but I think this would be a better fix: //div[contains(@class, "text-input-dynamath_data")]

self.assert_has_xpath(xml, xpath, self.context)

xpath = "//div[@class='script_placeholder' and @data-src='test_script']"
Expand Down