MDL-45138 Conditional availability: toggling AND/OR affects nested groups
authorsam marshall <s.marshall@open.ac.uk>
Thu, 17 Apr 2014 09:47:06 +0000 (10:47 +0100)
committersam marshall <s.marshall@open.ac.uk>
Thu, 17 Apr 2014 13:09:12 +0000 (14:09 +0100)
availability/tests/behat/edit_availability.feature
availability/yui/build/moodle-core_availability-form/moodle-core_availability-form-debug.js
availability/yui/build/moodle-core_availability-form/moodle-core_availability-form-min.js
availability/yui/build/moodle-core_availability-form/moodle-core_availability-form.js
availability/yui/src/form/js/form.js

index ca8e859..45c1c68 100644 (file)
@@ -123,6 +123,22 @@ Feature: edit_availability
     When I click on ".availability-item .availability-delete img" "css_element"
     Then I should not see "or" in the "Restrict access" "fieldset"
 
+    # Add a nested restriction set with two dates so there will be inner connector.
+    When I click on "Add restriction..." "button"
+    And I click on "Restriction set" "button" in the "Add restriction..." "dialogue"
+    And I click on "Add restriction..." "button" in the ".availability-children .availability-list" "css_element"
+    And I click on "Date" "button" in the "Add restriction..." "dialogue"
+    And I click on "Add restriction..." "button" in the ".availability-children .availability-list" "css_element"
+    And I click on "Date" "button" in the "Add restriction..." "dialogue"
+    Then I should see "and" in the ".availability-children .availability-list .availability-connector" "css_element"
+
+    # Check changing the outer one does not affect the inner one.
+    When I set the field "Required restrictions" to "all"
+    Then I should not see "or" in the "Restrict access" "fieldset"
+    When I set the field "Required restrictions" to "any"
+    Then I should see "or" in the "Restrict access" "fieldset"
+    And I should not see "or" in the ".availability-children .availability-list .availability-connector" "css_element"
+
   @javascript
   Scenario: Edit availability using settings in section form
     # Set up.
index 185b4db..429b041 100644 (file)
Binary files a/availability/yui/build/moodle-core_availability-form/moodle-core_availability-form-debug.js and b/availability/yui/build/moodle-core_availability-form/moodle-core_availability-form-debug.js differ
index 37fd6e2..186e404 100644 (file)
Binary files a/availability/yui/build/moodle-core_availability-form/moodle-core_availability-form-min.js and b/availability/yui/build/moodle-core_availability-form/moodle-core_availability-form-min.js differ
index 185b4db..429b041 100644 (file)
Binary files a/availability/yui/build/moodle-core_availability-form/moodle-core_availability-form.js and b/availability/yui/build/moodle-core_availability-form/moodle-core_availability-form.js differ
index fceaada..883f0d0 100644 (file)
@@ -507,7 +507,7 @@ M.core_availability.List.prototype.updateHtml = function() {
     } else {
         connectorText = M.str.availability.or;
     }
-    this.inner.all('.availability-connector span.label').each(function(span) {
+    this.inner.all('> .availability-children > .availability-connector span.label').each(function(span) {
         span.set('innerHTML', connectorText);
     });
 };