This commit is contained in:
Jun Pataleta 2024-03-26 11:16:34 +08:00
commit 638de6002a
No known key found for this signature in database
GPG Key ID: F83510526D99E2C7
3 changed files with 18 additions and 31 deletions

View File

@ -21,8 +21,6 @@
Example context (json):
{
"uservisible": true,
"url": "#",
"icon": "../../../pix/help.svg",
"iconclass": "",
"purpose": "content",
@ -32,22 +30,13 @@
"showtooltip": 1
}
}}
{{#url}}
{{#uservisible}}
<a href="{{url}}"
class="activity-icon activityiconcontainer smaller {{purpose}} {{#branded}}isbranded{{/branded}} btn btn-link courseicon align-self-start mr-2"
{{#showtooltip}}data-toggle="tooltip" title="{{{pluginname}}}" data-placement="top"{{/showtooltip}}
>
<img src="{{{icon}}}" class="activityicon {{iconclass}}"
alt="{{#cleanstr}} activityicon, moodle, {{{pluginname}}} {{/cleanstr}}"
>
</a>
{{/uservisible}}
{{^uservisible}}
<div class="activity-icon activityiconcontainer smaller {{purpose}} {{#branded}}isbranded{{/branded}} courseicon align-self-start mr-2">
<img src="{{{icon}}}" class="activityicon {{iconclass}}"
alt="{{#cleanstr}} activityicon, moodle, {{{pluginname}}} {{/cleanstr}}"
>
</div>
{{/uservisible}}
{{/url}}
<div class="activity-icon activityiconcontainer smaller {{purpose}} {{#branded}}isbranded{{/branded}} courseicon align-self-start mr-2">
<img
src="{{{icon}}}"
class="activityicon {{iconclass}}"
data-region="activity-icon"
data-id="{{cmid}}"
alt="{{#showtooltip}}{{#cleanstr}} activityicon, moodle, {{{pluginname}}} {{/cleanstr}}{{/showtooltip}}"
{{#showtooltip}}title="{{{pluginname}}}"{{/showtooltip}}
>
</div>

View File

@ -25,20 +25,15 @@ Feature: Activity type tooltip.
Scenario: Teacher can see the activity type tooltip only while editing.
Given I am on the "C1" "Course" page logged in as "teacher1"
And I hover over the "Assignment icon" "link" in the "Activity sample 1" "activity"
And "body>.tooltip" "css_element" should not exist
And I hover over the "Page icon" "link" in the "Activity sample 2" "activity"
And "body>.tooltip" "css_element" should not exist
And the "title" attribute of "Activity sample 1" "core_courseformat > Activity icon" should not be set
And the "title" attribute of "Activity sample 2" "core_courseformat > Activity icon" should not be set
And I turn editing mode on
When I hover over the "Assignment icon" "link" in the "Activity sample 1" "activity"
Then I should see "Assignment" in the "body>.tooltip" "css_element"
And I hover over the "Page icon" "link" in the "Activity sample 2" "activity"
And I should see "Page" in the "body>.tooltip" "css_element"
Then the "title" attribute of "Activity sample 1" "core_courseformat > Activity icon" should contain "Assignment"
And the "title" attribute of "Activity sample 2" "core_courseformat > Activity icon" should contain "Page"
Scenario: Student cannot see the activity type tooltip.
Given I am on the "C1" "Course" page logged in as "student1"
When I hover over the "Assignment icon" "link" in the "Activity sample 1" "activity"
Then "body>.tooltip" "css_element" should not exist
Then the "title" attribute of "Activity sample 1" "core_courseformat > Activity icon" should not be set
Scenario: Student cannot see the activity icon link if does not have access.
Given I am on the "Activity sample 2" "page activity editing" page logged in as "admin"

View File

@ -44,6 +44,9 @@ class behat_courseformat extends behat_base {
new behat_component_named_selector('Activity visibility', [
".//*[@data-activityname=%locator%]//*[@data-region='visibility']",
]),
new behat_component_named_selector('Activity icon', [
".//*[@data-activityname=%locator%]//*[@data-region='activity-icon']",
]),
];
}
}