blob: beb452ec848abde64d202c8ce40ac34cabea014b (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
|
var MockModalDialog = {
mMethods: [
'alert'
],
mPopulate: function mmd_mPopulate() {
this.mMethods.forEach(function(methodName) {
this[methodName] = function mmd_method() {
this.mMethodCalled(methodName, Array.slice(arguments));
};
}, this);
},
init: function mmd_init() {
this.mMethods.forEach(function(methodName) {
this[methodName].mWasCalled = false;
this[methodName].mArgs = null;
}, this);
},
mMethodCalled: function mmd_mMethodCalled(name, args) {
this[name].mWasCalled = true;
this[name].mArgs = args;
},
mTeardown: function mmd_mTeardown() {
this.init();
}
};
MockModalDialog.mPopulate();
|