Problem/Motivation

We have a branch blocker on whether we've decided on the right approach for testing toolbars.

This is a follow-up to #2461957: examples_toolbar() should use #url and not href.

We have tests for toolbars in the top-level example module, but they pass even when the toolbar is non-functional.

Similarly, we'll most likely eventually have an example dedicated to the toolbar.

Given these things, it's a good idea to figure out how to test the existence of the toolbar in a meaningful way, using Drupal-native tools.

Proposed resolution

Test the toolbar's aria-text to discover whether a given tool and/or tray are present in the page HTML.

Note that this should be ideal, but the ever-changing D8 core has decided to pull the rug out from under us in #2173527: The Menu-Toolbar area should be refactored so that Tray items are nested in the same container as their associated parent Toolbar item. and fixed here: #2548027: Follow-up add back aria-label to toolbar tray

Remaining tasks

User interface changes

API changes

CommentFileSizeAuthor
#4 2505711_4.patch1.85 KBmile23

Comments

mile23’s picture

ianthomas_uk’s picture

Status: Postponed » Active

Blocker is fixed

mile23’s picture

Note that over on that other issue, @_nod said: "@Mile23 that doesn't sound right. A data attribute should be used ideally: data-drupal-selector #2509970: Apply and use data-drupal-selector consistently."

I'm inclined to agree that aria-text isn't a great thing to look for, and that some other attribute might be better, including data-[whatever].

For instance, I see a data-toolbar-tray="toolbar-item-administration-tray" right now on my D8 page, and that looks like a much more structured chunk of data to check for.

mile23’s picture

Status: Active » Needs review
StatusFileSize
new1.85 KB

Switched the test to use xpath to verify the toolbar items.

Mile23 queued 4: 2505711_4.patch for re-testing.

  • Mile23 committed 79c5f46 on 8.x-1.x
    Issue #2505711 by Mile23, ianthomas_uk: Fix toolbar tests
    
mile23’s picture

Status: Needs review » Fixed

And fixed.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.