 = 0;
    }
    index = index + delta;
    if (n > 0) {
      index = ((index % n) + n) % n;
    }
    if (index < 0 || index >= suggestions.length) {
      this.set('locusItem', null);
    } else {
      this.set('locusItem', suggestions[index]);
    }
  },

  computeSelectedName(selectedItem) {
    if (!selectedItem) return '';
    return selectedItem.name;
  },
};

Polymer({
  is: 'autocomplete-box',
  behaviors: [
    AutocompleteBoxBehavior,
    Polymer.IronFormElementBehavior,
    Polymer.IronValidata