MDL-76904 question: Keep question highlight in url

This commit is contained in:
hieuvu 2023-01-27 15:10:50 +07:00
parent 5dbac075be
commit 1912982e95
2 changed files with 38 additions and 4 deletions

View File

@ -29,11 +29,10 @@ require_once($CFG->dirroot . '/question/editlib.php');
list($thispageurl, $contexts, $cmid, $cm, $module, $pagevars) =
question_edit_setup('questions', '/question/edit.php');
$url = new moodle_url($thispageurl);
if (($lastchanged = optional_param('lastchanged', 0, PARAM_INT)) !== 0) {
$url->param('lastchanged', $lastchanged);
$thispageurl->param('lastchanged', $lastchanged);
}
$PAGE->set_url($url);
$PAGE->set_url($thispageurl);
if ($PAGE->course->id == $SITE->id) {
$PAGE->set_primary_active_tab('home');
@ -53,7 +52,7 @@ echo $OUTPUT->header();
$renderer = $PAGE->get_renderer('core_question', 'bank');
// Render the selection action.
$qbankaction = new \core_question\output\qbank_action_menu($url);
$qbankaction = new \core_question\output\qbank_action_menu($thispageurl);
echo $renderer->render($qbankaction);
// Print the question area.

View File

@ -0,0 +1,35 @@
@core @core_question
Feature: A teacher can see highlighted questions in the question bank
In order to see my edited questions
As a teacher
I need to be able see the highlight of my edited question.
Background:
Given the following "users" exist:
| username | firstname | lastname | email |
| teacher1 | Teacher | 1 | teacher1@example.com |
And the following "courses" exist:
| fullname | shortname | format |
| Course 1 | C1 | weeks |
And the following "course enrolments" exist:
| user | course | role |
| teacher1 | C1 | editingteacher |
And the following "question categories" exist:
| contextlevel | reference | name |
| Course | C1 | Test questions |
And 101 "questions" exist with the following data:
| questioncategory | Test questions |
| qtype | essay |
| name | essay [count] |
| questiontext | Write about whatever you want |
Scenario: Edited question highlight is retained when go to multiple pages.
Given I am on the "Course 1" "core_question > course question bank" page logged in as "teacher1"
And I am on the "essay 1" "core_question > edit" page logged in as "teacher1"
And I set the following fields to these values:
| Question name | essay 1 edited |
And I press "id_submitbutton"
And I should see "essay 1 edited"
And ".highlight" "css_element" should exist in the "#categoryquestions" "css_element"
When I click on "Show all 101" "link"
Then ".highlight" "css_element" should exist in the "#categoryquestions" "css_element"