How Firefox Devs Write Unit Tests for the Private Browsing Indicator

Firefox's private browsing indicator — comprising an icon and a label — appears in two different locations depending on whether horizontal or vertical tabs are enabled. In horizontal tab mode, the indicator sits in the TabsToolbar and displays both the icon and its label, while in vertical tab mode it moves to the Navbar and shows only the icon. Developers writing unit tests for this behavior first grep the codebase to locate the relevant CSS and XHTML markup files controlling the indicator's visibility. The CSS rules confirm that the indicator is hidden entirely in non-private windows, repositioned for horizontal tabs, and label-stripped for vertical tabs. Unit tests are structured using add_task, BrowserTestUtils.openNewBrowserWindow with the private flag, and BrowserTestUtils.isVisible to verify correct rendering in both tab configurations.
This is an AI-generated summary. ShortSingh links to the original source for the complete article.
Discussion (0)
Log in to join the discussion and vote.
Log in