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.
This commit is contained in:
OverSu 2026-09-30 23:13:03 +02:00
commit b38dea0597
25901 changed files with 9982925 additions and 369 deletions

View file

@ -0,0 +1,134 @@
/* global Controller, MockL10n, UI*/
'use strict';
requireApp('system/mobile_id/js/ui.js');
requireApp('system/mobile_id/js/controller.js');
require('/shared/test/unit/mocks/mock_l10n.js');
require('/shared/test/unit/load_body_html_helper.js');
suite('MobileID Controller', function() {
var realL10n;
var mockDetails = [
{
primary: true,
msisdn: '+34232342342',
operator: 'Movistar'
},
{
primary: false,
operator: 'Movistar',
serviceId: '0'
}
];
suiteSetup(function() {
realL10n = navigator.mozL10n;
navigator.mozL10n = MockL10n;
loadBodyHTML('/mobile_id/index.html');
Controller.init();
});
suiteTeardown(function() {
navigator.mozL10n = realL10n;
realL10n = null;
document.body.innerHTML = '';
});
test(' when "init" is launched, we listen mozL10n ready and we render',
function() {
this.sinon.useFakeTimers();
this.sinon.stub(UI, 'localize');
this.sinon.stub(UI, 'render');
this.sinon.spy(navigator.mozL10n, 'ready');
var eventToLaunch = new CustomEvent(
'init',
{
detail: {
appName: 'app name',
candidates: mockDetails
}
}
);
window.dispatchEvent(eventToLaunch);
this.sinon.clock.tick();
assert.isTrue(navigator.mozL10n.ready.calledOnce);
assert.isTrue(UI.render.calledOnce);
assert.isTrue(UI.localize.calledOnce);
this.sinon.clock.restore();
});
test(' when "shown" is launched, we set the scroll params', function() {
assert.ok(true);
this.sinon.stub(UI, 'setScroll');
var eventToLaunch = new CustomEvent(
'shown',
{
detail: {}
}
);
window.dispatchEvent(eventToLaunch);
assert.isTrue(UI.setScroll.calledOnce);
});
test(' when "onverifying" is launched, UI should be requested properly',
function() {
assert.ok(true);
this.sinon.stub(UI, 'onVerifying');
var eventToLaunch = new CustomEvent(
'onverifying',
{
detail: {}
}
);
window.dispatchEvent(eventToLaunch);
assert.isTrue(UI.onVerifying.calledOnce);
});
test(' when "onverified" is launched, UI should be requested properly',
function() {
assert.ok(true);
this.sinon.stub(UI, 'onVerified');
var eventToLaunch = new CustomEvent(
'onverified',
{
detail: {}
}
);
window.dispatchEvent(eventToLaunch);
assert.isTrue(UI.onVerified.calledOnce);
});
test(' when "onerror" is launched, UI should be requested properly',
function() {
assert.ok(true);
this.sinon.stub(UI, 'onerror');
var eventToLaunch = new CustomEvent(
'onerror',
{
detail: {}
}
);
window.dispatchEvent(eventToLaunch);
assert.isTrue(UI.onerror.calledOnce);
});
test(' when "onverificationcode" is launched, UI is requested properly',
function() {
assert.ok(true);
this.sinon.stub(UI, 'onVerificationCode');
var eventToLaunch = new CustomEvent(
'onverificationcode',
{
detail: {}
}
);
window.dispatchEvent(eventToLaunch);
assert.isTrue(UI.onVerificationCode.calledOnce);
});
});

View file

@ -0,0 +1,38 @@
'use strict';
/* global MobileIDErrorOverlay */
require('/shared/js/utilities.js');
requireApp('system/mobile_id/js/error_overlay.js');
require('/shared/test/unit/load_body_html_helper.js');
suite('MobileID Error Overlay', function() {
var overlay, title, message;
suiteSetup(function() {
loadBodyHTML('/mobile_id/index.html');
overlay = document.querySelector('#mobileid-error-overlay');
title = document.querySelector('#mobileid-error-title');
message = document.querySelector('#mobileid-error-msg');
});
suiteTeardown(function() {
document.body.innerHTML = '';
overlay = null;
title = null;
message = null;
});
test('show', function() {
var customTitleL10nId = 'loremIpsumTitle';
var customTextL10nId = 'loremImpsumText';
MobileIDErrorOverlay.show(customTitleL10nId, customTextL10nId);
assert.equal(title.getAttribute('data-l10n-id'), customTitleL10nId);
assert.equal(message.getAttribute('data-l10n-id'), customTextL10nId);
assert.ok(overlay.classList.contains('show'));
});
test('hide', function() {
MobileIDErrorOverlay.hide();
assert.isFalse(overlay.classList.contains('show'));
});
});

View file

