Remove empty value for boolean attributes in SSR (#11708)
This commit is contained in:
parent
3e64b18540
commit
e0c3113743
|
@ -440,9 +440,9 @@ describe('ReactDOMSelect', () => {
|
|||
</select>
|
||||
);
|
||||
var markup = ReactDOMServer.renderToString(stub);
|
||||
expect(markup).toContain('<option selected="" value="giraffe"');
|
||||
expect(markup).not.toContain('<option selected="" value="monkey"');
|
||||
expect(markup).not.toContain('<option selected="" value="gorilla"');
|
||||
expect(markup).toContain('<option selected value="giraffe"');
|
||||
expect(markup).not.toContain('<option selected value="monkey"');
|
||||
expect(markup).not.toContain('<option selected value="gorilla"');
|
||||
});
|
||||
|
||||
it('should support server-side rendering with defaultValue', () => {
|
||||
|
@ -454,9 +454,9 @@ describe('ReactDOMSelect', () => {
|
|||
</select>
|
||||
);
|
||||
var markup = ReactDOMServer.renderToString(stub);
|
||||
expect(markup).toContain('<option selected="" value="giraffe"');
|
||||
expect(markup).not.toContain('<option selected="" value="monkey"');
|
||||
expect(markup).not.toContain('<option selected="" value="gorilla"');
|
||||
expect(markup).toContain('<option selected value="giraffe"');
|
||||
expect(markup).not.toContain('<option selected value="monkey"');
|
||||
expect(markup).not.toContain('<option selected value="gorilla"');
|
||||
});
|
||||
|
||||
it('should support server-side rendering with multiple', () => {
|
||||
|
@ -468,9 +468,9 @@ describe('ReactDOMSelect', () => {
|
|||
</select>
|
||||
);
|
||||
var markup = ReactDOMServer.renderToString(stub);
|
||||
expect(markup).toContain('<option selected="" value="giraffe"');
|
||||
expect(markup).toContain('<option selected="" value="gorilla"');
|
||||
expect(markup).not.toContain('<option selected="" value="monkey"');
|
||||
expect(markup).toContain('<option selected value="giraffe"');
|
||||
expect(markup).toContain('<option selected value="gorilla"');
|
||||
expect(markup).not.toContain('<option selected value="monkey"');
|
||||
});
|
||||
|
||||
it('should not control defaultValue if readding options', () => {
|
||||
|
|
|
@ -90,7 +90,7 @@ export function createMarkupForProperty(name, value) {
|
|||
propertyInfo.hasBooleanValue ||
|
||||
(propertyInfo.hasOverloadedBooleanValue && value === true)
|
||||
) {
|
||||
return attributeName + '=""';
|
||||
return attributeName;
|
||||
} else if (
|
||||
typeof value !== 'boolean' ||
|
||||
shouldAttributeAcceptBooleanValue(name)
|
||||
|
|
Loading…
Reference in New Issue