aboutsummaryrefslogtreecommitdiffstats
path: root/web_src/js/utils.test.js
diff options
context:
space:
mode:
authorHeySora <contact@heysora.net>2022-09-28 00:55:15 +0200
committerGitHub <noreply@github.com>2022-09-28 00:55:15 +0200
commitdabc06d13b02fec3887dbf4f7f2f4eeb44efcf89 (patch)
tree51c00084b7cdb9923d1f20821d62d33a133a28da /web_src/js/utils.test.js
parent8cd3237a9ef6dfa438d97c7ff2ffbd5fb8db6247 (diff)
downloadgitea-dabc06d13b02fec3887dbf4f7f2f4eeb44efcf89.tar.gz
gitea-dabc06d13b02fec3887dbf4f7f2f4eeb44efcf89.zip
Feature: Case-insensitive "find files in repo" (#21269)
This (short) PR builds upon #15028 and makes the file search case-insensitive. Previously, having a file named `TestFile.cs` would not be shown if `test` was typed in the search box. This now changes the matching function to be case-insensitive (without affecting the UI). The matching function, `strSubMatch`, is only used for this feature (it has been introduced by #15028), meaning that this PR does not affect the behaviour of any unrelated functionality of Gitea.
Diffstat (limited to 'web_src/js/utils.test.js')
-rw-r--r--web_src/js/utils.test.js3
1 files changed, 3 insertions, 0 deletions
diff --git a/web_src/js/utils.test.js b/web_src/js/utils.test.js
index 90fb08e8e4..5c17c162af 100644
--- a/web_src/js/utils.test.js
+++ b/web_src/js/utils.test.js
@@ -95,6 +95,9 @@ test('strSubMatch', () => {
expect(strSubMatch('abc', 'z')).toEqual(['abc']);
expect(strSubMatch('abc', 'az')).toEqual(['abc']);
+ expect(strSubMatch('abc', 'aC')).toEqual(['', 'a', 'b', 'c']);
+ expect(strSubMatch('abC', 'ac')).toEqual(['', 'a', 'b', 'C']);
+
expect(strSubMatch('aabbcc', 'abc')).toEqual(['', 'a', 'a', 'b', 'b', 'c', 'c']);
expect(strSubMatch('the/directory', 'hedir')).toEqual(['t', 'he', '/', 'dir', 'ectory']);
});