Fix up some issues in js-tests.

Review Request #14112 — Created Aug. 20, 2024 and submitted — Latest diff uploaded

Information

Review Board
release-7.x

Reviewers

This fixes up two issues encountered when running the js-tests, that
were introduced with the new admin draft stuff.

First, running the test would result in view-draft=1 being added to
the URL query string many many times. The code that does this has been
changed to first check if we're running tests at all and not do
anything. In the case that we're not in unit tests, we now use
URLSearchParams.set() instead of .append(), which prevents us from
having view-draft in the query string multiple times.

Second, several tests unrelated to the unified banner were failing
because there was no dock element available. Most parts of the unified
banner will query for the relevant element, and then calls to append to
those will fail silently, but for getDock() we had an assertion. Since
this is just unit tests, we don't care about that, so I've changed the
treatment of the dock element to match the other parts of the banner.

Ran js-tests and saw that I no longer ended up with ?view-draft=1 in
the query string, and did not have a ton of assertion failures in the
browser console.

Commits

Files