Skip to content

Commit

Permalink
MDL-43941 Course: Allow AJAX show/hide of activities in hidden and or…
Browse files Browse the repository at this point in the history
…phaned sections
  • Loading branch information
andrewnicols committed Feb 4, 2014
1 parent a7cae26 commit 6a87e32
Show file tree
Hide file tree
Showing 2 changed files with 50 additions and 6 deletions.
50 changes: 50 additions & 0 deletions course/tests/behat/activities_visibility_icons.feature
Original file line number Diff line number Diff line change
Expand Up @@ -36,3 +36,53 @@ Feature: Toggle activities visibility from the course page
And I log in as "student1"
And I follow "Course 1"
And "Test forum name" activity should be hidden

@javascript
Scenario: Activities can be shown and hidden inside a hidden section
Given the following "users" exists:
| username | firstname | lastname | email |
| teacher1 | Teacher | 1 | teacher1@asd.com |
And the following "courses" exists:
| fullname | shortname | format | numsections |
| Course 1 | C1 | topics | 2 |
And the following "course enrolments" exists:
| user | course | role |
| teacher1 | C1 | editingteacher |
And I log in as "teacher1"
And I follow "Course 1"
And I turn editing mode on
And I add a "Forum" to section "2" and I fill the form with:
| Forum name | Test forum name |
| Description | Test forum description |
| Visible | Show |
When I hide section "2"
Then "Test forum name" activity should be hidden
And I click on "Show" "link" in the "Test forum name" activity
And "Test forum name" activity should be visible
And I click on "Hide" "link" in the "Test forum name" activity
And "Test forum name" activity should be hidden

@javascript
Scenario: Activities can be shown and hidden inside an orphaned section
Given the following "users" exists:
| username | firstname | lastname | email |
| teacher1 | Teacher | 1 | teacher1@asd.com |
And the following "courses" exists:
| fullname | shortname | format | numsections |
| Course 1 | C1 | topics | 2 |
And the following "course enrolments" exists:
| user | course | role |
| teacher1 | C1 | editingteacher |
And I log in as "teacher1"
And I follow "Course 1"
And I turn editing mode on
And I add a "Forum" to section "2" and I fill the form with:
| Forum name | Test forum name |
| Description | Test forum description |
| Visible | Show |
When I click on ".reduce-sections" "css_element"
Then "Test forum name" activity should be visible
And I click on "Hide" "link" in the "Test forum name" activity
And "Test forum name" activity should be hidden
And I click on "Show" "link" in the "Test forum name" activity
And "Test forum name" activity should be visible
6 changes: 0 additions & 6 deletions course/yui/toolboxes/toolboxes.js
Original file line number Diff line number Diff line change
Expand Up @@ -370,12 +370,6 @@ YUI.add('moodle-course-toolboxes', function(Y) {
// Prevent the default button action
e.preventDefault();

// Return early if the current section is hidden
var section = e.target.ancestor(M.course.format.get_section_selector(Y));
if (section && section.hasClass(CSS.SECTIONHIDDENCLASS)) {
return;
}

// Get the element we're working on
var element = e.target.ancestor(CSS.ACTIVITYLI);

Expand Down

0 comments on commit 6a87e32

Please sign in to comment.