Closed (fixed)
Project:
Drupal core
Version:
9.4.x-dev
Component:
menu system
Priority:
Normal
Category:
Task
Assigned:
Unassigned
Issue tags:
Reporter:
Created:
22 Apr 2022 at 14:07 UTC
Updated:
29 May 2022 at 20:09 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #2
catchComment #3
gábor hojtsyComment #4
eojthebraveComment #5
catchComment #6
catchComment #7
phjouHi, I'm starting working on this issue at Drupalcon Portland
Comment #8
andregp commentedIf we dig down
AssertMenuActiveTrailTrait.phphas only one function that is only used insideAssertBreadcrumbTrait::assertBreadcrumb.AssertBreadcrumbTrait.phpis used by 9 different tests:7 of them already use 'stark' as the default theme, 1 hasn't a default theme (
BreadcrumbTest.php) and only 1 uses 'classy' (BreadcrumbFrontCacheContextsTest.php). Moreover,BreadcrumbFrontCacheContextsTest.phpactually does not use any of the functions fromAssertBreadcrumbTrait.php(I confirmed this by removing the use statement and running the test locally).So, with that I believe that
AssertMenuActiveTrailTrait.phpmay not need to be refactored to work with Stark.Comment #10
Frank Fu commentedHi, I am also working on this.
Comment #11
markie commentedWorking on this at Portland2022
Comment #12
eric.guerin@ucsf.edu commentedAlso found that menu-item--active-trail is still in Olivero, so we questioning end goal of ticket, because we can't just change it to use menu__item--active-trail because it would break the Olivero test as well.
Wondering next step?
Comment #13
eojthebraveFYI. This just got committed a little bit ago. #3276618: Olivero sets inconsistent classes for active trail between menu and book. And changes the class in Olivero. As well as provides a temporary work around for the test trait. This issue is still necessary to make the tests not hard-coded to any particular theme, but is no longer blocking Olivero.
Comment #14
danflanagan8In the closely related issue #3248309: AssertBreadcrumbTrait should not rely on Classy, here's a comment I wrote at the time:
The trait is used to test Classy/Bartik, so changing it to work with Stark doesn't make sense to me. It should either (1) be changed to work with Olivero or (2) be modified to allow additional parameters.
For (2) we would add optional parameters to
AssertBreadcrumbTrait::assertBreadcrumbandAssertMenuActiveTrailTrait::assertMenuActiveTrailthat would be used to specify the active trail class and the active class. They would default tomenu-item--active-trailandis-activerespectively.Updating status to active since there is nothing to review.
Comment #15
markie commentedAdding tag
Comment #16
catchThis sounds like a very good straightforward solution. The trait is little-used, but it's used enough that we shouldn't break it for contrib tests relying on classy, and it will allow it to be used for different themes with different markup later.
Comment #17
andregp commentedI'm gonna work on @danflanagan8 suggestion at #14
Comment #18
andregp commentedAs suggested on #14 I added the optional parameters active_trail_class (w/ default value 'menu-item--active-trail') and active_class (w/ default vaule 'is-active') to AssertBreadcrumbTrait::assertBreadcrumb and AssertMenuActiveTrailTrait::assertMenuActiveTrail making the needed substitutions.
Comment #19
andregp commentedI forgot to change status.
Comment #20
danflanagan8@angregp, the change looked good to me but something is off. The patch failed to apply. Back to NW.
Comment #21
andregp commentedOkay, I might be some commits behind. I'll update my repo and reroll it :)
Comment #22
andregp commentedUpdated patch!
Comment #23
andregp commentedSorry, forgot one more update.
Comment #24
danflanagan8We'll see, but I think that patch is going to fail, that is if I am correctly understanding what was happening in #3276618: Olivero sets inconsistent classes for active trail between menu and book.
I would expect you have to change the assertion around line 292 of
Drupal\Tests\system\Functional\Menu::BreadcrumbTestto use the new arguments. Something like$this->assertBreadcrumb($link_path, $trail, $term->getName(), $tree, 'menu__item--active-trail');
We can wait and see or you could run
Drupal\Tests\system\Functional\Menu::BreadcrumbTestand see if it fails.Comment #25
danflanagan8Hurray! It's good to be wrong. This patch is RTBC.
I was under the impression that
Drupal\Tests\system\Functional\Menu::BreadcrumbTestwas already using Olivero. Not true. Still using Bartik. So that change I mentioned in #23 will have to be made whenever Olivero is added to the standard profile.Comment #26
eojthebraveUpdated the code in
\Drupal\Tests\system\Functional\Menu\BreadcrumbTest::testBreadCrumbsnow that Olivero is the default theme in the standard profile.Comment #28
danflanagan8That sure looks like a random fail, or if not random certainly unrelated. Update looks good to me.
Comment #30
eojthebraveAgree that this is at least not related to the changes in this issue. See #3278215: (Not so) Random test failures SettingsTrayIntegrationTest
Comment #31
andregp commentedRadom fail. Requeueing tests and restoring status.
Comment #33
andregp commentedUnrelated random fail again, restoring status.
(You may notice that the third test fail was even from a different test.)
Comment #34
alexpottCommitted and pushed 3eedc9628e to 10.0.x and 537c279861 to 9.5.x and 9fcb0a0221 to 9.4.x. Thanks!