@@ -612,6 +612,30 @@ describe('jqLite', function() {
612612 expect ( elm . attr ( 'readOnly' ) ) . toBeUndefined ( ) ;
613613 expect ( elm . attr ( 'disabled' ) ) . toBeUndefined ( ) ;
614614 } ) ;
615+
616+ it ( 'should do nothing when setting or getting on attribute nodes' , function ( ) {
617+ var attrNode = jqLite ( document . createAttribute ( 'myattr' ) ) ;
618+ expect ( attrNode ) . toBeDefined ( ) ;
619+ expect ( attrNode [ 0 ] . nodeType ) . toEqual ( 2 ) ;
620+ expect ( attrNode . attr ( 'some-attribute' , 'somevalue' ) ) . toEqual ( attrNode ) ;
621+ expect ( attrNode . attr ( 'some-attribute' ) ) . toBeUndefined ( ) ;
622+ } ) ;
623+
624+ it ( 'should do nothing when setting or getting on text nodes' , function ( ) {
625+ var textNode = jqLite ( document . createTextNode ( 'some text' ) ) ;
626+ expect ( textNode ) . toBeDefined ( ) ;
627+ expect ( textNode [ 0 ] . nodeType ) . toEqual ( 3 ) ;
628+ expect ( textNode . attr ( 'some-attribute' , 'somevalue' ) ) . toEqual ( textNode ) ;
629+ expect ( textNode . attr ( 'some-attribute' ) ) . toBeUndefined ( ) ;
630+ } ) ;
631+
632+ it ( 'should do nothing when setting or getting on comment nodes' , function ( ) {
633+ var comment = jqLite ( document . createComment ( 'some comment' ) ) ;
634+ expect ( comment ) . toBeDefined ( ) ;
635+ expect ( comment [ 0 ] . nodeType ) . toEqual ( 8 ) ;
636+ expect ( comment . attr ( 'some-attribute' , 'somevalue' ) ) . toEqual ( comment ) ;
637+ expect ( comment . attr ( 'some-attribute' ) ) . toBeUndefined ( ) ;
638+ } ) ;
615639 } ) ;
616640
617641
0 commit comments