- Issue created by @solideogloria
- last update
about 1 year ago 4 pass - @solideogloria opened merge request.
- Status changed to Needs review
about 1 year ago 3:01pm 18 September 2023 - last update
about 1 year ago 4 pass - last update
about 1 year ago 4 pass - 🇺🇸United States Chris Burge
Chris Burge → made their first commit to this issue’s fork.
- last update
about 1 year ago 4 pass - 🇺🇸United States Chris Burge
@solideogloria - Thanks for quickly catching this bug. We didn't have test coverage for preservation of existing classes. I just pushed a commit to the MR to add test coverage.
- last update
about 1 year ago 4 pass -
Chris Burge →
committed 4bda92b3 on 2.x authored by
solideogloria →
Issue #3388042 by solideogloria: Regression: block attribute classes end...
-
Chris Burge →
committed 4bda92b3 on 2.x authored by
solideogloria →
- Status changed to Fixed
about 1 year ago 5:46pm 18 September 2023 Shouldn't the tests also check that no extra (undesirable) classes are added? That was the issue in this case.
- 🇺🇸United States Chris Burge
@solideogloria - It wasn't that classes were being added per se. The regression was that the existing classes for a block's
attributes
were being assigned as itstitle_attributes
andcontent_attributes
, too, due to unintentional hard-coding. Your MR fixed this bug in thelayout_builder_component_attributes_preprocess_block()
function:- $existing_classes = $variables['attributes']['class'] ?? []; + $existing_classes = $variables[$attribute_name]['class'] ?? [];
Test coverage was added to the MR before committing: https://git.drupalcode.org/project/layout_builder_component_attributes/-...
If you revert the aforementioned line of code and run tests, they'll fail now. Implementing a before/after check would probably be overkill, but if you want to take a stab at it, feel free to open another MR.
I saw the test coverage added; I just didn't understand how that would have caught the issue. I see now. Thanks.
Automatically closed - issue fixed for 2 weeks with no activity.