How to use the test-drive-react.simulate.mouseDown 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 / date-picker.spec.tsx View on Github external
it('has a button which steps back a month', async () => {
            const {waitForDom} = clientRenderer.render(
                
            );

            expect(bodySelect('YEAR')).to.have.text('2017');
            expect(bodySelect('MONTH_NAME')).to.have.text('January');
            simulate.mouseDown(bodySelect('PREV_MONTH_BUTTON'));

            await waitForDom(() => {
                expect(bodySelect('YEAR')).to.have.text('2016');
                expect(bodySelect('MONTH_NAME')).to.have.text('December');
            });
        });
github wix-playground / stylable-components / test / components / date-picker.spec.tsx View on Github external
it('should show and hide the dropdown when the input is clicked', async () => {
        const {select, waitForDom} = clientRenderer.render();
        const datePickerInput = select(datePickerInputId);

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

        simulate.mouseDown(datePickerInput);

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

        simulate.mouseDown(datePickerInput);

        await waitForDom(() => expect(bodySelect(datePickerDropdownId)).to.be.absent());
    });
github wix-playground / stylable-components / test / components / slider.spec.tsx View on Github external
await waitFor(() => {
                const element = select('SLIDER');
                const handle = select('SLIDER-HANDLE');
                const progress = select('SLIDER-PROGRESS');

                simulate.mouseDown(element, {
                    currentTarget: element!,
                    clientX: eventMock.clientX,
                    clientY: eventMock.clientY
                });

                expect(handle!.style[positionProp as any]).to.equal('80%');
                expect(progress!.style[sizeProp as any]).to.equal('80%');
            });
        });
github wix-playground / stylable-components / test-kit / components / selection-list-driver.ts View on Github external
public mouseDown(element: Element): void {
        simulate.mouseDown(element, {button: 0});
    }
github wix-playground / stylable-components / test / components / stepper.spec.tsx View on Github external
await waitForDom(() => {
                    simulate.mouseDown(select('STEPPER'), dragStartPoint);
                    windowStub.simulate('mousemove', {
                        clientX: dragStartPoint.clientX,
                        clientY: dragStartPoint.clientY - dragStep,
                        shiftKey: true
                    });

                    expect(onUp).to.have.been.calledOnce;
                    expect(onUp).to.have.been.calledWithMatch({shiftKey: true});
                    expect(onDown).not.to.have.been.called;
                });
            });
github wix-playground / stylable-components / test / components / stepper.spec.tsx View on Github external
await waitForDom(() => {
                    simulate.mouseDown(select('STEPPER'), {clientX: 100, clientY: 100});
                    windowStub.simulate('mousemove', {
                        clientX: dragStartPoint.clientX,
                        clientY: dragStartPoint.clientY - dragStep
                    });
                    windowStub.simulate('mousemove', {
                        clientX: dragStartPoint.clientX,
                        clientY: dragStartPoint.clientY + dragStep
                    });
                    windowStub.simulate('mouseup');
                    windowStub.simulate('mousemove', {
                        clientX: dragStartPoint.clientX,
                        clientY: dragStartPoint.clientY - dragStep
                    });
                    windowStub.simulate('mousemove', {
                        clientX: dragStartPoint.clientX,
                        clientY: dragStartPoint.clientY + dragStep
github wix-playground / stylable-components / test-kit / components / date-picker-driver.ts View on Github external
public clickOnDay(day: number): void {
        simulate.mouseDown(this.getDay(day));
    }
github wix-playground / stylable-components / test-kit / components / slider-driver.ts View on Github external
public mouseDown(event: SliderEventCoordinates) {
        const element = this.slider;
        simulate.mouseDown(element, {
            preventDefault: noop,
            currentTarget: element!,
            clientX: event.clientX,
            clientY: event.clientY
        });
    }
    public mouseMove(event: SliderEventCoordinates, environment: WindowStub) {
github wix-playground / stylable-components / test-kit / components / date-picker-driver.ts View on Github external
public clickOnNextMonth(): void {
        simulate.mouseDown(this.nextMonthLabel);
    }
github wix-playground / stylable-components / test-kit / components / date-picker-driver.ts View on Github external
public clickOnPrevMonth(): void {
        simulate.mouseDown(this.prevMonthLabel);
    }