mirror of
https://github.com/facebook/react.git
synced 2025-11-01 09:12:30 +00:00
Merge pull request #330 from spicyj/warn-class-for
Warn for 'class' and 'for' property names
This commit is contained in:
@@ -85,8 +85,12 @@ var DOMPropertyInjection = {
|
||||
var lowerCased = propName.toLowerCase();
|
||||
DOMProperty.getPossibleStandardName[lowerCased] = propName;
|
||||
|
||||
DOMProperty.getAttributeName[propName] =
|
||||
DOMAttributeNames[propName] || lowerCased;
|
||||
var attributeName = DOMAttributeNames[propName];
|
||||
if (attributeName) {
|
||||
DOMProperty.getPossibleStandardName[attributeName] = propName;
|
||||
}
|
||||
|
||||
DOMProperty.getAttributeName[propName] = attributeName || lowerCased;
|
||||
|
||||
DOMProperty.getPropertyName[propName] =
|
||||
DOMPropertyNames[propName] || propName;
|
||||
|
||||
@@ -68,6 +68,16 @@ describe('DOMPropertyOperations', function() {
|
||||
expect(console.warn.argsForCall[0][0]).toContain('tabIndex');
|
||||
});
|
||||
|
||||
it('should warn about class', function() {
|
||||
spyOn(console, 'warn');
|
||||
expect(DOMPropertyOperations.createMarkupForProperty(
|
||||
'class',
|
||||
'muffins'
|
||||
)).toBe(null);
|
||||
expect(console.warn.argsForCall.length).toBe(1);
|
||||
expect(console.warn.argsForCall[0][0]).toContain('className');
|
||||
});
|
||||
|
||||
it('should create markup for boolean properties', function() {
|
||||
expect(DOMPropertyOperations.createMarkupForProperty(
|
||||
'checked',
|
||||
|
||||
Reference in New Issue
Block a user