@samitouri / QOS-React-2 / commits / 232b61044c

Warn for 'class' and 'for' property names

Also stroke-linecap, stroke-width, stop-color, stop-opacity. Test Plan: grunt test

Ben Alpert committed Sep 9, 2013 at 15:59 UTC 232b61044c61f248d347171f5a80d6cfca816c8c
2 files changed +16 -2
src/dom/DOMProperty.js
+6 -2
@@ -85,8 +85,12 @@ var DOMPropertyInjection = {
85 var lowerCased = propName.toLowerCase();
86 DOMProperty.getPossibleStandardName[lowerCased] = propName;
87
88 - DOMProperty.getAttributeName[propName] =
89 - DOMAttributeNames[propName] || lowerCased;
88 + var attributeName = DOMAttributeNames[propName];
89 + if (attributeName) {
90 + DOMProperty.getPossibleStandardName[attributeName] = propName;
91 + }
92 +
93 + DOMProperty.getAttributeName[propName] = attributeName || lowerCased;
94
95 DOMProperty.getPropertyName[propName] =
96 DOMPropertyNames[propName] || propName;
src/dom/__tests__/DOMPropertyOperations-test.js
+10
@@ -68,6 +68,16 @@ describe('DOMPropertyOperations', function() {
68 expect(console.warn.argsForCall[0][0]).toContain('tabIndex');
69 });
70
71 + it('should warn about class', function() {
72 + spyOn(console, 'warn');
73 + expect(DOMPropertyOperations.createMarkupForProperty(
74 + 'class',
75 + 'muffins'
76 + )).toBe(null);
77 + expect(console.warn.argsForCall.length).toBe(1);
78 + expect(console.warn.argsForCall[0][0]).toContain('className');
79 + });
80 +
81 it('should create markup for boolean properties', function() {
82 expect(DOMPropertyOperations.createMarkupForProperty(
83 'checked',