MDL-42253 course management: fixed course pagination

If the number of courses === the number per page pagination
was being incorrectly rendered.
Fixed this and added a behat test to confirm it.
This commit is contained in:
Sam Hemelryk
2013-10-11 12:09:23 +13:00
parent 89376590c0
commit 7c033254d4
2 changed files with 36 additions and 1 deletions
+1 -1
View File
@@ -486,7 +486,7 @@ class core_course_management_renderer extends plugin_renderer_base {
$html .= html_writer::div($str, 'listing-pagination-totals dimmed');
}
if ($totalcourses < $perpage) {
if ($totalcourses <= $perpage) {
return $html;
}
$aside = 2;
@@ -515,6 +515,41 @@ Feature: Course category management interface performs as expected
And I should see "Next" in the "#course-listing .listing-pagination" "css_element"
And I should see "Last" in the "#course-listing .listing-pagination" "css_element"
Scenario: Test pagination is only shown when required
Given the following "categories" exists:
| name | category | idnumber |
| Cat 1 | 0 | CAT1 |
And the following "courses" exists:
| category | fullname | shortname | idnumber |
| CAT1 | Course 1 | Course 1 | C1 |
| CAT1 | Course 2 | Course 2 | C2 |
| CAT1 | Course 3 | Course 3 | C3 |
| CAT1 | Course 4 | Course 4 | C4 |
| CAT1 | Course 5 | Course 5 | C5 |
And I log in as "admin"
And I go to the courses management page
And I should see the "Course categories" management page
And I click on "Cat 1" "link"
# Redirect.
And I should see the "Course categories and courses" management page
And I click on "Re-sort courses" "link"
And I click on "By idnumber" "link" in the ".course-listing-actions" "css_element"
# Redirect.
And I should see "Per page: 20" in the ".course-listing-actions" "css_element"
And I should see course listing "Course 1" before "Course 2"
And I should see course listing "Course 2" before "Course 3"
And I should see course listing "Course 3" before "Course 4"
And I should see course listing "Course 4" before "Course 5"
And "#course-listing .listing-pagination" "css_element" should not exists
And I click on "5" "link" in the ".course-listing-actions" "css_element"
# Redirect
And I should see "Per page: 5" in the ".course-listing-actions" "css_element"
And I should see course listing "Course 1" before "Course 2"
And I should see course listing "Course 2" before "Course 3"
And I should see course listing "Course 3" before "Course 4"
And I should see course listing "Course 4" before "Course 5"
And "#course-listing .listing-pagination" "css_element" should not exists
# We need at least 30 courses for this next test.
@javascript
Scenario: Test many course pagination