Skip to content

Commit 025f588

Browse files
authored
Merge pull request #2837 from Omid-Heidarzadeh/bugfix-2826-add-missing-tests
fix:Add missing test issue:#2826 & fix related solution
2 parents 1dc6dfb + 82e5d13 commit 025f588

File tree

2 files changed

+9
-0
lines changed

2 files changed

+9
-0
lines changed

1-js/04-object-basics/04-object-methods/8-chain-calls/_js.view/solution.js

+1
Original file line numberDiff line numberDiff line change
@@ -11,5 +11,6 @@ let ladder = {
1111
},
1212
showStep: function() {
1313
alert(this.step);
14+
return this;
1415
}
1516
};

1-js/04-object-basics/04-object-methods/8-chain-calls/_js.view/test.js

+8
Original file line numberDiff line numberDiff 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;

0 commit comments

Comments
 (0)