• 
      

    Add typing and HTML element test improvements for JavaScript.

    Review Request #14403 — Created April 24, 2025 and submitted — Latest diff uploaded

    Information

    Review Board
    release-7.1.x

    Reviewers

    This updates our JavaScript codebase to fix some typing issues and to
    make it easier to compare HTML elements in testing.

    We now set a global reference to the babel-plugin-django-gettext
    types, which provides a merged Underscore.js + Gettext type for _.
    This allows us to use _.funcs() as normal while also properly
    localizing strings using the _ prefix.

    Modules may also now use declare to declare types . This is useful for
    classes that want to type a definition on the prototype that will be set
    elsewhere (such as via the @spina decorator).

    Unit tests that compare elements will now see the HTML of both values in
    any error messages. This is done by registering a custom object
    formatter that works with HTMLElement and subclasses. This just uses
    the outerHTML of each value.

    Unit tests pass.

    Made use of all of this in in-progress changes.

    Commits

    Files