From 51aa38fb3437281e54196e6acb69e750c30d3c51 Mon Sep 17 00:00:00 2001 From: Ben Wheeler Date: Mon, 5 Aug 2019 23:33:05 -0400 Subject: [PATCH] consolidated country-data and contry-list --- src/components/registration/steps.jsx | 47 +- src/lib/country-data.js | 1104 ++++++++++++++++- src/lib/country-list.js | 1069 ---------------- .../teacherregistration.jsx | 8 +- test/unit/lib/country-data.test.js | 103 +- test/unit/lib/country-list.test.js | 88 -- 6 files changed, 1192 insertions(+), 1227 deletions(-) delete mode 100644 src/lib/country-list.js delete mode 100644 test/unit/lib/country-list.test.js diff --git a/src/components/registration/steps.jsx b/src/components/registration/steps.jsx index f9c0b3b4c..c3c2aa993 100644 --- a/src/components/registration/steps.jsx +++ b/src/components/registration/steps.jsx @@ -33,29 +33,20 @@ require('./steps.scss'); const DEFAULT_COUNTRY = 'us'; /** - * Return a list of options to give to frc select + * Return a list of options to give to select * @param {object} reactIntl react-intl, used to localize strings - * @param {string} defaultCountry optional string of default country to put at top of list - * @return {object} ordered set of county options formatted for frc select + * @return {object} ordered set of county options formatted for select */ -const getCountryOptions = (reactIntl, defaultCountry) => { - const options = countryData.countryOptions.concat({ - label: reactIntl.formatMessage({id: 'registration.selectCountry'}), - disabled: true, - value: '' - }); - - if (typeof defaultCountry !== 'undefined') { - return options.sort((a, b) => { - if (a.disabled) return -1; - if (b.disabled) return 1; - if (a.value === defaultCountry) return -1; - if (b.value === defaultCountry) return 1; - return 0; - }); - } - return options; -}; +const getCountryOptions = reactIntl => ( + [ + { + label: reactIntl.formatMessage({id: 'registration.selectCountry'}), + disabled: true, + value: '' + }, + ...countryData.registrationCountryOptions + ] +); const NextStepButton = props => (