Skip to content

Commit

Permalink
MDL-51260 tags: Update the tags form element to use the autocomplete …
Browse files Browse the repository at this point in the history
…field

AMOS BEGIN
    REM [interestslist_help,moodle] Commas are no longer required
    REM [entertags,tag] Commas are no longer required
    REM [othertags,tag] Commas are no longer required
AMOS END
  • Loading branch information
Damyon Wiese committed Oct 15, 2015
1 parent 25de6f3 commit bb6ca6f
Show file tree
Hide file tree
Showing 7 changed files with 88 additions and 265 deletions.
54 changes: 17 additions & 37 deletions admin/tool/behat/tests/behat/get_and_set_fields.feature
Original file line number Diff line number Diff line change
Expand Up @@ -35,53 +35,33 @@ Feature: Verify that all form fields values can be get and set
And I log in as "admin"
And I expand "Site administration" node
And I expand "Appearance" node
And I follow "Manage tags"
# Select (multi-select) - We will check "I set the field...".
And I set the field "otagsadd" to "OT1, OT2, OT3, OT4, OT5"
And I press "Add official tags"
And I am on site homepage
And I follow "Course 1"
And I follow "Reset"
# Select (multi-select) - Checking "the select box should contain".
And I expand all fieldsets
And the "Unenrol users" select box should contain "No roles"
And the "Unenrol users" select box should contain "Student"
And the "Unenrol users" select box should contain "Non-editing teacher"
And the "Unenrol users" select box should contain "Teacher"
And the "Unenrol users" select box should contain "Manager"
And the "Unenrol users" select box should contain "No roles, Student, Non-editing teacher, Teacher, Manager"
And the "Unenrol users" select box should contain "Manager, Teacher, Non-editing teacher, Student, No roles"
And the "Unenrol users" select box should not contain "President"
And the "Unenrol users" select box should not contain "Baker"
And the "Unenrol users" select box should not contain "President, Baker"
And I am on site homepage
And I follow "Course 1"
And I turn editing mode on
And I follow "Test this one"
And I press "Create page"
# Select (multi-select) - Checking "the select box should contain".
And the "tags[officialtags][]" select box should contain "OT1"
And the "tags[officialtags][]" select box should contain "OT2"
And the "tags[officialtags][]" select box should contain "OT3"
And the "tags[officialtags][]" select box should contain "OT4"
And the "tags[officialtags][]" select box should contain "OT5"
And the "tags[officialtags][]" select box should contain "OT1, OT2, OT3, OT4, OT5"
And the "tags[officialtags][]" select box should contain "OT5, OT4, OT3, OT2, OT1"
And the "tags[officialtags][]" select box should not contain "OT6"
And the "tags[officialtags][]" select box should not contain "OT7"
And the "tags[officialtags][]" select box should not contain "OT6, OT7"
# Text (textarea & editor) & Select (multi-select) - Checking "I set the following fields to these values".
When I set the following fields to these values:
| HTML format | Student page contents to be tagged |
| tags[officialtags][] | OT1, OT3, OT5 |
| HTML format | Student page contents |
And I press "Save"
Then I should see "Student page contents to be tagged" in the "region-main" "region"
And I should see "OT1" in the ".wiki-tags" "css_element"
And I should see "OT3" in the ".wiki-tags" "css_element"
And I should see "OT5" in the ".wiki-tags" "css_element"
And I should not see "OT2" in the ".wiki-tags" "css_element"
And I should not see "OT4" in the ".wiki-tags" "css_element"
Then I should see "Student page contents" in the "region-main" "region"
And I follow "Edit"
# Select (multi-select) - Checking "I set the field".
And I set the field "tags[officialtags][]" to "OT2, OT4"
And I press "Save"
And I should see "OT2" in the ".wiki-tags" "css_element"
And I should see "OT4" in the ".wiki-tags" "css_element"
And I should not see "OT1" in the ".wiki-tags" "css_element"
And I should not see "OT3" in the ".wiki-tags" "css_element"
And I should not see "OT5" in the ".wiki-tags" "css_element"
And I follow "Edit"
# Select (multi-select) - Checking "the field matches value" and "the field does not match value".
And the field "tags[officialtags][]" matches value "OT2, OT4"
And the field "tags[officialtags][]" does not match value "OT4"
And the field "tags[officialtags][]" does not match value "OT2"
And the field "tags[officialtags][]" does not match value "OT1, OT3, OT5"
And I press "Cancel"
And I follow "Edit settings"
And I expand all fieldsets
# Checkbox - Checking "I set the field".
Expand Down
5 changes: 3 additions & 2 deletions blocks/blog_tags/tests/behat/blogtag.feature
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ Feature: Adding blog tag block
As a user
I need to be able to use block blog tag

