-
Notifications
You must be signed in to change notification settings - Fork 91
Open
Description
We have input fields on which validation runs after focus-out, and because of that I need to write tests like this:
module('Integration | Component | login-form', function(hooks) {
setupRenderingTest(hooks);
test('validate inputs', async function(assert) {
await render(hbs`<LoginForm />`);
await page
.email('')
.blurEmail()
.password('')
.blurPassword();
assert.ok(page.submitDisabled, 'Submit button is diabled');
assert.equal(
page.emailError,
"Email can't be blank",
'Shows error when email is blank',
);
assert.equal(
page.passwordError,
"Password can't be blank",
'Shows error when password is blank',
);
});
});Is there any way to have after option on the fillable helper, with following API:
/**
* @param {string} selector - CSS selector of the element to look for text
* @param {Object} options - Additional options
* @param {string|function} options.after - event name to trigger or callback function
*/
function fillable(selector, options) {
if (typeOf(options.after) === 'string') {
const AVAILABLE_EVENTS = ['focut-out', 'other-event', 'one-more-event'];
if (!AVAILABLE_EVENTS.includes(options.after)) {
throw EmberError('Invalid after event');
}
}
// ... some code
}
export default PageObject.create({
email: fillable('[data-test-login-email] input', { after: 'focut-out' }),
password: fillable('[data-test-login-password] input', { after: 'focut-out' }),
});alexander-demicev, vlad-tryhub, Artiikk and san650Artiikk
Metadata
Metadata
Assignees
Labels
No labels