Unable to type into number input with FuncUnit

258 Views Asked by At

I'm using FuncUnit with Jasmine to test my web application, and one issue I've run into consistently relates to typing into an input of type number.

<input type="number" min="0.01" step="0.01" pattern="[0-9]+([\.|,][0-9]+)?" class="form-control m-wrap m-ctrl-large" placeholder="10" onkeypress=" return isDecimalKey(event); ">

The isDecimalKey method basically checks typecodes to make sure that the user is entering a number or decimal point:

function isDecimalKey(e) {
    var charCode = (e.which) ? e.which : event.keyCode;
    if (charCode !== 46 && charCode > 31
        && (charCode < 48 || charCode > 57))
        return false;
    else
        return true;
}

When typing into the input manually, I'm able to highlight the current value with Ctrl+A, delete it with either backspace or the delete key, and enter a new value. However, when trying to do the same with FuncUnit, I get the following error:

Uncaught InvalidStateError: Failed to read the 'selectionStart' property from 'HTMLInputElement': The input element's type ('number') does not support selection.

I've tried the following methods of insertion:

F('input').visible().click().type('[ctrl]a[ctrl-up][delete] 6');
F('input').visible().click().type('[\b][\b] 6');
F('input').visible().click().type('6');
F('input').visible().dblclick().type('6');

So far, none of the above has worked. What is the best way for me to go about manipulating this input's value? Thanks!

0

There are 0 best solutions below