MDL-76104 usertours: Support the Moodle filters

This commit is contained in:
Huong Nguyen
2023-06-26 09:39:08 +07:00
parent 3cd84747cb
commit f4801ce455
4 changed files with 45 additions and 2 deletions
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
+3
View File
@@ -36,6 +36,7 @@ import {dispatchEvent} from 'core/event_dispatcher';
import {eventTypes} from './events';
import {get_string as getString} from 'core/str';
import {prefetchStrings} from 'core/prefetch';
import {notifyFilterContentUpdated} from 'core/event';
/**
* The minimum spacing for tour step to display.
@@ -784,6 +785,8 @@ const Tour = class {
let currentStepNode = $('<span data-flexitour="container"></span>')
.html(stepConfig.template)
.hide();
// Trigger the Moodle filters.
notifyFilterContentUpdated(currentStepNode);
// The scroll animation occurs on the body or html.
let animationTarget = $('body, html')
@@ -0,0 +1,40 @@
@tool @tool_usertours
Feature: Apply Moodle filter to a tour
In order to give more content to a tour
As an administrator
I need to create a user tour with Moodle filters applied
Background:
Given I log in as "admin"
And the following "courses" exist:
| shortname | fullname |
| C1 | Course 1 |
And the following "activities" exist:
| activity | name | content | course |
| page | Page for Usertour | Content of page for Usertour | C1 |
And I add a new user tour with:
| Name | Activity names auto-linking tour |
| Description | Tour with activity names auto-linking filter |
| Apply to URL match | /course/view.php% |
| Tour is enabled | 1 |
And I add steps to the "Activity names auto-linking tour" tour:
| targettype | Title | id_content | Content type |
| Display in middle of page | Activity names auto-linking | Test Activity names auto-linking Filter Page for Usertour | Manual |
@javascript
Scenario: Add a new tour with Activity names auto-linking filter off
Given the "activitynames" filter is "off"
When I am on "Course 1" course homepage
Then I should see "Test Activity names auto-linking Filter" in the "Activity names auto-linking" "dialogue"
And I should see "Page for Usertour" in the "Activity names auto-linking" "dialogue"
And "Page for Usertour" "link" should not exist in the "Activity names auto-linking" "dialogue"
@javascript
Scenario: Add a new tour with Activity names auto-linking filter on
Given the "activitynames" filter is "on"
When I am on "Course 1" course homepage
Then I should see "Test Activity names auto-linking Filter" in the "Activity names auto-linking" "dialogue"
And I should see "Page for Usertour" in the "Activity names auto-linking" "dialogue"
And "Page for Usertour" "link" should exist in the "Activity names auto-linking" "dialogue"
And I click on "Page for Usertour" "link" in the "Activity names auto-linking" "dialogue"
And I should see "Content of page for Usertour"