Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

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‎

Lines changed: 1 addition & 0 deletions
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‎

Lines changed: 8 additions & 0 deletions
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)

AltStyle によって変換されたページ (->オリジナル) /