mirror of
https://github.com/moodle/moodle.git
synced 2025-01-17 21:49:15 +01:00
MDL-78775 core_grades: Fix Behat
This commit is contained in:
parent
9048eb1e53
commit
cb2cf0602d
2
grade/amd/build/searchwidget/initials.min.js
vendored
2
grade/amd/build/searchwidget/initials.min.js
vendored
@ -5,6 +5,6 @@ define("core_grades/searchwidget/initials",["exports","core/pending","core/url",
|
||||
* @module core_grades/searchwidget/initials
|
||||
* @copyright 2022 Mathew May <mathew.solutions>
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/Object.defineProperty(_exports,"__esModule",{value:!0}),_exports.init=void 0,_pending=_interopRequireDefault(_pending),Url=function(obj,nodeInterop){if(!nodeInterop&&obj&&obj.__esModule)return obj;if(null===obj||"object"!=typeof obj&&"function"!=typeof obj)return{default:obj};var cache=_getRequireWildcardCache(nodeInterop);if(cache&&cache.has(obj))return cache.get(obj);var newObj={},hasPropertyDescriptor=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var key in obj)if("default"!==key&&Object.prototype.hasOwnProperty.call(obj,key)){var desc=hasPropertyDescriptor?Object.getOwnPropertyDescriptor(obj,key):null;desc&&(desc.get||desc.set)?Object.defineProperty(newObj,key,desc):newObj[key]=obj[key]}newObj.default=obj,cache&&cache.set(obj,newObj);return newObj}(Url),_custom_interaction_events=_interopRequireDefault(_custom_interaction_events),_jquery=_interopRequireDefault(_jquery);let registered=!1;const selectors_pageListItem="page-item",selectors_pageClickableItem=".page-link",selectors_activeItem="active",selectors_formDropdown=".initialsdropdownform",selectors_parentDomNode=".initials-selector",selectors_firstInitial="firstinitial",selectors_lastInitial="lastinitial",selectors_initialBars=".initialbar",selectors_targetButton="initialswidget",selectors_formItems={type:"submit",save:"save",cancel:"cancel"};_exports.init=function(callingLink){let userid=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,searchvalue=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;if(registered)return;const pendingPromise=new _pending.default;registerListenerEvents(callingLink,userid,searchvalue),(0,_jquery.default)(selectors_parentDomNode).on("shown.bs.dropdown",(()=>{document.querySelector(selectors_pageClickableItem).focus({preventScroll:!0})})),pendingPromise.resolve(),registered=!0};const registerListenerEvents=function(callingLink){let userid=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,searchvalue=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;const events=["click",_custom_interaction_events.default.events.activate,_custom_interaction_events.default.events.keyboardActivate];_custom_interaction_events.default.define(document,events),events.forEach((event=>{document.addEventListener(event,(e=>{let{firstActive:firstActive,lastActive:lastActive,sifirst:sifirst,silast:silast}=onClickVariables(),itemToReset="";if(e.target.closest(selectors_formDropdown)&&e.preventDefault(),e.target.closest("".concat(selectors_formDropdown," .").concat(selectors_pageListItem))){if(e.target.classList.contains(selectors_pageListItem))return;e.target.closest(selectors_initialBars).classList.contains(selectors_firstInitial)?(sifirst=e.target,itemToReset=firstActive):(silast=e.target,itemToReset=lastActive),swapActiveItems(itemToReset,e)}if(e.target.closest("".concat(selectors_formDropdown))&&e.target.type===selectors_formItems.type){if(e.target.dataset.action===selectors_formItems.save){const params={id:e.target.closest(selectors_formDropdown).dataset.courseid,searchvalue:null!==searchvalue?searchvalue:"",sifirst:sifirst.parentElement.classList.contains("initialbarall")?"":sifirst.value,silast:silast.parentElement.classList.contains("initialbarall")?"":silast.value};null!==userid&&(params.userid=userid),window.location=Url.relativeUrl(callingLink,params)}e.target.dataset.action===selectors_formItems.cancel&&(0,_jquery.default)(".".concat(selectors_targetButton)).dropdown("toggle")}}))}))},onClickVariables=()=>{const firstItems=[...document.querySelectorAll(".".concat(selectors_firstInitial," li"))],lastItems=[...document.querySelectorAll(".".concat(selectors_lastInitial," li"))],firstActive=firstItems.filter((item=>item.classList.contains(selectors_activeItem)))[0],lastActive=lastItems.filter((item=>item.classList.contains(selectors_activeItem)))[0];let sifirst=firstActive.querySelector(selectors_pageClickableItem),silast=lastActive.querySelector(selectors_pageClickableItem);return{firstActive:firstActive,lastActive:lastActive,sifirst:sifirst,silast:silast}},swapActiveItems=(itemToReset,e)=>{itemToReset.classList.remove(selectors_activeItem),itemToReset.querySelector(selectors_pageClickableItem).ariaCurrent=!1;e.target.parentElement.classList.add(selectors_activeItem),e.target.ariaCurrent=!0}}));
|
||||
*/Object.defineProperty(_exports,"__esModule",{value:!0}),_exports.init=void 0,_pending=_interopRequireDefault(_pending),Url=function(obj,nodeInterop){if(!nodeInterop&&obj&&obj.__esModule)return obj;if(null===obj||"object"!=typeof obj&&"function"!=typeof obj)return{default:obj};var cache=_getRequireWildcardCache(nodeInterop);if(cache&&cache.has(obj))return cache.get(obj);var newObj={},hasPropertyDescriptor=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var key in obj)if("default"!==key&&Object.prototype.hasOwnProperty.call(obj,key)){var desc=hasPropertyDescriptor?Object.getOwnPropertyDescriptor(obj,key):null;desc&&(desc.get||desc.set)?Object.defineProperty(newObj,key,desc):newObj[key]=obj[key]}newObj.default=obj,cache&&cache.set(obj,newObj);return newObj}(Url),_custom_interaction_events=_interopRequireDefault(_custom_interaction_events),_jquery=_interopRequireDefault(_jquery);let registered=!1;const selectors_pageListItem="page-item",selectors_pageClickableItem=".page-link",selectors_activeItem="active",selectors_formDropdown=".initialsdropdownform",selectors_parentDomNode=".initials-selector",selectors_firstInitial="firstinitial",selectors_lastInitial="lastinitial",selectors_initialBars=".initialbar",selectors_targetButton="initialswidget",selectors_formItems={type:"submit",save:"save",cancel:"cancel"};_exports.init=function(callingLink){let gpr_userid=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,gpr_search=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;if(registered)return;const pendingPromise=new _pending.default;registerListenerEvents(callingLink,gpr_userid,gpr_search),(0,_jquery.default)(selectors_parentDomNode).on("shown.bs.dropdown",(()=>{document.querySelector(selectors_pageClickableItem).focus({preventScroll:!0})})),pendingPromise.resolve(),registered=!0};const registerListenerEvents=function(callingLink){let gpr_userid=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,gpr_search=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;const events=["click",_custom_interaction_events.default.events.activate,_custom_interaction_events.default.events.keyboardActivate];_custom_interaction_events.default.define(document,events),events.forEach((event=>{document.addEventListener(event,(e=>{let{firstActive:firstActive,lastActive:lastActive,sifirst:sifirst,silast:silast}=onClickVariables(),itemToReset="";if(e.target.closest(selectors_formDropdown)&&e.preventDefault(),e.target.closest("".concat(selectors_formDropdown," .").concat(selectors_pageListItem))){if(e.target.classList.contains(selectors_pageListItem))return;e.target.closest(selectors_initialBars).classList.contains(selectors_firstInitial)?(sifirst=e.target,itemToReset=firstActive):(silast=e.target,itemToReset=lastActive),swapActiveItems(itemToReset,e)}if(e.target.closest("".concat(selectors_formDropdown))&&e.target.type===selectors_formItems.type){if(e.target.dataset.action===selectors_formItems.save){const params={id:e.target.closest(selectors_formDropdown).dataset.courseid,gpr_search:null!==gpr_search?gpr_search:"",sifirst:sifirst.parentElement.classList.contains("initialbarall")?"":sifirst.value,silast:silast.parentElement.classList.contains("initialbarall")?"":silast.value};null!==gpr_userid&&(params.gpr_userid=gpr_userid),window.location=Url.relativeUrl(callingLink,params)}e.target.dataset.action===selectors_formItems.cancel&&(0,_jquery.default)(".".concat(selectors_targetButton)).dropdown("toggle")}}))}))},onClickVariables=()=>{const firstItems=[...document.querySelectorAll(".".concat(selectors_firstInitial," li"))],lastItems=[...document.querySelectorAll(".".concat(selectors_lastInitial," li"))],firstActive=firstItems.filter((item=>item.classList.contains(selectors_activeItem)))[0],lastActive=lastItems.filter((item=>item.classList.contains(selectors_activeItem)))[0];let sifirst=firstActive.querySelector(selectors_pageClickableItem),silast=lastActive.querySelector(selectors_pageClickableItem);return{firstActive:firstActive,lastActive:lastActive,sifirst:sifirst,silast:silast}},swapActiveItems=(itemToReset,e)=>{itemToReset.classList.remove(selectors_activeItem),itemToReset.querySelector(selectors_pageClickableItem).ariaCurrent=!1;e.target.parentElement.classList.add(selectors_activeItem),e.target.ariaCurrent=!0}}));
|
||||
|
||||
//# sourceMappingURL=initials.min.js.map
|
File diff suppressed because one or more lines are too long
@ -55,15 +55,15 @@ const selectors = {
|
||||
* Our initial hook into the module which will eventually allow us to handle the dropdown initials bar form.
|
||||
*
|
||||
* @param {String} callingLink The link to redirect upon form submission.
|
||||
* @param {Null|Number} userid The user id to filter by.
|
||||
* @param {Null|String} searchvalue The search value to filter by.
|
||||
* @param {Null|Number} gpr_userid The user id to filter by.
|
||||
* @param {Null|String} gpr_search The search value to filter by.
|
||||
*/
|
||||
export const init = (callingLink, userid = null, searchvalue = null) => {
|
||||
export const init = (callingLink, gpr_userid = null, gpr_search = null) => {
|
||||
if (registered) {
|
||||
return;
|
||||
}
|
||||
const pendingPromise = new Pending();
|
||||
registerListenerEvents(callingLink, userid, searchvalue);
|
||||
registerListenerEvents(callingLink, gpr_userid, gpr_search);
|
||||
// BS events always bubble so, we need to listen for the event higher up the chain.
|
||||
$(selectors.parentDomNode).on('shown.bs.dropdown', () => {
|
||||
document.querySelector(selectors.pageClickableItem).focus({preventScroll: true});
|
||||
@ -76,10 +76,10 @@ export const init = (callingLink, userid = null, searchvalue = null) => {
|
||||
* Register event listeners.
|
||||
*
|
||||
* @param {String} callingLink The link to redirect upon form submission.
|
||||
* @param {Null|Number} userid The user id to filter by.
|
||||
* @param {Null|String} searchvalue The search value to filter by.
|
||||
* @param {Null|Number} gpr_userid The user id to filter by.
|
||||
* @param {Null|String} gpr_search The search value to filter by.
|
||||
*/
|
||||
const registerListenerEvents = (callingLink, userid = null, searchvalue = null) => {
|
||||
const registerListenerEvents = (callingLink, gpr_userid = null, gpr_search = null) => {
|
||||
const events = [
|
||||
'click',
|
||||
CustomEvents.events.activate,
|
||||
@ -127,12 +127,12 @@ const registerListenerEvents = (callingLink, userid = null, searchvalue = null)
|
||||
// Then we will redirect the user back onto the page with new filters applied.
|
||||
const params = {
|
||||
'id': e.target.closest(selectors.formDropdown).dataset.courseid,
|
||||
'searchvalue': searchvalue !== null ? searchvalue : '',
|
||||
'gpr_search': gpr_search !== null ? gpr_search : '',
|
||||
'sifirst': sifirst.parentElement.classList.contains('initialbarall') ? '' : sifirst.value,
|
||||
'silast': silast.parentElement.classList.contains('initialbarall') ? '' : silast.value,
|
||||
};
|
||||
if (userid !== null) {
|
||||
params.userid = userid;
|
||||
if (gpr_userid !== null) {
|
||||
params.gpr_userid = gpr_userid;
|
||||
}
|
||||
window.location = Url.relativeUrl(callingLink, params);
|
||||
}
|
||||
|
@ -117,8 +117,8 @@ class core_grades_renderer extends plugin_renderer_base {
|
||||
): stdClass {
|
||||
global $SESSION, $COURSE;
|
||||
// User search.
|
||||
$searchvalue = optional_param('searchvalue', null, PARAM_NOTAGS);
|
||||
$userid = optional_param('userid', null, PARAM_INT);
|
||||
$searchvalue = optional_param('gpr_search', null, PARAM_NOTAGS);
|
||||
$userid = optional_param('grp_userid', null, PARAM_INT);
|
||||
$url = new moodle_url($slug, ['id' => $course->id]);
|
||||
$firstinitial = $SESSION->gradereport["filterfirstname-{$context->id}"] ?? '';
|
||||
$lastinitial = $SESSION->gradereport["filtersurname-{$context->id}"] ?? '';
|
||||
|
@ -363,7 +363,7 @@ Feature: Within the grader report, test that we can search for users
|
||||
Given "42" "users" exist with the following data:
|
||||
| username | students[count] |
|
||||
| firstname | Student |
|
||||
| lastname | test[count] |
|
||||
| lastname | test[count] |
|
||||
| email | students[count]@example.com |
|
||||
And "42" "course enrolments" exist with the following data:
|
||||
| user | students[count] |
|
||||
@ -375,7 +375,7 @@ Feature: Within the grader report, test that we can search for users
|
||||
# Search for a single user on second page and save grades.
|
||||
When I set the field "Search users" to "test42"
|
||||
And I wait until "View all results (1)" "link" exists
|
||||
And I press the enter key
|
||||
And I click on "Student test42" "option_role"
|
||||
And I wait until the page is ready
|
||||
And I give the grade "80.00" to the user "Student test42" for the grade item "Test assignment one"
|
||||
And I press "Save changes"
|
||||
@ -420,7 +420,7 @@ Feature: Within the grader report, test that we can search for users
|
||||
# Search for multiple users on second page and save grades.
|
||||
And I set the field "Search users" to "test4"
|
||||
And I wait until "View all results (4)" "link" exists
|
||||
And I press the enter key
|
||||
And I click on "View all results (4)" "option_role"
|
||||
And I wait until the page is ready
|
||||
And I give the grade "10.00" to the user "Student test42" for the grade item "Test assignment one"
|
||||
And I give the grade "20.00" to the user "Student test40" for the grade item "Test assignment one"
|
||||
|
Loading…
x
Reference in New Issue
Block a user