Skip to content

Commit

Permalink
Fix RangeError when formFiller tries to fill empty select
Browse files Browse the repository at this point in the history
Closes #47
  • Loading branch information
fzaninotto committed Mar 26, 2014
1 parent d8d0a9d commit 71ff92d
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/species/formFiller.js
Original file line number Diff line number Diff line change
Expand Up @@ -102,14 +102,14 @@ define(function(require) {
}
}

var character = config.elementMapTypes[elementType](element);
var value = config.elementMapTypes[elementType](element);

if (typeof config.showAction == 'function') {
config.showAction(element);
}

if (typeof config.logger.log == 'function') {
config.logger.log('gremlin', 'formFiller', 'input', character, 'in', element);
config.logger.log('gremlin', 'formFiller', 'input', value, 'in', element);
}
}

Expand All @@ -129,6 +129,7 @@ define(function(require) {

function fillSelect(element) {
var options = element.querySelectorAll('option');
if (options.length === 0) return;
var randomOption = config.randomizer.pick(options);

for (var i = 0, c = options.length; i < c; i++) {
Expand Down

0 comments on commit 71ff92d

Please sign in to comment.