VulpesOS/gaia/shared/test/unit/mocks/mock_notification_helper.js
OverSu b38dea0597 Publish Vulpes Preview 15 sources for desktop, Android and Tundra
Share Gaia assets and adapters, keep private profiles and development documents local, and update both public READMEs.
2026-09-30 23:13:03 +02:00

42 lines
911 B
JavaScript
Executable file

'use strict';
/* exported MockNotificationHelper */
var MockNotificationHelper = {
send: function(titleL10n, options) {
this.mOptions = options;
this.mTitleL10n = titleL10n;
var self = this;
var notification = {
addEventListener: function(type, cb) {
self.mEvents[type] = cb;
},
removeEventListener: function(type, cb) {
},
close: sinon.stub()
};
sinon.spy(notification, 'addEventListener');
return Promise.resolve(notification);
},
getIconURI: function nc_getIconURI(app, entryPoint) {
var result = '' + app.name;
if (entryPoint) {
result += '/' + entryPoint;
}
return result;
},
mEmit: function(type) {
this.mEvents[type]();
},
mEvents: {},
mTitleL10n: null,
mOptions: null,
mTeardown: function teardown() {
this.mTitleL10n = null;
this.mOptions = null;
this.mEvents = {};
}
};