Skip to content

Commit 0291534

Browse files
committed
Clarify prototype chain tests
1 parent f66bafd commit 0291534

File tree

1 file changed

+11
-6
lines changed

1 file changed

+11
-6
lines changed

topics/about_prototype_chain.js

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,11 @@ child.b = 2;
2727
* */
2828

2929
test("Is there an 'a' and 'b' own property on childObj?", function () {
30+
equals(child.hasOwnProperty('a'), __, 'childObj.hasOwnProperty(\'a\')?');
31+
equals(child.hasOwnProperty('b'), __, 'childObj.hasOwnProperty(\'b\')?');
32+
});
33+
34+
test("Is there an 'a' and 'b' property on childObj?", function () {
3035
equals(child.a, __, 'what is \'a\' value?');
3136
equals(child.b, __, 'what is \'b\' value?');
3237
});
@@ -37,21 +42,21 @@ test("If 'b' was removed, whats b value?", function () {
3742
});
3843

3944

40-
// Is there a 'c' own property on childObj? No, check its prototype
41-
// Is there a 'c' own property on childObj.[[Prototype]]? Yes, its value is...
42-
test("Is there a 'c' own property on childObj.[[Prototype]]?", function () {
45+
test("Is there a 'c' own property on childObj?", function () {
4346
equals(child.hasOwnProperty('c'), __, 'childObj.hasOwnProperty(\'c\')?');
4447
});
4548

46-
test("Is there a 'c' own property on childObj.[[Prototype]]?", function () {
47-
equals(child.c, __, 'childObj.c?');
49+
// Is there a 'c' own property on childObj? No, check its prototype
50+
// Is there a 'c' own property on childObj.[[Prototype]]? Yes, its value is...
51+
test("Is there a 'c' property on childObj?", function () {
52+
equals(child.c, __, 'what is the value of childObj.c?');
4853
});
4954

5055

5156
// Is there a 'd' own property on childObj? No, check its prototype
5257
// Is there a 'd' own property on childObj.[[Prototype]]? No, check it prototype
5358
// childObj.[[Prototype]].[[Prototype]] is null, stop searching, no property found, return...
54-
test("Is there an 'd' own property on childObj?", function () {
59+
test("Is there an 'd' property on childObj?", function () {
5560
equals(child.d, __, 'what is the value of childObj.d?');
5661
});
5762

0 commit comments

Comments
 (0)