Problem/Motivation
- We need support for sizes, this will primarily be used by picture, but contrib can use this as well in combination with
srcset
Proposed resolution
- Add
sizesattribute to image render
Remaining tasks
Add tests for sizes
User interface changes
None
| Comment | File | Size | Author |
|---|---|---|---|
| #10 | i2333395-10.patch | 2.86 KB | jelle_s |
Comments
Comment #1
jelle_sComment #2
jelle_sComment #3
attiks commentedAssuming test bot is fine with it.
Comment #4
attiks commentedComment #5
attiks commentedComment #6
webchickOnce again, should be KernelTestBase.
It does not actually test srcset.
Also, suggestion from dawehner in IRC on the test itself (this would also apply to the srcset issue):
Since both this and the other patch are going to smack into each other, if you want to combine them into one, feel free.
Comment #7
attiks commentedAFAIK it uses the same principle as the image module for testing, so we need issues to update those tests as well, @dawehner is right that testing HTML is a bit lame.
Comment #8
attiks commentedNew test, since xpath is not working (#2335057: Undefined method getUrl in AssertContentTrait::parse causes fatal error) is uses assertRaw.
Comment #9
rainbowarrayPatch doesn't apply. Needs reroll.
This test looks much better, though. I thought I remember seeing something about calc possibly not working within a sizes attribute. It would be good to verify that before we use it in a test.
Comment #10
jelle_sRerolled, and removed calc within the sizes attribute.
Comment #11
jelle_sComment #12
attiks commentedAssuming test bot will be happy, this is RTBC.
The issue to test the real DOM is still a valid point, but can be solved in a follow up.
Comment #13
rainbowarrayFor what it's worth, found out you can use calc within sizes. But we don't need that in the test, so this still looks good to go for me.
Comment #14
alexpottCommitted bb3ee20 and pushed to 8.0.x. Thanks!
Comment #16
yched commentedMinor: test comment says "test with multipliers", while this is not what the test does.
Comment #17
yched commentedAlso, would have been nice sugar to accept sizes as an array of strings, not requiring callers to do the implode themselves ?
Comment #18
attiks commentedFollow up created #2343657: Cleanup: Add sizes to template_preprocess_image