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
| Comment | File | Size | Author |
|---|---|---|---|
| #4 | 2505711_4.patch | 1.85 KB | mile23 |
Comments
Comment #1
mile23This issue is postponed on #2548027: Follow-up add back aria-label to toolbar tray
Comment #2
ianthomas_ukBlocker is fixed
Comment #3
mile23Note 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-textisn't a great thing to look for, and that some other attribute might be better, includingdata-[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.Comment #4
mile23Switched the test to use xpath to verify the toolbar items.
Comment #7
mile23And fixed.