How to use the test-drive-react.simulate.focus function in test-drive-react

To help you get started, we’ve selected a few test-drive-react examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github wix-playground / stylable-components / test / components / time-picker.spec.tsx View on Github external
beforeEach(() => {
                simulate.focus(mm);
                mm.value = '7';
                simulate.change(mm);
            });
            it('should set focus state', () => {
github wix-playground / stylable-components / test / components / time-picker.spec.tsx View on Github external
beforeEach(() => {
                simulate.focus(ampm);
                simulate.keyDown(ampm, {keyCode: keycode('space')});
            });
            it('onChange should be callen with "16:55"', () => {
github wix-playground / stylable-components / test / components / toggle.spec.tsx View on Github external
it('pressing space on focused input should trigger onChange', function() {
            const input = renderer.select('TOGGLE_INPUT');
            simulate.focus(input);
            simulate.change(input);
            expect(onChange).to.have.been.calledOnce;
            expect(onChange).to.have.been.calledWithExactly({value: true});
        });
    });
github wix-playground / stylable-components / test / components / date-picker.spec.tsx View on Github external
it('should appear when the Spacebar is pressed and the openOnFocus property is set to false', async () => {
            const {waitForDom} = clientRenderer.render();

            simulate.focus(bodySelect(datePickerInputId));

            await waitForDom(() => expect(bodySelect(datePickerDropdownId)).to.be.absent());

            simulate.keyDown(bodySelect(datePickerInputId), {keyCode: keycode('space')});

            await waitForDom(() => expect(bodySelect(datePickerDropdownId)).to.be.present());
        });
    });
github wix-playground / stylable-components / test / components / time-picker.spec.tsx View on Github external
it('should set focus on hh on first input', () => {
                        simulate.blur(secondInputMM);
                        simulate.focus(firstStepperUp);
                        simulate.click(firstStepperUp);
                        expect(document.activeElement === firstInputHH).to.be.true;
                    });
                });
github wix-playground / stylable-components / test / components / time-picker.spec.tsx View on Github external
beforeEach(() => {
                simulate.focus(hh);
                hh.value = '1';
                simulate.change(hh);
            });
            it('should set focus state', () => {
github wix-playground / stylable-components / test-kit / components / slider-driver.ts View on Github external
public focus(index: number = 0): void {
        simulate.focus(this.getHandle(index));
    }
github wix-playground / stylable-components / test / components / time-picker.spec.tsx View on Github external
beforeEach(() => {
                    simulate.blur(firstInputMM);
                    simulate.click(secondInputMM);
                    simulate.focus(secondInputMM);
                });
                describe.skip('click on stepper in first input', () => {
github wix-playground / stylable-components / test / components / date-picker.spec.tsx View on Github external
function simulateKeyPress(keyToPress: string) {
            simulate.focus(datePickerInput);
            simulate.keyDown(datePickerInput, {keyCode: keycode(keyToPress)});
            simulate.keyDown(datePickerInput, {keyCode: keycode('enter')});
        }