VulpesOS/gaia/apps/system/test/unit/mobileid_dialog_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.3 KiB
JavaScript
Executable file

'use strict';
/* global MobileIdDialog, SystemDialog, LayoutManager, MocksHelper */
require('/js/service.js');
require('/js/base_ui.js');
require('/js/system_dialog.js');
require('/js/mobileid_dialog.js');
require('/test/unit/mock_system_dialog_manager.js');
require('/test/unit/mock_layout_manager.js');
require('/test/unit/mock_keyboard_manager.js');
var mocksForMobileIdDialog = new MocksHelper([
'SystemDialogManager',
'LayoutManager',
'KeyboardManager'
]).init();
suite('MobileID Dialog', function() {
mocksForMobileIdDialog.attachTestHelpers();
var container;
setup(function() {
container = document.createElement('div');
document.body.appendChild(container);
SystemDialog.prototype.containerElement = container;
window.layoutManager = new LayoutManager();
});
teardown(function() {
document.body.removeChild(container);
SystemDialog.prototype.containerElement = container = null;
window.layoutManager = null;
});
test('Dialog should be removed when closed', function() {
var that = this;
var dialog = new MobileIdDialog({
onOpened: function onOpened() {
that.sinon.spy(dialog.panel.parentNode, 'removeChild');
},
onClosed: function onClosed() {
assert.isTrue(dialog.panel.parentNode.removeChild.calledOnce);
}
});
dialog.open();
dialog.close();
});
});