Merge branch 'MDL-82505-main' of https://github.com/HuongNV13/moodle
This commit is contained in:
@@ -106,6 +106,6 @@ Feature: Enable the calendar block in a course and test it's functionality
|
||||
And I press "Save changes"
|
||||
When I am on "Course 1" course homepage
|
||||
And I follow "Course calendar"
|
||||
And I click on today in the mini-calendar block
|
||||
And I click on today in the mini-calendar block to view the detail
|
||||
Then I should see "Site Event" in the "Calendar" "block"
|
||||
And ".popover" "css_element" should not exist
|
||||
|
||||
@@ -48,10 +48,19 @@ class behat_calendar extends behat_base {
|
||||
new behat_component_named_selector('mini calendar block', [".//*[@data-block='calendar_month']"]),
|
||||
new behat_component_named_selector('full calendar page', [".//*[@id='page-calendar-view']"]),
|
||||
new behat_component_named_selector('calendar day', [".//*[@data-region='day'][@data-day=%locator%]"]),
|
||||
new behat_component_named_selector(
|
||||
'calendar day detail',
|
||||
[".//*[@data-region='day'][@data-day=%locator%]//a[@data-action='view-day-link']"]
|
||||
),
|
||||
new behat_component_named_selector(
|
||||
'responsive calendar day',
|
||||
[".//*[@data-region='day'][@data-day=%locator%]/div[contains(@class, 'hidden-desktop')]"]
|
||||
),
|
||||
new behat_component_named_selector(
|
||||
'responsive calendar day detail',
|
||||
[".//*[@data-region='day'][@data-day=%locator%]" .
|
||||
"/div[contains(@class, 'hidden-desktop')]//a[@data-action='view-day-link']"]
|
||||
),
|
||||
];
|
||||
}
|
||||
|
||||
@@ -139,13 +148,26 @@ class behat_calendar extends behat_base {
|
||||
*
|
||||
* @param int $day The day of the current month.
|
||||
* @param string $responsive If not null, find the responsive version of the link.
|
||||
* @param string $detail If not null, find the detail version of the link.
|
||||
*/
|
||||
public function i_click_on_day_of_this_month_in_mini_calendar_block(int $day, string $responsive = ''): void {
|
||||
public function i_click_on_day_of_this_month_in_mini_calendar_block(
|
||||
int $day,
|
||||
string $responsive = '',
|
||||
string $detail = '',
|
||||
): void {
|
||||
$selectortype = 'core_calendar >';
|
||||
if (!empty($responsive)) {
|
||||
$selectortype .= ' responsive';
|
||||
}
|
||||
$selectortype .= ' calendar day';
|
||||
if (!empty($detail)) {
|
||||
$selectortype .= ' detail';
|
||||
}
|
||||
$this->execute(
|
||||
contextapi: "behat_general::i_click_on_in_the",
|
||||
params: [
|
||||
$day,
|
||||
empty($responsive) ? 'core_calendar > calendar day' : 'core_calendar > responsive calendar day',
|
||||
$selectortype,
|
||||
'',
|
||||
'core_calendar > mini calendar block',
|
||||
],
|
||||
@@ -167,14 +189,16 @@ class behat_calendar extends behat_base {
|
||||
/**
|
||||
* Click on today in the mini-calendar.
|
||||
*
|
||||
* @Given /^I click on today in the mini-calendar block( responsive view|)$/
|
||||
* @Given /^I click on today in the mini-calendar block( responsive view|)( to view the detail|)$/
|
||||
*
|
||||
* @param string $responsive If not empty, use the responsive calendar link.
|
||||
* @param string $detail If not empty, use the detail view calendar link.
|
||||
*/
|
||||
public function i_click_on_today_in_mini_calendar_block(string $responsive = ''): void {
|
||||
public function i_click_on_today_in_mini_calendar_block(string $responsive = '', string $detail = ''): void {
|
||||
$this->i_click_on_day_of_this_month_in_mini_calendar_block(
|
||||
day: date('j'),
|
||||
responsive: $responsive,
|
||||
detail: $detail,
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user