Skip to content
This repository has been archived by the owner on Nov 3, 2021. It is now read-only.

Commit

Permalink
Browse files Browse the repository at this point in the history
Bug 1059488 - [MobileID] Country code manual selection dialog seems b…
…roken. r=alive

Conflicts:
	apps/system/js/mobileid_dialog.js
  • Loading branch information
ferjm authored and rvandermeulen committed Sep 5, 2014
1 parent 4627014 commit b821580
Show file tree
Hide file tree
Showing 2 changed files with 55 additions and 0 deletions.
1 change: 1 addition & 0 deletions apps/system/js/mobileid_dialog.js
Expand Up @@ -104,6 +104,7 @@
this.panel.innerHTML = '';
this.panel.classList.remove('closing');
this.panel.classList.remove('opening');
this.panel.parentNode.removeChild(this.panel);
this.panel = null;

if (typeof onClosed === 'function') {
Expand Down
54 changes: 54 additions & 0 deletions apps/system/test/unit/mobileid_dialog_test.js
@@ -0,0 +1,54 @@
'use strict';

/* global MobileIdDialog, SystemDialog, LayoutManager, MocksHelper */

require('/js/system.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');
require('/test/unit/mock_statusbar.js');

var mocksForMobileIdDialog = new MocksHelper([
'SystemDialogManager',
'LayoutManager',
'KeyboardManager',
'StatusBar'
]).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();
});
});

0 comments on commit b821580

Please sign in to comment.