VulpesOS/gaia/apps/callscreen/test/unit/index_test.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

52 lines
1.4 KiB
JavaScript
Executable file

/* globals onLoadCallScreen, MockKeypadManager,
MocksHelper, unloadCallScreen */
'use strict';
require('/shared/test/unit/mocks/dialer/mock_calls_handler.js');
require('/shared/test/unit/mocks/dialer/mock_keypad.js');
require('/test/unit/mock_call_screen.js');
var mocksHelperForIndex = new MocksHelper([
'CallScreen',
'CallsHandler',
'KeypadManager'
]).init();
suite('index.js', function() {
mocksHelperForIndex.attachTestHelpers();
setup(function(done) {
this.sinon.spy(window, 'addEventListener');
require('/js/index.js', done);
});
teardown(function() {
window.removeEventListener('load', onLoadCallScreen);
window.removeEventListener('unload', unloadCallScreen);
});
suite('loading', function() {
test('onload/onunload handlers are properly registered', function() {
sinon.assert.calledWith(window.addEventListener, 'load',
onLoadCallScreen);
sinon.assert.calledWith(window.addEventListener, 'unload',
unloadCallScreen);
});
});
suite('initialization', function() {
setup(function() {
this.sinon.spy(MockKeypadManager, 'init');
onLoadCallScreen();
});
test('all components are initialized with the proper parameters',
function() {
sinon.assert.calledWith(MockKeypadManager.init, /* oncall */ true);
});
});
});