Fix a unit test regression for tests using RB.DraftReviewBannerView.

Review Request #10935 — Created March 3, 2020 and submitted — Latest diff uploaded

Information

Review Board
release-4.0.x

Reviewers

RB.DraftReviewBannerView instantiates a RB.SplitButtonView, which
wraps the new RB.MenuButtonView. This is a bit more strict than the
older RB.SplitButtonView with DOM elements actually being available on
the page. The problem is that during unit test runs, the HTML backing
RB.DraftReviewBannerView is not available, and this ultimately leads
to assertion failures in the menu button.

This is easily solved by making sure we pass in either a DOM element or
a falsy value, rather than a jQuery object with a length of 0. This
change updates the instantiation to do that.

It also adds a big comment above it to point out this fact, for future
work on the banner. Sooner or later, we're going to want to move this to
a CSS component and change the way it's structured, and this quirk will
be important to note at that time.

All unit tests pass.

Manually tested that the review request and diff viewer pages had a
functioning draft banner and Publish button.

Commits

Files