diff --git a/blocks/timeline/classes/output/main.php b/blocks/timeline/classes/output/main.php index fd555e02067..05f0084862a 100644 --- a/blocks/timeline/classes/output/main.php +++ b/blocks/timeline/classes/output/main.php @@ -102,7 +102,7 @@ class main implements renderable, templatable { */ private function get_filter_offsets() { - $limit = false; + $limit = ''; if (in_array($this->filter, [BLOCK_TIMELINE_FILTER_BY_NONE, BLOCK_TIMELINE_FILTER_BY_OVERDUE])) { $offset = -14; if ($this->filter == BLOCK_TIMELINE_FILTER_BY_OVERDUE) { @@ -170,8 +170,8 @@ class main implements renderable, templatable { 'sorttimelinecourses' => $this->order == BLOCK_TIMELINE_SORT_BY_COURSES, 'selectedfilter' => $this->filter, 'hasdaysoffset' => true, - 'hasdayslimit' => $offsets['dayslimit'] !== false , - 'nodayslimit' => $offsets['dayslimit'] === false , + 'hasdayslimit' => $offsets['dayslimit'] !== '' , + 'nodayslimit' => $offsets['dayslimit'] === '' , 'limit' => $this->limit ]; return array_merge($contextvariables, $filters, $offsets); diff --git a/blocks/timeline/tests/behat/block_timeline_courses.feature b/blocks/timeline/tests/behat/block_timeline_courses.feature index ad50e694ed6..1a21635f437 100644 --- a/blocks/timeline/tests/behat/block_timeline_courses.feature +++ b/blocks/timeline/tests/behat/block_timeline_courses.feature @@ -77,7 +77,7 @@ Feature: The timeline block allows users to see upcoming courses And I click on "Sort by dates" "link" in the "Timeline" "block" And I click on "Sort timeline items" "button" in the "Timeline" "block" And I click on "Sort by courses" "link" in the "Timeline" "block" - And I reload the page + When I reload the page Then I should see "Course 1" in the "Timeline" "block" And I should see "Course 2" in the "Timeline" "block" And I should see "More courses" in the "Timeline" "block" @@ -89,3 +89,25 @@ Feature: The timeline block allows users to see upcoming courses And I should not see "Test feedback 2 closes" in the "Timeline" "block" And I should not see "Test feedback 3 closes" in the "Timeline" "block" And I should not see "Test assign 1 is due" in the "Timeline" "block" + + Scenario: Persistent All in course view + Given I log in as "student1" + And I click on "Sort timeline items" "button" in the "Timeline" "block" + And I click on "Sort by courses" "link" in the "Timeline" "block" + And I click on "Filter timeline items" "button" in the "Timeline" "block" + And I click on "All" "link" in the "Timeline" "block" + When I reload the page + And I click on "More courses" "button" in the "Timeline" "block" + Then I should see "Course 3" in the "Timeline" "block" + And I should see "Course 2" in the "Timeline" "block" + And I should see "Course 1" in the "Timeline" "block" + And I should see "Test choice 1 closes" in the "Timeline" "block" + And I should see "Test choice 3 closes" in the "Timeline" "block" + And I should see "Test feedback 1 closes" in the "Timeline" "block" + And I should see "Test feedback 2 closes" in the "Timeline" "block" + And I should see "Test feedback 3 closes" in the "Timeline" "block" + And I should see "Test assign 1 is due" in the "Timeline" "block" + And I should not see "More courses" in the "Timeline" "block" + And I should not see "Course 4" in the "Timeline" "block" + And I should not see "Test choice 2 closes" in the "Timeline" "block" + And I should not see "Test feedback 4 closes" in the "Timeline" "block"