Bug 1909211 - Bookmark dialogs suggests all already entered tags instead of just the new matching one. r=daisuke,places-reviewers

Differential Revision: https://phabricator.services.mozilla.com/D217803
This commit is contained in:
Marco Bonardo 2024-07-31 16:51:40 +00:00
Родитель 2c49e957b4
Коммит 669fac9888
3 изменённых файлов: 17 добавлений и 2 удалений

Просмотреть файл

@ -57,6 +57,8 @@ interface nsIAutoCompleteSimpleResult : nsIAutoCompleteResult
* @param aFinalCompleteValue
* Value used when the user confirms selecting this match. If not
* provided, aValue will be used.
* @param aLabel
* The label to show in the autocomplete panel.
*/
void insertMatchAt(in long aIndex,
in AString aValue,
@ -80,6 +82,8 @@ interface nsIAutoCompleteSimpleResult : nsIAutoCompleteResult
* @param aFinalCompleteValue
* Value used when the user confirms selecting this match. If not
* provided, aValue will be used.
* @param aLabel
* The label to show in the autocomplete panel.
*/
void appendMatch(in AString aValue,
in AString aComment,

Просмотреть файл

@ -497,7 +497,7 @@ class TagSearch {
for (let i = 0; i < matchingTags.length; ++i) {
let tag = matchingTags[i];
// For each match, prepend what the user has typed so far.
this._result.appendMatch(before + tag, tag);
this._result.appendMatch(before + tag, null, null, null, null, tag);
// In case of many tags, notify once every 10.
if (i % 10 == 0) {
this._notifyResult(true);

Просмотреть файл

@ -78,7 +78,18 @@ async function ensure_tag_results(results, searchTerm) {
Assert.equal(controller.matchCount, results.length);
for (var i = 0; i < controller.matchCount; i++) {
Assert.equal(controller.getValueAt(i), results[i]);
// TODO (Bug 1910073): not using getValueAt because it returns the label.
Assert.equal(
controller.getFinalCompleteValueAt(i),
results[i],
"Value should be the list of all the set tags plus the suggested one"
);
Assert.strictEqual(controller.getCommentAt(i), null);
Assert.equal(
controller.getLabelAt(i),
results[i].split(/[,;]/).pop().trim(),
"Label should just be the suggested tag"
);
}
resolve();