Skip to content

Commit

Permalink
Pull out 5.x tests
Browse files Browse the repository at this point in the history
  • Loading branch information
lane-formio committed Sep 27, 2023
1 parent c70c01d commit e4d5881
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 64 deletions.
22 changes: 0 additions & 22 deletions src/components/day/Day.unit.js
Original file line number Diff line number Diff line change
Expand Up @@ -222,26 +222,4 @@ describe('Day Component', () => {
});
comp1.fields.year.hide = false;
});

it('Should restore focus after redraw', (done) => {
const element = document.createElement('div');
document.body.appendChild(element);
Formio.createForm(element, comp6).then(form => {
const textField = form.getComponent(['textField']);
textField.setValue('test');

setTimeout(() => {
const day = form.getComponent(['day']);
document.querySelector('select.form-control').focus();
day.refs.month.value = 2;
day.refs.month.dispatchEvent(new Event('input'));

setTimeout(() => {
console.log(global.document.activeElement, day.refs.month);
assert(global.document.activeElement === day.refs.month, 'Should keep focus on the year select');
done();
}, 200);
}, 500);
}).catch(done);
});
});
42 changes: 0 additions & 42 deletions src/components/phonenumber/PhoneNumber.unit.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,46 +13,4 @@ describe('PhoneNumber Component', () => {
Harness.testElements(component, 'input[type="text"]', 1);
});
});

it('Should check mask and value in the phone component in the email template', (done) => {
const formJson = {
components: [{
label: 'Phone Number',
tableView: true,
allowMultipleMasks: true,
inputMasks: [{
label: 'mask1',
mask: 'mask1'
}],
key: 'phoneNumber',
type: 'phoneNumber',
input: true
}]
};
const element = document.createElement('div');
Formio.createForm(element, formJson)
.then(form => {
form.setSubmission({
data: {
phoneNumber: {
value: 'mask1',
maskName: 'mask2'
}
},
});

const phoneNumber = form.getComponent('phoneNumber');

setTimeout(() => {
assert.equal(phoneNumber.dataValue.value, 'mask1', 'Should check value');
assert.equal(phoneNumber.dataValue.maskName, 'mask2', 'Should check maskName');
const toString = phoneNumber.getValueAsString(phoneNumber.dataValue, { email: true });
assert.ok(toString.includes('table'), 'Email template should render html table');
assert.ok(toString.includes(phoneNumber.dataValue.maskName), 'Email template should have Phone Number mackName');
assert.ok(toString.includes(phoneNumber.dataValue.value), 'Email template should have Phone Number value');
done();
}, 300);
})
.catch(done);
});
});

0 comments on commit e4d5881

Please sign in to comment.