File tree 1 file changed +17
-0
lines changed
1 file changed +17
-0
lines changed Original file line number Diff line number Diff line change @@ -38,6 +38,23 @@ describe('$(...)', function() {
38
38
expect ( $pear ) . to . be . a ( $ ) ;
39
39
} ) ;
40
40
41
+ it ( '(chaining) setting value and calling attr returns result' , function ( ) {
42
+ var pearAttr = $ ( '.pear' ) . attr ( 'foo' , 'bar' ) . attr ( 'foo' ) ;
43
+ expect ( pearAttr ) . to . equal ( 'bar' ) ;
44
+ } ) ;
45
+
46
+ it ( '(chaining) setting attr to null returns a $' , function ( ) {
47
+ var $pear = $ ( '.pear' ) . attr ( 'foo' , null ) ;
48
+ expect ( $pear ) . to . be . a ( $ ) ;
49
+ } ) ;
50
+
51
+ it ( '(chaining) setting attr to undefined returns a $' , function ( ) {
52
+ var $pear = $ ( '.pear' ) . attr ( 'foo' , undefined ) ;
53
+ expect ( $ ( '#pear' ) ) . to . have . length ( 1 ) ;
54
+ expect ( $ ( '#pear' ) . attr ( 'foo' ) ) . to . be ( undefined ) ;
55
+ expect ( $pear ) . to . be . a ( $ ) ;
56
+ } ) ;
57
+
41
58
it ( '(key, value) : should set attr' , function ( ) {
42
59
var $el = cheerio ( '<div></div> <div></div>' ) . attr ( 'class' , 'pear' ) ;
43
60
You can’t perform that action at this time.
0 commit comments