mirror of
https://github.com/scratchfoundation/scratch-www.git
synced 2025-03-25 20:29:45 -04:00
Merge branch 'develop' into greenkeeper/eslint-plugin-json-2.0.1
This commit is contained in:
commit
19be26865f
6 changed files with 564 additions and 563 deletions
|
@ -133,6 +133,8 @@ var localizedAssetUrls = {};
|
|||
// - txMapping: if the name of the transifex resource is different from the route name
|
||||
var txMapping = {
|
||||
'projects': 'preview',
|
||||
'embed': 'preview',
|
||||
'vernier': 'gdxfor',
|
||||
'scratch_1.4': 'scratch_14' // transifex doesn't allow dots in resource names
|
||||
};
|
||||
// start with english default for all views
|
||||
|
|
1074
package-lock.json
generated
1074
package-lock.json
generated
File diff suppressed because it is too large
Load diff
|
@ -126,7 +126,7 @@
|
|||
"redux-mock-store": "^1.2.3",
|
||||
"redux-thunk": "2.0.1",
|
||||
"sass-loader": "6.0.6",
|
||||
"scratch-gui": "0.1.0-prerelease.20191022134757",
|
||||
"scratch-gui": "0.1.0-prerelease.20191031171928",
|
||||
"scratch-l10n": "latest",
|
||||
"selenium-webdriver": "3.6.0",
|
||||
"slick-carousel": "1.6.0",
|
||||
|
|
|
@ -1060,25 +1060,23 @@ const dupeCommonCountries = module.exports.dupeCommonCountries = (startingCountr
|
|||
|
||||
/*
|
||||
* registrationCountryOptions is the result of taking the standard countryInfo,
|
||||
* setting a 'value' key and a 'label' key both to the country data's 'name' value,
|
||||
* but using the 'display' value for 'label' instead of 'name' if 'display' exists;
|
||||
* then duplicating 'United States of America' and 'United Kingdom' at the top of the list.
|
||||
* and duplicating 'United States of America' and 'United Kingdom' at the top of the list.
|
||||
* The result is an array like:
|
||||
* [
|
||||
* {value: 'United States', label: 'United States of America'},
|
||||
* {value: 'United Kingdom', label: 'United Kingdom'},
|
||||
* {value: 'Afghanistan', label: 'Afghanistan'},
|
||||
* {code: 'us', name: 'United States', display: 'United States of America'},
|
||||
* {code: 'gb', name: 'United Kingdom'},
|
||||
* {code: 'af', name: 'Afghanistan'},
|
||||
* ...
|
||||
* {value: 'United Arab Emirates', label: 'United Arab Emirates'},
|
||||
* {value: 'United States', label: 'United States of America'},
|
||||
* {value: 'United Kingdom', label: 'United Kingdom'},
|
||||
* {value: 'Uzbekistan', label: 'Uzbekistan'},
|
||||
* {code: 'ae', name: 'United Arab Emirates'},
|
||||
* {code: 'us', name: 'United States', display: 'United States of America'},
|
||||
* {code: 'gb', name: 'United Kingdom'},
|
||||
* {code: 'uz', name: 'Uzbekistan'},
|
||||
* ...
|
||||
* {value: 'Zimbabwe', label: 'Zimbabwe'}
|
||||
* {code: 'zm', name: 'Zimbabwe'}
|
||||
* ]
|
||||
*/
|
||||
module.exports.registrationCountryOptions =
|
||||
countryOptions(dupeCommonCountries(countryInfo, ['us', 'gb']), 'name');
|
||||
countryOptions(dupeCommonCountries(countryInfo, ['us', 'gb']), 'code');
|
||||
|
||||
/* subdivisionOptions uses iso-3166 data to produce an array like:
|
||||
* [
|
||||
|
|
|
@ -567,6 +567,16 @@
|
|||
"pattern": "^/bearstack/?$",
|
||||
"redirect": "/ideas"
|
||||
},
|
||||
{
|
||||
"name": "talking-tales-tutorial-redirect",
|
||||
"pattern": "^/talking-tales/?$",
|
||||
"redirect": "/projects/editor?tutorial=talking"
|
||||
},
|
||||
{
|
||||
"name": "code-a-cartoon-tutorial-redirect",
|
||||
"pattern": "^/code-a-cartoon/?$",
|
||||
"redirect": "/projects/331474033/editor/?tutorial=code-cartoon"
|
||||
},
|
||||
{
|
||||
"name": "favorite-tutorial-redirect",
|
||||
"pattern": "^/favorite/?$",
|
||||
|
|
|
@ -74,15 +74,6 @@ describe('unit test lib/country-data.js', () => {
|
|||
expect(ukItems.length).toEqual(2);
|
||||
});
|
||||
|
||||
test('registrationCountryOptions object uses country names for both option label and option value', () => {
|
||||
expect(typeof registrationCountryOptions).toBe('object');
|
||||
// test that there is one option with label and value === 'Brazil'
|
||||
const brazilOptions = registrationCountryOptions.reduce((acc, thisCountry) => (
|
||||
(thisCountry.value === 'Brazil' && thisCountry.label === 'Brazil') ? [...acc, thisCountry] : acc
|
||||
), []);
|
||||
expect(brazilOptions.length).toEqual(1);
|
||||
});
|
||||
|
||||
test('registrationCountryOptions object places USA and UK at start, with display name versions', () => {
|
||||
expect(typeof registrationCountryOptions).toBe('object');
|
||||
const numCountries = countryInfo.length;
|
||||
|
@ -90,17 +81,17 @@ describe('unit test lib/country-data.js', () => {
|
|||
// test that the two entries have been added to the start of the array, and that
|
||||
// the name of the USA includes "America"
|
||||
expect(registrationCountryOptions.length).toEqual(numCountries + 2);
|
||||
expect(registrationCountryOptions[0]).toEqual({value: 'United States', label: 'United States of America'});
|
||||
expect(registrationCountryOptions[1]).toEqual({value: 'United Kingdom', label: 'United Kingdom'});
|
||||
expect(registrationCountryOptions[0]).toEqual({value: 'us', label: 'United States of America'});
|
||||
expect(registrationCountryOptions[1]).toEqual({value: 'gb', label: 'United Kingdom'});
|
||||
|
||||
// test that there are now two entries for USA
|
||||
const usaOptions = registrationCountryOptions.reduce((acc, thisCountry) => (
|
||||
thisCountry.value === 'United States' ? [...acc, thisCountry] : acc
|
||||
thisCountry.value === 'us' ? [...acc, thisCountry] : acc
|
||||
), []);
|
||||
expect(usaOptions.length).toEqual(2);
|
||||
// test that there are now two entries for UK
|
||||
const ukOptions = registrationCountryOptions.reduce((acc, thisCountry) => (
|
||||
thisCountry.value === 'United Kingdom' ? [...acc, thisCountry] : acc
|
||||
thisCountry.value === 'gb' ? [...acc, thisCountry] : acc
|
||||
), []);
|
||||
expect(ukOptions.length).toEqual(2);
|
||||
});
|
||||
|
|
Loading…
Add table
Reference in a new issue