@ -0,0 +1,27 @@
/* global Controller, UI*/
'use strict';
requireApp('system/mobile_id/js/controller.js');
requireApp('system/mobile_id/js/ui.js');
requireApp('system/mobile_id/js/mobile_id.js');
suite('MobileID ', function() {
test(' init rest of modules when "onload"', function() {
this.sinon.stub(Controller, 'init');
this.sinon.stub(UI, 'init');
assert.ok(true);
// Dispatch event "onload"
var eventToLaunch = new CustomEvent(
'load',
{}
);
window.dispatchEvent(eventToLaunch);
// Initialize both modules
assert.ok(Controller.init.calledOnce);
assert.ok(UI.init.calledOnce);
Controller.init.reset();
UI.init.reset();
});
});

View file

@ -0,0 +1,159 @@
'use strict';
/* global Controller, UI, MockL10n, MockNavigatorMozMobileConnections */
requireApp('system/mobile_id/js/controller.js');
requireApp('system/mobile_id/js/ui.js');
require('/shared/test/unit/mocks/mock_l10n.js');
require('/shared/test/unit/load_body_html_helper.js');
require('/shared/elements/gaia-header/dist/gaia-header.js');
requireApp(
'system/shared/test/unit/mocks/mock_navigator_moz_mobile_connections.js');
suite('MobileID UI ', function() {
var realL10n;
var realMobileConnections;
var mockDetails = [
{
primary: true,
msisdn: '+34232342342',
operator: 'Movistar'
},
{
primary: false,
operator: 'Movistar',
serviceId: '0'
}
];
suiteSetup(function(done) {
realL10n = navigator.mozL10n;
navigator.mozL10n = MockL10n;
realMobileConnections = navigator.mozMobileConnections;
navigator.mozMobileConnections = MockNavigatorMozMobileConnections;
MockNavigatorMozMobileConnections.mAddMobileConnection();
loadBodyHTML('/mobile_id/index.html');
UI.init({
callback: done
});
});
suiteTeardown(function() {
navigator.mozL10n = realL10n;
navigator.mozMobileConnections = realMobileConnections;
MockNavigatorMozMobileConnections.mTeardown();
realL10n = null;
document.body.innerHTML = '';
});
suite(' render', function() {
test('> is rendered properly', function() {
// Render with the mock params
UI.render(mockDetails);
// List of the possible options
var phoneOptionsList = document.querySelector('.phone-options-list');
// Number of options should be 2
assert.equal(phoneOptionsList.children.length, mockDetails.length);
// The first one (which is the primary) should be selected by default
assert.equal(
document.querySelector('input:checked').value,
mockDetails[0].msisdn
);
// Second one is a SIM without MSISDN
assert.equal(
phoneOptionsList.children[1].value,
mockDetails[1].serviceId
);
});
});
suite(' we are bubbling all events to the Controller', function() {
suiteSetup(function() {
UI.render(mockDetails);
});
test('> close button action',function(done) {
this.sinon.stub(Controller, 'postCloseAction');
var header = document.querySelector('gaia-header');
header.addEventListener('action', function() {
done(function() {
sinon.assert.calledOnce(Controller.postCloseAction);
sinon.assert.calledWith(Controller.postCloseAction, false);
});
});
header.triggerAction();
});
test('> allow button action',function() {
this.sinon.stub(Controller, 'postIdentity');
document.getElementById('allow-button').click();
assert.ok(Controller.postIdentity.calledOnce);
sinon.assert.calledWith(
Controller.postIdentity,
// As we are in the automatic phone number retrieval, we
// are using the default one
{ mcc: null, phoneNumber: mockDetails[0].msisdn, prefix: null}
);
});
test('> verification button action',function() {
var verificationCodeMock = '123456';
document.getElementById('verification-code').value = verificationCodeMock;
this.sinon.stub(Controller, 'postVerificationCode');
document.getElementById('verify-button').click();
assert.ok(Controller.postVerificationCode.calledOnce);
sinon.assert.calledWith(
Controller.postVerificationCode,
verificationCodeMock
);
});
test('> verification button action with invalid code',function() {
var verificationCodeMock = '1234';
document.getElementById('verification-code').value = verificationCodeMock;
this.sinon.stub(Controller, 'postVerificationCode');
document.getElementById('verify-button').click();
assert.isFalse(Controller.postVerificationCode.calledOnce);
});
});
suite(' country code selection - no network', function() {
suiteSetup(function(done) {
UI.init({
callback: done
});
});
test('> No MCC should not select any default value', function() {
var legend = document.getElementById('legend');
assert.equal(legend.innerHTML, '');
var ccSelect = document.getElementById('country-codes-select');
// The select defaults to 289.
assert.equal(ccSelect.value, '289');
});
});
suite(' country code selection - network', function() {
suiteSetup(function(done) {
MockNavigatorMozMobileConnections[0].voice = {
network: {
mcc: '214'
}
};
UI.init({
callback: done
});
});
test('> No MCC should not select any default value', function() {
var legend = document.getElementById('legend');
assert.equal(legend.innerHTML, '+34');
var ccSelect = document.getElementById('country-codes-select');
assert.equal(ccSelect.value, '214');
});
});
});