@javascript
Scenario: Adding block blog tag to the course
Given the following "users" exist:
| username | firstname | lastname | email |
Expand All @@ -29,7 +30,7 @@ Feature: Adding blog tag block
And I set the following fields to these values:
| Entry title | Blog post from teacher |
| Blog entry body | Teacher blog post content |
| Other tags (enter tags separated by commas) | Cats, dogs |
| Tags | Cats, dogs |
And I press "Save changes"
And I log out
And I log in as "student1"
Expand All @@ -39,7 +40,7 @@ Feature: Adding blog tag block
And I set the following fields to these values:
| Entry title | Blog post from student |
| Blog entry body | Student blog post content |
| Other tags (enter tags separated by commas) | DOGS, mice |
| Tags | dogs, mice |
And I press "Save changes"
And I follow "c1"
Then I should see "Cats" in the "Blog tags" "block"
Expand Down
17 changes: 9 additions & 8 deletions course/tests/behat/coursetags.feature
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
@core @core_course @core_tag
@core @core_course @core_tag @javascript
Feature: Tagging courses
In order to search courses
As a teacher
Expand Down Expand Up @@ -27,7 +27,7 @@ Feature: Tagging courses
And I follow "Course 1"
And I click on "Edit settings" "link" in the "Administration" "block"
And I set the following fields to these values:
| Other tags (enter tags separated by commas) | Mathematics |
| Tags | Mathematics |
And I press "Save and display"
And I log out

Expand All @@ -36,15 +36,16 @@ Feature: Tagging courses
And I follow "Course 1"
And "Course tags" "link" should not exist in the "Administration" "block"
And I click on "Edit settings" "link" in the "Administration" "block"
And the field "Other tags (enter tags separated by commas)" matches value "Mathematics"
And I expand all fieldsets
Then I should see "Mathematics" in the ".form-autocomplete-selection" "css_element"
And I set the following fields to these values:
| Other tags (enter tags separated by commas) | Mathematics, Algebra |
| Tags | Algebra |
And I press "Save and display"
And I click on "Dashboard" "link" in the "Navigation" "block"
And I follow "Course 2"
And I click on "Edit settings" "link" in the "Administration" "block"
And I set the following fields to these values:
| Other tags (enter tags separated by commas) | Mathematics, Geometry |
| Tags | Mathematics, Geometry |
And I press "Save and display"
And I log out
And I log in as "user1"
Expand All @@ -71,15 +72,15 @@ Feature: Tagging courses
And I follow "Course 1"
And "Edit settings" "link" should not exist in the "Administration" "block"
And I click on "Course tags" "link" in the "Administration" "block"
And the field "Other tags (enter tags separated by commas)" matches value "Mathematics"
Then I should see "Mathematics" in the ".form-autocomplete-selection" "css_element"
And I set the following fields to these values:
| Other tags (enter tags separated by commas) | Mathematics, Algebra |
| Tags | Algebra |
And I press "Save changes"
And I click on "Dashboard" "link" in the "Navigation" "block"
And I follow "Course 2"
And I click on "Course tags" "link" in the "Administration" "block"
And I set the following fields to these values:
| Other tags (enter tags separated by commas) | Mathematics, Geometry |
| Tags | Mathematics, Geometry |
And I press "Save changes"
And I log out
And I log in as "user1"
Expand Down
2 changes: 1 addition & 1 deletion lang/en/moodle.php
Original file line number Diff line number Diff line change
Expand Up @@ -1002,7 +1002,7 @@
$string['instudentview'] = 'in student view';
$string['interests'] = 'Interests';
$string['interestslist'] = 'List of interests';
$string['interestslist_help'] = 'Enter your interests separated by commas. Your interests will be displayed on your profile page as tags.';
$string['interestslist_help'] = 'Enter your interests. Your interests will be displayed on your profile page as tags.';
$string['invalidemail'] = 'Invalid email address';
$string['invalidlogin'] = 'Invalid login, please try again';
$string['invalidusername'] = 'The username can only contain alphanumeric lowercase characters, underscore (_), hyphen (-), period (.) or at symbol (@)';
Expand Down
4 changes: 2 additions & 2 deletions lang/en/tag.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
$string['description'] = 'Description';
$string['editname'] = 'Edit tag name';
$string['edittag'] = 'Edit this tag';
$string['entertags'] = 'Enter tags separated by commas';
$string['entertags'] = 'Enter tags...';
$string['errortagfrontpage'] = 'Tagging the site main page is not allowed';
$string['errorupdatingrecord'] = 'Error updating tag record';
$string['eventtagadded'] = 'Tag added to an item';
Expand All @@ -63,7 +63,7 @@
$string['nothingtoupdate'] = 'Nothing to update';
$string['officialtag'] = 'Official';
$string['otags'] = 'Official tags';
$string['othertags'] = 'Other tags (enter tags separated by commas)';
$string['othertags'] = 'Other tags';
$string['owner'] = 'Owner';
$string['ptags'] = 'User defined tags (Comma separated)';
$string['relatedblogs'] = 'Most recent blog entries';
Expand Down
Loading

0 comments on commit bb6ca6f

Please sign in to comment.