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:
parent
93e3a48004
commit
b38dea0597
25901 changed files with 9982925 additions and 369 deletions
114
gaia/apps/sharedtest/test/unit/simslot_test.js
Executable file
114
gaia/apps/sharedtest/test/unit/simslot_test.js
Executable file
|
|
@ -0,0 +1,114 @@
|
|||
/* globals SIMSlot */
|
||||
'use strict';
|
||||
|
||||
suite('SIMSlot', function() {
|
||||
suiteSetup(function() {
|
||||
});
|
||||
|
||||
suiteTeardown(function() {
|
||||
});
|
||||
|
||||
setup(function(callback) {
|
||||
require('/shared/js/simslot.js', callback);
|
||||
});
|
||||
|
||||
teardown(function() {
|
||||
});
|
||||
|
||||
test('new', function() {
|
||||
var created = false;
|
||||
window.addEventListener('simslot-created', function() {
|
||||
created = true;
|
||||
});
|
||||
/*jshint unused: false */
|
||||
var slot = new SIMSlot(null, 0);
|
||||
assert.isTrue(created);
|
||||
});
|
||||
|
||||
test('update', function() {
|
||||
var slot = new SIMSlot(null, 0);
|
||||
var card = document.createElement('div');
|
||||
slot.update(card);
|
||||
assert.deepEqual(slot.simCard, card);
|
||||
});
|
||||
|
||||
test('isAbsent', function() {
|
||||
var card = document.createElement('div');
|
||||
card.iccInfo = {
|
||||
iccid: 1
|
||||
};
|
||||
var slot1 = new SIMSlot(null, 0, card);
|
||||
assert.isFalse(slot1.isAbsent());
|
||||
|
||||
var slot2 = new SIMSlot(null, 0);
|
||||
assert.isTrue(slot2.isAbsent());
|
||||
});
|
||||
|
||||
['permanentBlocked'].forEach(function(absentType) {
|
||||
test('isAbsent: ' + absentType, function() {
|
||||
var card = document.createElement('div');
|
||||
card.cardState = absentType;
|
||||
var slot = new SIMSlot(null, 0, card);
|
||||
assert.isTrue(slot.isAbsent());
|
||||
});
|
||||
});
|
||||
|
||||
['unknown', 'illegal', 'absent', 'ready', null].forEach(function(lockType) {
|
||||
test('isLocked: ' + lockType, function() {
|
||||
var card = document.createElement('div');
|
||||
card.cardState = lockType;
|
||||
var slot = new SIMSlot(null, 0, card);
|
||||
assert.isFalse(slot.isLocked());
|
||||
});
|
||||
});
|
||||
|
||||
['pinRequired', 'pukRequired', 'networkLocked',
|
||||
'corporateLocked', 'serviceProviderLocked', 'network1Locked',
|
||||
'network2Locked', 'hrpdNetworkLocked', 'ruimCorporateLocked',
|
||||
'ruimServiceProviderLocked'].forEach(function(lockType) {
|
||||
test('isLocked: ' + lockType, function() {
|
||||
var card = document.createElement('div');
|
||||
card.cardState = lockType;
|
||||
var slot = new SIMSlot(null, 0, card);
|
||||
assert.isTrue(slot.isLocked());
|
||||
});
|
||||
});
|
||||
|
||||
suite('handleEvent', function() {
|
||||
test('cardstatechange', function() {
|
||||
var slot = new SIMSlot(null, 0);
|
||||
var stubPublish = this.sinon.stub(slot, 'publish');
|
||||
slot.handleEvent({
|
||||
type: 'cardstatechange'
|
||||
});
|
||||
assert.isTrue(stubPublish.calledWith('cardstatechange'));
|
||||
});
|
||||
|
||||
test('iccinfochange', function() {
|
||||
var slot = new SIMSlot(null, 0);
|
||||
var stubPublish = this.sinon.stub(slot, 'publish');
|
||||
slot.handleEvent({
|
||||
type: 'iccinfochange'
|
||||
});
|
||||
assert.isTrue(stubPublish.calledWith('iccinfochange'));
|
||||
});
|
||||
|
||||
test('stkcommand', function() {
|
||||
var slot = new SIMSlot(null, 0);
|
||||
var stubPublish = this.sinon.stub(slot, 'publish');
|
||||
slot.handleEvent({
|
||||
type: 'stkcommand'
|
||||
});
|
||||
assert.isTrue(stubPublish.calledWith('stkcommand'));
|
||||
});
|
||||
|
||||
test('stksessionend', function() {
|
||||
var slot = new SIMSlot(null, 0);
|
||||
var stubPublish = this.sinon.stub(slot, 'publish');
|
||||
slot.handleEvent({
|
||||
type: 'stksessionend'
|
||||
});
|
||||
assert.isTrue(stubPublish.calledWith('stksessionend'));
|
||||
});
|
||||
});
|
||||
});
|
||||
Loading…
Reference in a new issue