Skip to content

Commit

Permalink
(Autocomplétion) Ajout de commentaires
Browse files Browse the repository at this point in the history
Co-authored-by: Ph. SW. <[email protected]>
  • Loading branch information
Situphen and philippemilink committed Sep 22, 2024
1 parent db91a0c commit 3df9934
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
1 change: 1 addition & 0 deletions assets/js/autocompletion.js
Original file line number Diff line number Diff line change
Expand Up @@ -236,6 +236,7 @@
self.handleInput()
}

// Exclude already selected items but the last one (it's the prefix of the item we are looking for)
const alreadyChosenWords = self.extractWords(this.$input.val()).slice(0, -1)
list = self.filterData(list, alreadyChosenWords)

Expand Down
13 changes: 12 additions & 1 deletion zds/member/api/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,18 @@ def test_search_without_results_in_list_of_users(self):
def test_search_with_results_in_right_order(self):
"""
Gets list of users corresponding to part of a username and
verifies that the list of usernames returned is in the right order.
verifies that this list is in the right order, which is:
1. "is equal" case sensitive
2. "is equal" ignoring the case
3. "starts with" case sensitive
4. "starts with" ignoring the case
5. "contains" case sensitive
6. "contains" ignoring the case
The test also checks that:
- usernames containing letters of the searched word (here: 'a', 'n', 'd' and 'r')
but NOT the searched word ("andr") are not returned
- usernames containing non-ascii letters (eg with accents) can be returned as well
"""
for username in ("pierre", "andr", "Radon", "alexandre", "MisterAndrew", "andré", "dragon", "Andromède"):
ProfileFactory(user__username=username)
Expand Down

0 comments on commit 3df9934

Please sign in to comment.