gecko-dev/browser/components/urlbar/tests/browser-updateResults
Drew Willcoxon f29a6e2eda Bug 1703116 - Add more tests for suggestedIndex results during view updates and tweak the update logic. r=mak
Bug 1701193 (D110365) added a bunch of new tests for suggestedIndex results
during view updates, but they all work by doing one search with search
suggestion results followed by another search with URL results. That means they
do not test the part of the view-update logic that allows new suggestions to
replace other types of results once an existing suggestion row is encountered.

This revision adds four new tests that are analogous to the prior tests except
that their first search returns one suggestion followed by URL results, and
their second search returns search suggestions. Therefore they test the
suggestion-replacement logic mentioned above.

The prior tests all use 4 results as the smaller number of results in each test
(with 10 being the larger number). I think it's better to use 5 instead because
that leaves 2 results left over when 1 heuristic and up to 2 suggestedIndex
results are also included, instead of only 1 result left over. That should make
the tests a little more rigorous. Also, 5 is half of 10, so that's a little
nicer too. For consistency I updated the prior tests so that they use 5 instead
of 4 too.

Finally, this revision makes one non-test change. When the update logic
determines whether a new suggestedIndex result is in the right spot, it should
calculate the final index relative to `results.length`, not from the current
number of rows, since `results.length` is the final number of rows once the
update is done and stale rows are removed. The current logic isn't exactly
wrong, but it means that a suggestedIndex result can appear farther down the
view during the update before moving up to its final spot after stale rows are
removed. That can be perceived as flicker, so I think it's better not to show it
at all during the update.

Differential Revision: https://phabricator.services.mozilla.com/D110870
2021-04-07 22:53:09 +00:00
..
browser.ini
browser_appendSpanCount.js
browser_reuse.js
browser_suggestedIndex_5_search_5_url.js
browser_suggestedIndex_5_search_10_url.js
browser_suggestedIndex_5_url_5_search.js
browser_suggestedIndex_5_url_10_search.js
browser_suggestedIndex_10_search_5_url.js
browser_suggestedIndex_10_search_10_url.js
browser_suggestedIndex_10_url_5_search.js
browser_suggestedIndex_10_url_10_search.js
head.js