@@ -615,6 +615,12 @@ describe('ReactDOMServerIntegration', () => {
615615 expect ( e . hasAttribute ( 'className' ) ) . toBe ( false ) ;
616616 } ) ;
617617
618+ itRenders ( 'no classname prop' , async render => {
619+ const e = await render ( < div classname = "test" /> , 1 ) ;
620+ expect ( e . hasAttribute ( 'class' ) ) . toBe ( false ) ;
621+ expect ( e . hasAttribute ( 'classname' ) ) . toBe ( false ) ;
622+ } ) ;
623+
618624 itRenders ( 'no className prop when given the alias' , async render => {
619625 const e = await render ( < div class = "test" /> , 1 ) ;
620626 expect ( e . className ) . toBe ( '' ) ;
@@ -793,9 +799,35 @@ describe('ReactDOMServerIntegration', () => {
793799 } ) ;
794800 } ) ;
795801
802+ describe ( 'cased attributes' , function ( ) {
803+ itRenders ( 'no badly cased aliased HTML attribute' , async render => {
804+ const e = await render ( < meta httpequiv = "refresh" /> , 1 ) ;
805+ expect ( e . hasAttribute ( 'http-equiv' ) ) . toBe ( false ) ;
806+ expect ( e . hasAttribute ( 'httpequiv' ) ) . toBe ( false ) ;
807+ } ) ;
808+
809+ itRenders ( 'no badly cased SVG attribute' , async render => {
810+ const e = await render ( < text textlength = "10" /> , 1 ) ;
811+ expect ( e . hasAttribute ( 'textLength' ) ) . toBe ( false ) ;
812+ } ) ;
813+
814+ itRenders ( 'no badly cased aliased SVG attribute' , async render => {
815+ const e = await render ( < text strokedasharray = "10 10" /> , 1 ) ;
816+ expect ( e . hasAttribute ( 'strokedasharray' ) ) . toBe ( false ) ;
817+ } ) ;
818+
819+ itRenders (
820+ 'no badly cased original SVG attribute that is aliased' ,
821+ async render => {
822+ const e = await render ( < text stroke-dasharray = "10 10" /> , 1 ) ;
823+ expect ( e . hasAttribute ( 'stroke-dasharray' ) ) . toBe ( false ) ;
824+ } ,
825+ ) ;
826+ } ) ;
827+
796828 describe ( 'unknown attributes' , function ( ) {
797829 itRenders ( 'unknown attributes' , async render => {
798- const e = await render ( < div foo = "bar" /> , 0 ) ;
830+ const e = await render ( < div foo = "bar" /> ) ;
799831 expect ( e . getAttribute ( 'foo' ) ) . toBe ( 'bar' ) ;
800832 } ) ;
801833
@@ -809,13 +841,21 @@ describe('ReactDOMServerIntegration', () => {
809841 expect ( e . hasAttribute ( 'data-foo' ) ) . toBe ( false ) ;
810842 } ) ;
811843
812- itRenders ( 'no unknown data- attributes with casing' , async render => {
813- const e = await render ( < div data-fooBar = { null } /> , 1 ) ;
814- expect ( e . hasAttribute ( 'data-foobar ' ) ) . toBe ( false ) ;
844+ itRenders ( 'unknown data- attributes with casing' , async render => {
845+ const e = await render ( < div data-fooBar = "true" /> ) ;
846+ expect ( e . getAttribute ( 'data-fooBar ' ) ) . toBe ( 'true' ) ;
815847 } ) ;
816848
849+ itRenders (
850+ 'no unknown data- attributes with casing and null value' ,
851+ async render => {
852+ const e = await render ( < div data-fooBar = { null } /> ) ;
853+ expect ( e . hasAttribute ( 'data-fooBar' ) ) . toBe ( false ) ;
854+ } ,
855+ ) ;
856+
817857 itRenders ( 'custom attributes for non-standard elements' , async render => {
818- const e = await render ( < nonstandard foo = "bar" /> , 0 ) ;
858+ const e = await render ( < nonstandard foo = "bar" /> ) ;
819859 expect ( e . getAttribute ( 'foo' ) ) . toBe ( 'bar' ) ;
820860 } ) ;
821861
@@ -848,9 +888,9 @@ describe('ReactDOMServerIntegration', () => {
848888 } ,
849889 ) ;
850890
851- itRenders ( 'no cased custom attributes' , async render => {
852- const e = await render ( < div fooBar = "test" /> , 1 ) ;
853- expect ( e . hasAttribute ( 'fooBar' ) ) . toBe ( false ) ;
891+ itRenders ( 'cased custom attributes' , async render => {
892+ const e = await render ( < div fooBar = "test" /> ) ;
893+ expect ( e . getAttribute ( 'fooBar' ) ) . toBe ( 'test' ) ;
854894 } ) ;
855895 } ) ;
856896
0 commit comments