1
1
describe ( "About Objects" , function ( ) {
2
2
3
3
describe ( "Properties" , function ( ) {
4
- var meglomaniac ;
4
+ var megalomaniac ;
5
5
6
6
beforeEach ( function ( ) {
7
- meglomaniac = { mastermind : "Joker" , henchwoman : "Harley" } ;
7
+ megalomaniac = { mastermind : "Joker" , henchwoman : "Harley" } ;
8
8
} ) ;
9
9
10
10
it ( "should confirm objects are collections of properties" , function ( ) {
11
- expect ( meglomaniac . mastermind ) . toBe ( FILL_ME_IN ) ;
11
+ expect ( megalomaniac . mastermind ) . toBe ( FILL_ME_IN ) ;
12
12
} ) ;
13
13
14
14
it ( "should confirm that properties are case sensitive" , function ( ) {
15
- expect ( meglomaniac . henchwoman ) . toBe ( FILL_ME_IN ) ;
16
- expect ( meglomaniac . henchWoman ) . toBe ( FILL_ME_IN ) ;
15
+ expect ( megalomaniac . henchwoman ) . toBe ( FILL_ME_IN ) ;
16
+ expect ( megalomaniac . henchWoman ) . toBe ( FILL_ME_IN ) ;
17
17
} ) ;
18
18
} ) ;
19
19
20
20
21
21
it ( "should know properties that are functions act like methods" , function ( ) {
22
- var meglomaniac = {
22
+ var megalomaniac = {
23
23
mastermind : "Brain" ,
24
24
henchman : "Pinky" ,
25
25
battleCry : function ( noOfBrains ) {
@@ -28,14 +28,14 @@ describe("About Objects", function () {
28
28
}
29
29
} ;
30
30
31
- var battleCry = meglomaniac . battleCry ( 4 ) ;
31
+ var battleCry = megalomaniac . battleCry ( 4 ) ;
32
32
expect ( FILL_ME_IN ) . toMatch ( battleCry ) ;
33
33
} ) ;
34
34
35
35
it ( "should confirm that when a function is attached to an object, 'this' refers to the object" , function ( ) {
36
36
var currentDate = new Date ( ) ;
37
37
var currentYear = ( currentDate . getFullYear ( ) ) ;
38
- var meglomaniac = {
38
+ var megalomaniac = {
39
39
mastermind : "James Wood" ,
40
40
henchman : "Adam West" ,
41
41
birthYear : 1970 ,
@@ -45,13 +45,13 @@ describe("About Objects", function () {
45
45
} ;
46
46
47
47
expect ( currentYear ) . toBe ( FILL_ME_IN ) ;
48
- expect ( meglomaniac . calculateAge ( ) ) . toBe ( FILL_ME_IN ) ;
48
+ expect ( megalomaniac . calculateAge ( ) ) . toBe ( FILL_ME_IN ) ;
49
49
} ) ;
50
50
51
51
describe ( "'in' keyword" , function ( ) {
52
- var meglomaniac ;
52
+ var megalomaniac ;
53
53
beforeEach ( function ( ) {
54
- meglomaniac = {
54
+ megalomaniac = {
55
55
mastermind : "The Monarch" ,
56
56
henchwoman : "Dr Girlfriend" ,
57
57
theBomb : true
@@ -60,29 +60,29 @@ describe("About Objects", function () {
60
60
61
61
it ( "should have the bomb" , function ( ) {
62
62
63
- var hasBomb = "theBomb" in meglomaniac ;
63
+ var hasBomb = "theBomb" in megalomaniac ;
64
64
65
65
expect ( hasBomb ) . toBe ( FILL_ME_IN ) ;
66
66
} ) ;
67
67
68
68
it ( "should not have the detonator however" , function ( ) {
69
69
70
- var hasDetonator = "theDetonator" in meglomaniac ;
70
+ var hasDetonator = "theDetonator" in megalomaniac ;
71
71
72
72
expect ( hasDetonator ) . toBe ( FILL_ME_IN ) ;
73
73
} ) ;
74
74
} ) ;
75
75
76
76
it ( "should know that properties can be added and deleted" , function ( ) {
77
- var meglomaniac = { mastermind : "Agent Smith" , henchman : "Agent Smith" } ;
77
+ var megalomaniac = { mastermind : "Agent Smith" , henchman : "Agent Smith" } ;
78
78
79
- expect ( "secretary" in meglomaniac ) . toBe ( FILL_ME_IN ) ;
79
+ expect ( "secretary" in megalomaniac ) . toBe ( FILL_ME_IN ) ;
80
80
81
- meglomaniac . secretary = "Agent Smith" ;
82
- expect ( "secretary" in meglomaniac ) . toBe ( FILL_ME_IN ) ;
81
+ megalomaniac . secretary = "Agent Smith" ;
82
+ expect ( "secretary" in megalomaniac ) . toBe ( FILL_ME_IN ) ;
83
83
84
- delete meglomaniac . henchman ;
85
- expect ( "henchman" in meglomaniac ) . toBe ( FILL_ME_IN ) ;
84
+ delete megalomaniac . henchman ;
85
+ expect ( "henchman" in megalomaniac ) . toBe ( FILL_ME_IN ) ;
86
86
} ) ;
87
87
88
88
0 commit comments