diff --git a/course/format/templates/local/content/cm/cmicon.mustache b/course/format/templates/local/content/cm/cmicon.mustache index 31ecc99fe5b..a56a4162e36 100644 --- a/course/format/templates/local/content/cm/cmicon.mustache +++ b/course/format/templates/local/content/cm/cmicon.mustache @@ -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}} - - {{#cleanstr}} activityicon, moodle, {{{pluginname}}} {{/cleanstr}} - - {{/uservisible}} - {{^uservisible}} -
- {{#cleanstr}} activityicon, moodle, {{{pluginname}}} {{/cleanstr}} -
- {{/uservisible}} -{{/url}} +
+ {{#showtooltip}}{{#cleanstr}} activityicon, moodle, {{{pluginname}}} {{/cleanstr}}{{/showtooltip}} +
diff --git a/course/format/tests/behat/activity_icon_tooltip.feature b/course/format/tests/behat/activity_icon_tooltip.feature index 861ec2fb998..75a09e81503 100644 --- a/course/format/tests/behat/activity_icon_tooltip.feature +++ b/course/format/tests/behat/activity_icon_tooltip.feature @@ -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" diff --git a/course/format/tests/behat/behat_courseformat.php b/course/format/tests/behat/behat_courseformat.php index b03bad1ae4f..5dc9ea8848e 100644 --- a/course/format/tests/behat/behat_courseformat.php +++ b/course/format/tests/behat/behat_courseformat.php @@ -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']", + ]), ]; } }