These are chat archives for airbnb/enzyme

13th
Jun 2017
Anoop Kumar Gupta
@guptaanoop2005
Jun 13 2017 09:30
Hi, I am using a function for my onChange which moves focus to next input for my pascode component (has 6 input field).
How can I test this code if(e.target.value){
let nextElement = e.target.nextSibling,
nextInput = nextElement ? nextElement.nextSibling : null;
            if(nextInput && nextInput.nodeName === 'INPUT'){
                nextInput.focus();

                if(nextInput.setSelectionRange){
                    nextInput.setSelectionRange(0, 1);
                }
            }
        }
Matt
@Mbeaulne
Jun 13 2017 11:15
@guptaanoop2005 could you use 'simulate' and spy on the onchange event?
Wait NVM
Anoop Kumar Gupta
@guptaanoop2005
Jun 13 2017 12:54
@Mbeaulne thanks..let me give it a try