New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ENH Update AttributesHTML to output alt attribute even if it's empty #11217
base: 5
Are you sure you want to change the base?
ENH Update AttributesHTML to output alt attribute even if it's empty #11217
Conversation
03be15d
to
3a703eb
Compare
3a703eb
to
d42fa9e
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The original AttributesHTML was only covered by indirect tests of classes using the trait. I decided to add an explicit test.
class AttributesHTMLTest extends SapphireTest | ||
{ | ||
|
||
public function singleAttributeProvider(): array |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
public function singleAttributeProvider(): array | |
public function provideGetAttribute(): array |
Follow the naming conventions for data providers
]; | ||
} | ||
|
||
/** @dataProvider singleAttributeProvider */ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/** @dataProvider singleAttributeProvider */ | |
/** | |
* @dataProvider provideTestAttribute | |
*/ |
/** @dataProvider singleAttributeProvider */ | ||
public function testGetAttribute($name, $value, $message): void | ||
{ | ||
$dummy = new AttributesHTMLTest\DummyAttributesHTML(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
$dummy = new AttributesHTMLTest\DummyAttributesHTML(); | |
$dummy = DummyAttributesHTML(); |
Import this class. Make this change throughout this file
{ | ||
$dummy = new AttributesHTMLTest\DummyAttributesHTML(); | ||
|
||
$dummy->setAttribute('emptystring', ''); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use a data provider for this instead
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
getAttributesHTML
takes all the attributes and combined them into one string.
I'm not trying to test individuals scenarios here. I'm trying to test the scenario where you combined all these attributes together.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems good
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
PHPlinting failure
AttributeHTML
want to suppress attributes with falsy values.When rendering Images and the
alt
attribute contains a blank string, the attribute should be rendered anyway.Arguably this should be on
ImageManipulation
instead, but it seems like an sensible exception to have across the board. I haven't decided yet.Issue