Closed (fixed)
Project:
Drupal core
Version:
9.5.x-dev
Component:
media system
Priority:
Major
Category:
Task
Assigned:
Unassigned
Issue tags:
Reporter:
Created:
3 May 2022 at 15:14 UTC
Updated:
29 Aug 2022 at 12:29 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #2
danflanagan8Comment #3
danflanagan8There are numerous test classes that extend MediaLibraryTestBase but do not declare their own defaultTheme. It is important that we careful check those test classes as well. Here are some notes on those.
)
is-activeclass comes from classy)Also, I'm not quite sure what to do with this assertion in
MediaLibraryTestBase::assertMediaAdded:$assert_session->elementNotExists('css', '.file-size', $fields);The
file-sizeclass gets added by stable/bartik/seven.Comment #5
danflanagan8Regarding:
I've dug a bit deeper. The comment a few lines above that assertion reads:
That method does not do anything directly related to the
file-sizeclass or the markup. The assertion really has no business being there. It's a true assertion in some cases, but media_library doesn't have anything to do with it really. It's also essentially duplicating the assertion above it (which is important and meaningful) that reads:$assert_session->elementNotExists('css', '[data-drupal-selector$="filename"]', $fields);That form element whose existence is tested uses the
file_linktheme, which is where thefile-sizeclass is added by some themes. But of course thefile-sizeclass won't be there if the element using thetheme is not there. Right?
Long story short, I'm going to remove the assertion.
There are zero other assertions in the codebase that relate to
file-size, but if any assertions are needed, they should be added as part of #3117430: file-link template should not always display file_size.Comment #6
danflanagan8For my personal benefit, I have addressed everything in #3 other than item 7 and item 9.
Comment #7
danflanagan8For
EntityReferenceWidgetTestI decided it needs classy so I made a followup to switch it to starterkit. Here's the issue: #3281695: Remove Classy dependency of Media Library's EntityReferenceWidgetTestAlso, per the IS, we are not addressing
Drupal\Tests\media_library\FunctionalJavascript\CKEditorIntegrationTestin this issue.Additional notes for reviewers:
In addition to the obvious changes to css selectors required, I felt the need to improve several assertions in
WidgetOEmbedTestandWidgetViewsTest.I also felt compelled to remove an unnecessary assertion in
MediaLibraryTestBasewithout feeling any compulsion to replace it. That's described in #5.Comment #8
danflanagan8Oops! Let's try this one.
Comment #9
smustgrave commentedLooks good!
Comment #10
quietone commentedNice to see progress here.
The Issue Summary says that Drupal\Tests\media_library\FunctionalJavascript\CKEditorIntegrationTest is not addressed here. I think the issue where that is being taken care of should be included in the IS.
Can we have a more thorough review? I think the patch should be applied locally and then some searching done to ensure that all the tests have been changed. Has the code been reviewed?
I am not qualified to review the code on this but I read the comments and have some questions.
I had to read this more that once. Maybe this version will save others the same problem
'@todo Tests normally uses Stark but that is not suitable because this test relies on classes to assert the order of field items. Change this to Starterkit once it is stable.'
Just a suggestion.
What does 'the selector is good' mean? Does it mean 'valid and exists'? But then what is a 'bad' selector?
Back to NW!
Comment #11
danflanagan8Thanks, @quietone!
10.1: I'm using @xjm's proposed template from the parent issue so I'm going to stick with that: https://www.drupal.org/project/drupal/issues/3083275#comment-14434087
10.2: A fair critique! This updated patch tries to clarify.
On the IS, the link to the issue is already there. And it looks like it's fixed as of about a month ago, which is nice.
I'm going to throw this back to NR to see if we can't get someone to do a more thorough review. Perhaps the reviewer could comment on my comments #5 and/or #7 as part of the review. Those are more substantive changes than are typically happening in these Classy-to-Stark issues.
Thanks!
Comment #12
nod_Except the remaining classy that has a comment pointing out why it's still here I can confirm we don't have classy in the various test methods of the media_library module.
The extra checks make sense to me, I don't see that hurting or slowing down things. most of the changes are swaping one class name for another, or use data-drupal-selector when possible instead of class name. As for the extra tests they make sense to me and test what they say they're testing.
Comment #16
lauriiiThe text on #10.1 is something we've used on multiple tests so it seems like it should be fine here too.
Committed f384111 and pushed to 10.1.x. Also cherry-picked to 10.0.x and 9.5.x. Thanks!