Skip to content

Improve Navigation block tests #44920

@getdave

Description

@getdave

The current Nav block tests have grown overly complex and are flaky. These types of tests should be optimised for testing the critical paths to provide confidence that these features continue to work.

Let's rework the tests as follows to provide greater utilility:

We should end up with a small set of tests which are:

  • reliable
  • provide confidence
  • run (relatively) quickly
  • are easy to extend/augment

User stories

First test that we can add the block

  • As a user I want to create an empty menu to replace an existing menu in a navigation block
  • As a user I want to build my navigation manually using internal links (we should test external links on the link component instead of the navigation block suite)
  • As a user I want to insert blocks that are not navigation links in the navigation (one test per possible block)

Submenus

Tests

  • change how submenus open

  • As a user I want to style my submenus different than the menu they're in

Tests

  • set submenu specific typography style
  • set submenu specific background color

Page creation

  • As a user I want to create pages from the navigation block if they don’t exist.

Multiple menu management

  • Create the user stories because we have none yet

Patterns

  • As a user I want demo navigation items in a pattern, even if I have existing menus
  • As a user I want to be able to modify demo content in a pattern

Permissions

  • As a user I want to see a warning if I don’t have permission to create a navigation menu
  • As a user I want to see a warning if I don’t have permission to edit a navigation menu
  • As a user I don’t want to see the delete button if I don’t have permission to delete a navigation menu

Fallbacks

Overlay

  • As a user I want to set up an overlay variant of the navigation block
  • As a user I want to change the colors of the submenu and overlay

Loading states

Color handling

Themes

  • As a theme I want the navigation block to render an accessible aria label
  • As a theme I want the navigation view script to only load if there is a rendered navigation block on screen

Developer stories:

  • As a developer I want to set the nesting level of the navigation block (maybe a unit test?)
  • As a plugin developer I want my custom placehol

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions