Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
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'));
});
});
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');
});
});
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'));
});
});
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'));
});
});
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');
});
});
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');
});
});
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'));
});
});
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;
});
});
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');
});
});