Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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
11 changes: 10 additions & 1 deletion common/lib/capa/capa/tests/test_input_templates.py
Original file line number Diff line number Diff line change
Expand Up @@ -431,12 +431,21 @@ 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[contains(@class, 'text-input-dynamath_data') and @data-preprocessor='test_class']"
self.assert_has_xpath(xml, xpath, self.context)

xpath = "//div[@class='script_placeholder' and @data-src='test_script']"
self.assert_has_xpath(xml, xpath, self.context)

def test_do_inline_and_preprocessor(self):
self.context['preprocessor'] = {'class_name': 'test_class',
'script_src': 'test_script'}
self.context['inline'] = True
xml = self.render_to_xml(self.context)

xpath = "//div[contains(@class, 'text-input-dynamath_data inline') and @data-preprocessor='test_class']"
self.assert_has_xpath(xml, xpath, self.context)

def test_do_inline(self):
cases = [('correct', 'correct'),
('unsubmitted', 'unanswered'),
Expand Down