Skip to content
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

Add missing single-word attributes to property warning list #10495

Merged
merged 5 commits into from
Aug 21, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions src/renderers/dom/shared/HTMLDOMPropertyConfig.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@ var HAS_OVERLOADED_BOOLEAN_VALUE =
DOMProperty.injection.HAS_OVERLOADED_BOOLEAN_VALUE;

var HTMLDOMPropertyConfig = {
// When adding attributes to this list, be sure to also add them to
// the `possibleStandardNames` module to ensure casing and incorrect
// name warnings.
Properties: {
allowFullScreen: HAS_BOOLEAN_VALUE,
// specifies target context for links with `preload` type
Expand Down
8 changes: 6 additions & 2 deletions src/renderers/dom/shared/SVGDOMPropertyConfig.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,12 @@ var NS = {
};

/**
* This is a list of all SVG attributes that need special
* casing, namespacing, or boolean value assignment.
* This is a list of all SVG attributes that need special casing,
* namespacing, or boolean value assignment.
*
* When adding attributes to this list, be sure to also add them to
* the `possibleStandardNames` module to ensure casing and incorrect
* name warnings.
*
* SVG Attributes List:
* https://www.w3.org/TR/SVG/attindex.html
Expand Down
12 changes: 12 additions & 0 deletions src/renderers/dom/shared/__tests__/ReactDOMComponent-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -2080,6 +2080,18 @@ describe('ReactDOMComponent', () => {
'Warning: Invalid prop `whatever` on <div> tag.',
);
});

it('warns on bad casing of known HTML attributes', function() {
spyOn(console, 'error');

var el = ReactTestUtils.renderIntoDocument(<div SiZe="30" />);

expect(el.getAttribute('size')).toBe('30');

expectDev(console.error.calls.argsFor(0)[0]).toContain(
'Warning: Invalid DOM property `SiZe`. Did you mean `size`?',
);
});
});

describe('Object stringification', function() {
Expand Down
Loading