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
31
gaia/shared/test/unit/mocks/mock_intl_helper.js
Executable file
31
gaia/shared/test/unit/mocks/mock_intl_helper.js
Executable file
|
|
@ -0,0 +1,31 @@
|
|||
(function(global) {
|
||||
'use strict';
|
||||
/* global mozIntl */
|
||||
|
||||
const helperCache = new Map();
|
||||
|
||||
global.MockIntlHelper = {
|
||||
define: function(name, type, options) {
|
||||
helperCache.set(name, {options, type});
|
||||
},
|
||||
get: function(name) {
|
||||
if (!helperCache.has(name)) {
|
||||
throw new Error('Intl Object with name "' + name + '" is not defined');
|
||||
}
|
||||
var formatter = helperCache.get(name);
|
||||
switch (formatter.type) {
|
||||
case 'number':
|
||||
return Intl.NumberFormat(navigator.languages, formatter.options);
|
||||
case 'datetime':
|
||||
return Intl.DateTimeFormat(navigator.languages, formatter.options);
|
||||
case 'mozdatetime':
|
||||
return mozIntl.DateTimeFormat(navigator.languages, formatter.options);
|
||||
case 'mozduration':
|
||||
return mozIntl.DurationFormat(navigator.languages, formatter.options);
|
||||
}
|
||||
},
|
||||
observe: function() {},
|
||||
unobserve: function() {},
|
||||
};
|
||||
|
||||
}(this));
|
||||
Loading…
Reference in a new issue