@@ -1090,18 +1090,36 @@ new Test.Unit.Runner({
1090
1090
1091
1091
testElementWriteAttributeWithBooleans : function ( ) {
1092
1092
var input = $ ( 'write_attribute_input' ) ,
1093
- select = $ ( 'write_attribute_select' ) ,
1094
- checkbox = $ ( 'write_attribute_checkbox' ) ,
1095
- checkedCheckbox = $ ( 'write_attribute_checked_checkbox' ) ;
1093
+ select = $ ( 'write_attribute_select' ) ;
1096
1094
this . assert ( input . writeAttribute ( 'readonly' ) . hasAttribute ( 'readonly' ) ) ;
1097
1095
this . assert ( ! input . writeAttribute ( 'readonly' , false ) . hasAttribute ( 'readonly' ) ) ;
1098
1096
this . assert ( input . writeAttribute ( 'readonly' , true ) . hasAttribute ( 'readonly' ) ) ;
1099
1097
this . assert ( ! input . writeAttribute ( 'readonly' , null ) . hasAttribute ( 'readonly' ) ) ;
1100
1098
this . assert ( input . writeAttribute ( 'readonly' , 'readonly' ) . hasAttribute ( 'readonly' ) ) ;
1101
1099
this . assert ( select . writeAttribute ( 'multiple' ) . hasAttribute ( 'multiple' ) ) ;
1102
1100
this . assert ( input . writeAttribute ( 'disabled' ) . hasAttribute ( 'disabled' ) ) ;
1101
+ } ,
1102
+ testElementWriteAttributeForCheckbox : function ( ) {
1103
+ var checkbox = $ ( 'write_attribute_checkbox' ) ,
1104
+ checkedCheckbox = $ ( 'write_attribute_checked_checkbox' ) ;
1103
1105
this . assert ( checkbox . writeAttribute ( 'checked' ) . checked ) ;
1106
+ this . assert ( checkbox . writeAttribute ( 'checked' ) . hasAttribute ( 'checked' ) ) ;
1107
+ this . assertEqual ( 'checked' , checkbox . writeAttribute ( 'checked' ) . getAttribute ( 'checked' ) ) ;
1108
+ this . assert ( ! checkbox . writeAttribute ( 'checked' ) . hasAttribute ( 'undefined' ) ) ;
1109
+ this . assert ( checkbox . writeAttribute ( 'checked' , true ) . checked ) ;
1110
+ this . assert ( checkbox . writeAttribute ( 'checked' , true ) . hasAttribute ( 'checked' ) ) ;
1111
+ this . assert ( checkbox . writeAttribute ( 'checked' , 'checked' ) . checked ) ;
1112
+ this . assert ( checkbox . writeAttribute ( 'checked' , 'checked' ) . hasAttribute ( 'checked' ) ) ;
1113
+ this . assert ( ! checkbox . writeAttribute ( 'checked' , null ) . checked ) ;
1114
+ this . assert ( ! checkbox . writeAttribute ( 'checked' , null ) . hasAttribute ( 'checked' ) ) ;
1115
+ this . assert ( ! checkbox . writeAttribute ( 'checked' , true ) . hasAttribute ( 'undefined' ) ) ;
1104
1116
this . assert ( ! checkedCheckbox . writeAttribute ( 'checked' , false ) . checked ) ;
1117
+ this . assert ( ! checkbox . writeAttribute ( 'checked' , false ) . hasAttribute ( 'checked' ) ) ;
1118
+ } ,
1119
+ testElementWriteAttributeForStyle : function ( ) {
1120
+ var element = Element . extend ( document . body . appendChild ( document . createElement ( 'p' ) ) ) ;
1121
+ this . assert ( element . writeAttribute ( 'style' , 'color: red' ) . hasAttribute ( 'style' ) ) ;
1122
+ this . assert ( ! element . writeAttribute ( 'style' , 'color: red' ) . hasAttribute ( 'undefined' ) ) ;
1105
1123
} ,
1106
1124
1107
1125
testElementWriteAttributeWithIssues : function ( ) {
0 commit comments