File tree Expand file tree Collapse file tree 2 files changed +13
-2
lines changed
test/unit/specs/directives Expand file tree Collapse file tree 2 files changed +13
-2
lines changed Original file line number Diff line number Diff line change 1
1
// xlink
2
2
var xlinkNS = 'http://www.w3.org/1999/xlink'
3
3
var xlinkRE = / ^ x l i n k : /
4
+ var inputProps = {
5
+ value : 1 ,
6
+ checked : 1 ,
7
+ selected : 1
8
+ }
4
9
5
10
module . exports = {
6
11
@@ -35,12 +40,12 @@ module.exports = {
35
40
} ,
36
41
37
42
setAttr : function ( attr , value ) {
38
- if ( attr === 'value' && attr in this . el ) {
43
+ if ( inputProps [ attr ] && attr in this . el ) {
39
44
if ( ! this . valueRemoved ) {
40
45
this . el . removeAttribute ( attr )
41
46
this . valueRemoved = true
42
47
}
43
- this . el . value = value
48
+ this . el [ attr ] = value
44
49
} else if ( value != null && value !== false ) {
45
50
if ( xlinkRE . test ( attr ) ) {
46
51
this . el . setAttributeNS ( xlinkNS , attr , value )
Original file line number Diff line number Diff line change @@ -32,6 +32,12 @@ if (_.inBrowser) {
32
32
dir . update ( 'what' )
33
33
expect ( dir . el . hasAttribute ( 'value' ) ) . toBe ( false )
34
34
expect ( dir . el . value ) . toBe ( 'what' )
35
+ dir . el = document . createElement ( 'input' )
36
+ dir . el . type = 'checkbox'
37
+ dir . arg = 'checked'
38
+ expect ( dir . el . checked ) . toBe ( false )
39
+ dir . update ( true )
40
+ expect ( dir . el . checked ) . toBe ( true )
35
41
} )
36
42
37
43
it ( 'xlink' , function ( ) {
You can’t perform that action at this time.
0 commit comments