File tree Expand file tree Collapse file tree 2 files changed +9
-0
lines changed
1-js/04-object-basics/04-object-methods/8-chain-calls/_js.view Expand file tree Collapse file tree 2 files changed +9
-0
lines changed Original file line number Diff line number Diff line change @@ -11,5 +11,6 @@ let ladder = {
1111 } ,
1212 showStep : function ( ) {
1313 alert ( this . step ) ;
14+ return this ;
1415 }
1516} ;
Original file line number Diff line number Diff line change @@ -32,6 +32,14 @@ describe('Ladder', function() {
3232 it ( 'down().up().up().up() ' , function ( ) {
3333 assert . equal ( ladder . down ( ) . up ( ) . up ( ) . up ( ) . step , 2 ) ;
3434 } ) ;
35+
36+ it ( 'showStep() should return this' , function ( ) {
37+ assert . equal ( ladder . showStep ( ) , ladder ) ;
38+ } ) ;
39+
40+ it ( 'up().up().down().showStep().down().showStep()' , function ( ) {
41+ assert . equal ( ladder . up ( ) . up ( ) . down ( ) . showStep ( ) . down ( ) . showStep ( ) . step , 0 )
42+ } ) ;
3543
3644 after ( function ( ) {
3745 ladder . step = 0 ;
You can’t perform that action at this time.
0 commit comments