How to use the world-countries.length function in world-countries

To help you get started, we’ve selected a few world-countries examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github huridocs / uwazi / app / react / Forms / components / specs / IconSelector.spec.js View on Github external
it('should render a DropdownList with icons and flags, extending passed props', () => {
    render();
    const firstFlagIndex = component.find(DropdownList).props().data.length - countries.length;
    expect(component.find(DropdownList).props().data.length).toBe(iconNames.length + countries.length + 1);

    expect(component.find(DropdownList).props().data[1].type).toBe('Icons');
    expect(component.find(DropdownList).props().data[1]._id).toBe(iconNames[0]);
    expect(component.find(DropdownList).props().data[1].label).toBe(iconNames[0]);

    expect(component.find(DropdownList).props().data[firstFlagIndex].type).toBe('Flags');
    expect(component.find(DropdownList).props().data[firstFlagIndex]._id).toBe(countries[0].cca3);
    expect(component.find(DropdownList).props().data[firstFlagIndex].label).toBe(countries[0].name.common);

    expect(component.find(DropdownList).props().valueComponent).toBe(ListItem);
    expect(component.find(DropdownList).props().itemComponent).toBe(ListItem);
    expect(component.find(DropdownList).props().defaultValue).toBe(component.find(DropdownList).props().data[0]);
    expect(component.find(DropdownList).props().onChange).toBe('Function');
  });
});
github huridocs / uwazi / app / react / Forms / components / specs / IconSelector.spec.js View on Github external
it('should render a DropdownList with icons and flags, extending passed props', () => {
    render();
    const firstFlagIndex = component.find(DropdownList).props().data.length - countries.length;
    expect(component.find(DropdownList).props().data.length).toBe(iconNames.length + countries.length + 1);

    expect(component.find(DropdownList).props().data[1].type).toBe('Icons');
    expect(component.find(DropdownList).props().data[1]._id).toBe(iconNames[0]);
    expect(component.find(DropdownList).props().data[1].label).toBe(iconNames[0]);

    expect(component.find(DropdownList).props().data[firstFlagIndex].type).toBe('Flags');
    expect(component.find(DropdownList).props().data[firstFlagIndex]._id).toBe(countries[0].cca3);
    expect(component.find(DropdownList).props().data[firstFlagIndex].label).toBe(countries[0].name.common);

    expect(component.find(DropdownList).props().valueComponent).toBe(ListItem);
    expect(component.find(DropdownList).props().itemComponent).toBe(ListItem);
    expect(component.find(DropdownList).props().defaultValue).toBe(component.find(DropdownList).props().data[0]);
    expect(component.find(DropdownList).props().onChange).toBe('Function');
  });
});
github sarovin / react-native-prefix-picker / lib / picker.js View on Github external
getCountries() {
    const array = [];
    for (let i = 0; i < countries.length; i++) {
      if (countries[i].callingCode.length > 1) {
        for (let j = 0; j < countries[i].callingCode.length; j++) {
          array.push({
            cca2: `${countries[i].cca2} ( ${countries[i].callingCode[j]} )`,
            callingCode: countries[i].callingCode[j],
          });
        }
      } else {
        array.push({
          cca2: countries[i].cca2,
          callingCode: countries[i].callingCode[0],
        });
      }
    }
    return array;
  }

world-countries

List of world countries in JSON, CSV, XML and Yaml

ODbL-1.0
Latest version published 1 year ago

Package Health Score

68 / 100
Full package analysis