You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
47 lines
1.1 KiB
JavaScript
47 lines
1.1 KiB
JavaScript
function createAppContextMock () {
|
|
var scopeMocks = {
|
|
"ZZZ": {
|
|
id: "ZZZ",
|
|
$apply: function () {},
|
|
someKey: 'someOldValue'
|
|
}
|
|
};
|
|
var scopeEltMocks = {
|
|
"ZZZ": "elementMock"
|
|
};
|
|
var regScope;
|
|
return {
|
|
executeOnScope: function (scopeId, fn, args, cb) {
|
|
if (regScope && regScope.$id === scopeId) {
|
|
fn(regScope, 'elementMock', args);
|
|
if (cb) {
|
|
cb();
|
|
}
|
|
}
|
|
if (scopeMocks[scopeId] && scopeEltMocks[scopeId]) {
|
|
fn(scopeMocks[scopeId],
|
|
scopeEltMocks[scopeId],
|
|
args);
|
|
|
|
if (cb) {
|
|
cb();
|
|
}
|
|
}
|
|
},
|
|
registerScope: function (scope) {
|
|
regScope = scope;
|
|
},
|
|
getDebugInfo: function (cb) {
|
|
cb({
|
|
roots: [ "YYY" ],
|
|
trees: {}
|
|
});
|
|
},
|
|
watchRefresh: function (cb) {},
|
|
setDebug: jasmine.createSpy('setDebug'),
|
|
setLog: jasmine.createSpy('setLog'),
|
|
setPollInterval: jasmine.createSpy('setPollInterval'),
|
|
inspect: jasmine.createSpy('inspect'),
|
|
refresh: jasmine.createSpy('refresh')
|
|
}
|
|
} |