How to use the test-drive-react.change 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 / birthday-picker.spec.tsx View on Github external
it('Emits onChange when going from valid to valid state', async function() {
        const onChange = sinon.spy();
        const {select, waitForDom} = clientRenderer.render(
            
        );

        await waitForDom(() => {
            expect(select('BIRTHDAY_PICKER')).to.be.present();
        });

        change(select('BIRTHDAY_PICKER_DAY'), '27');

        return waitForDom(() => {
            expect(onChange).to.have.been.calledOnce.and.calledWith(new Date('1986-04-27T00:00Z'));
        });
    });
github wix-playground / stylable-components / test / components / birthday-picker.spec.tsx View on Github external
it('Displays the date and allows changing it', async function() {
        const {select, waitForDom} = clientRenderer.render();

        await waitForDom(() => {
            expect(select('BIRTHDAY_PICKER')).to.be.present();
        });

        change(select('BIRTHDAY_PICKER_YEAR'), '2002');
        change(select('BIRTHDAY_PICKER_MONTH'), '10');
        change(select('BIRTHDAY_PICKER_DAY'), '12');

        await waitForDom(() => {
            expect(select('BIRTHDAY_PICKER_DEMO_RESULT')).to.contain.text('Selected date: 2002-10-12');
        });

        change(select('BIRTHDAY_PICKER_DAY'), '');

        return waitForDom(() => {
            expect(select('BIRTHDAY_PICKER_DEMO_RESULT')).to.contain.text('Selected date: 2002-10-12');
        });
    });
github wix-playground / stylable-components / test / components / birthday-picker.spec.tsx View on Github external
it('Emits onChange when going from invalid to valid state', async function() {
        const onChange = sinon.spy();
        const {select, waitForDom} = clientRenderer.render(
            
        );

        await waitForDom(() => {
            expect(select('BIRTHDAY_PICKER')).to.be.present();
        });

        change(select('BIRTHDAY_PICKER_YEAR'), '1986');
        change(select('BIRTHDAY_PICKER_MONTH'), '4');
        change(select('BIRTHDAY_PICKER_DAY'), '26');

        return waitForDom(() => {
            expect(onChange).to.have.been.calledOnce.and.calledWith(new Date('1986-04-26T00:00Z'));
        });
    });
github wix-playground / stylable-components / test / components / birthday-picker.spec.tsx View on Github external
it('Emits onChange when going from invalid to valid state', async function() {
        const onChange = sinon.spy();
        const {select, waitForDom} = clientRenderer.render(
            
        );

        await waitForDom(() => {
            expect(select('BIRTHDAY_PICKER')).to.be.present();
        });

        change(select('BIRTHDAY_PICKER_YEAR'), '1986');
        change(select('BIRTHDAY_PICKER_MONTH'), '4');
        change(select('BIRTHDAY_PICKER_DAY'), '26');

        return waitForDom(() => {
            expect(onChange).to.have.been.calledOnce.and.calledWith(new Date('1986-04-26T00:00Z'));
        });
    });
github wix-playground / stylable-components / test / components / birthday-picker.spec.tsx View on Github external
it('Displays the date and allows changing it', async function() {
        const {select, waitForDom} = clientRenderer.render();

        await waitForDom(() => {
            expect(select('BIRTHDAY_PICKER')).to.be.present();
        });

        change(select('BIRTHDAY_PICKER_YEAR'), '2002');
        change(select('BIRTHDAY_PICKER_MONTH'), '10');
        change(select('BIRTHDAY_PICKER_DAY'), '12');

        await waitForDom(() => {
            expect(select('BIRTHDAY_PICKER_DEMO_RESULT')).to.contain.text('Selected date: 2002-10-12');
        });

        change(select('BIRTHDAY_PICKER_DAY'), '');

        return waitForDom(() => {
            expect(select('BIRTHDAY_PICKER_DEMO_RESULT')).to.contain.text('Selected date: 2002-10-12');
        });
    });
github wix-playground / stylable-components / test / components / birthday-picker.spec.tsx View on Github external
it('Displays the date and allows changing it', async function() {
        const {select, waitForDom} = clientRenderer.render();

        await waitForDom(() => {
            expect(select('BIRTHDAY_PICKER')).to.be.present();
        });

        change(select('BIRTHDAY_PICKER_YEAR'), '2002');
        change(select('BIRTHDAY_PICKER_MONTH'), '10');
        change(select('BIRTHDAY_PICKER_DAY'), '12');

        await waitForDom(() => {
            expect(select('BIRTHDAY_PICKER_DEMO_RESULT')).to.contain.text('Selected date: 2002-10-12');
        });

        change(select('BIRTHDAY_PICKER_DAY'), '');

        return waitForDom(() => {
            expect(select('BIRTHDAY_PICKER_DEMO_RESULT')).to.contain.text('Selected date: 2002-10-12');
        });
    });
github wix-playground / stylable-components / test / components / birthday-picker.spec.tsx View on Github external
it('Emits onChange when going from invalid to valid state', async function() {
        const onChange = sinon.spy();
        const {select, waitForDom} = clientRenderer.render(
            
        );

        await waitForDom(() => {
            expect(select('BIRTHDAY_PICKER')).to.be.present();
        });

        change(select('BIRTHDAY_PICKER_YEAR'), '1986');
        change(select('BIRTHDAY_PICKER_MONTH'), '4');
        change(select('BIRTHDAY_PICKER_DAY'), '26');

        return waitForDom(() => {
            expect(onChange).to.have.been.calledOnce.and.calledWith(new Date('1986-04-26T00:00Z'));
        });
    });
github wix-playground / stylable-components / test / components / birthday-picker.spec.tsx View on Github external
it('Does not emit onChange when going from invalid to invalid state', async function() {
        const onChange = sinon.spy();
        const {select, waitForDom} = clientRenderer.render(
            
        );

        await waitForDom(() => {
            expect(select('BIRTHDAY_PICKER')).to.be.present();
        });

        change(select('BIRTHDAY_PICKER_MONTH'), '3');

        return waitForDom(() => {
            expect(onChange).to.have.not.been.called;
        });
    });
github wix-playground / stylable-components / test / components / birthday-picker.spec.tsx View on Github external
it('Displays the date and allows changing it', async function() {
        const {select, waitForDom} = clientRenderer.render();

        await waitForDom(() => {
            expect(select('BIRTHDAY_PICKER')).to.be.present();
        });

        change(select('BIRTHDAY_PICKER_YEAR'), '2002');
        change(select('BIRTHDAY_PICKER_MONTH'), '10');
        change(select('BIRTHDAY_PICKER_DAY'), '12');

        await waitForDom(() => {
            expect(select('BIRTHDAY_PICKER_DEMO_RESULT')).to.contain.text('Selected date: 2002-10-12');
        });

        change(select('BIRTHDAY_PICKER_DAY'), '');

        return waitForDom(() => {
            expect(select('BIRTHDAY_PICKER_DEMO_RESULT')).to.contain.text('Selected date: 2002-10-12');
        });
    });