Commit df1a7f0c by Calen Pennington

Merge pull request #8 from cpennington/count-acid-children-only

Count only acid-children in javascript child count tests.
parents 3d1e4246 805ef6bb
...@@ -119,7 +119,7 @@ class AcidBlock(XBlock): ...@@ -119,7 +119,7 @@ class AcidBlock(XBlock):
# Retrieve the field named for the scope (whose value is a dictionary) # Retrieve the field named for the scope (whose value is a dictionary)
# and add an entry for this block's usage_id, set to `new_value`. # and add an entry for this block's usage_id, set to `new_value`.
getattr(self, scope)[str(self.scope_ids.usage_id)] = new_value getattr(self, scope)[unicode(self.scope_ids.usage_id)] = new_value
query = 'QUERY={}&SCOPE={}'.format(new_value, scope) query = 'QUERY={}&SCOPE={}'.format(new_value, scope)
suffix = 'SUFFIX{}'.format(new_value) suffix = 'SUFFIX{}'.format(new_value)
...@@ -188,7 +188,7 @@ class AcidBlock(XBlock): ...@@ -188,7 +188,7 @@ class AcidBlock(XBlock):
if 'QUERY' not in request.GET: if 'QUERY' not in request.GET:
return FailureResponse("QUERY is missing from query parameters") return FailureResponse("QUERY is missing from query parameters")
stored_value = getattr(self, scope).get(str(self.scope_ids.usage_id)) stored_value = getattr(self, scope).get(unicode(self.scope_ids.usage_id))
query_value = int(request.GET['QUERY']) query_value = int(request.GET['QUERY'])
if stored_value != query_value: if stored_value != query_value:
......
...@@ -11,7 +11,10 @@ function AcidParentBlock(runtime, element) { ...@@ -11,7 +11,10 @@ function AcidParentBlock(runtime, element) {
} }
function childTests() { function childTests() {
if (acidData('acid-child-count') === runtime.children(element).length) { var acidChildCount = runtime.children(element).filter(function(child) {
return child.type == "acid";
}).length;
if (acidData('acid-child-count') == acidChildCount) {
mark('success', '.child-counts-match'); mark('success', '.child-counts-match');
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment