From 8d0db64f7856eb5464bdad2a27b8020d2938e142 Mon Sep 17 00:00:00 2001 From: ichuang Date: Sat, 8 Mar 2014 01:00:40 +0000 Subject: [PATCH 1/3] fix capa textline to properly use inline if specified when using js preprocessor --- common/lib/capa/capa/templates/textline.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/common/lib/capa/capa/templates/textline.html b/common/lib/capa/capa/templates/textline.html index f9af308cad..0d0fd4eec0 100644 --- a/common/lib/capa/capa/templates/textline.html +++ b/common/lib/capa/capa/templates/textline.html @@ -3,7 +3,7 @@
% if preprocessor is not None: -
+
% endif From a35d524de27e75e4dcf97e8fdc1fcd072af371c4 Mon Sep 17 00:00:00 2001 From: ichuang Date: Sat, 8 Mar 2014 03:12:40 +0000 Subject: [PATCH 2/3] fix text-input-dynamath_data test in test_input_templates.py --- common/lib/capa/capa/tests/test_input_templates.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/common/lib/capa/capa/tests/test_input_templates.py b/common/lib/capa/capa/tests/test_input_templates.py index 5f8b1a037e..b77a2ce458 100644 --- a/common/lib/capa/capa/tests/test_input_templates.py +++ b/common/lib/capa/capa/tests/test_input_templates.py @@ -431,7 +431,7 @@ class TextlineTemplateTest(TemplateTestCase): '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']" self.assert_has_xpath(xml, xpath, self.context) xpath = "//div[@class='script_placeholder' and @data-src='test_script']" From cac669364f6b01bfc840b2e571b6613fa084bc2f Mon Sep 17 00:00:00 2001 From: ichuang Date: Mon, 10 Mar 2014 13:51:02 +0000 Subject: [PATCH 3/3] more robust capa math preprocessor test, and new test for inline --- common/lib/capa/capa/tests/test_input_templates.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/common/lib/capa/capa/tests/test_input_templates.py b/common/lib/capa/capa/tests/test_input_templates.py index b77a2ce458..a5a3d27753 100644 --- a/common/lib/capa/capa/tests/test_input_templates.py +++ b/common/lib/capa/capa/tests/test_input_templates.py @@ -431,12 +431,21 @@ class TextlineTemplateTest(TemplateTestCase): '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'),