1

I'm trying to test our polymer component which has an iron-input in it. To test things like max-length and filtering of allowed patterns I would like to test for certain keyboard inputs. Somehow this does not seem to work, the value of the iron-input element stays the same.

I tried these methods:

// from iron-test-helpers
MockInteractions.pressAndReleaseKeyOn(input, undefined, [], '2');

// generic way
var e = document.createEvent('TextEvent');
e.initTextEvent('textInput', true, true, null, 'Bob');
input.dispatchEvent(e);

//check input.value (native) and input.bindValue (iron-input var, set after input event is triggered)
console.log(input.value);

console.log(input.bindValue);
assert.equal(input.bindValue, '123456');   
Maarten
  • 4,643
  • 7
  • 37
  • 51

0 Answers0