mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-11-28 22:43:30 +03:00
524b23c182
refs https://github.com/TryGhost/Ghost/issues/14101 - migrated staff user controller to native class syntax - removed use of `{{action}}` helper - moved from custom components to native `<input>` and `<textarea>` for form fields - added `{{select-on-click}}` modifier to cover the `<GhTextingInput @selectOnClick>` option behaviour for any input element - added `submitForm()` test helper that finds closest `form` element and trigger's a `submit` event on it simulating <kbd>Enter</kbd> being pressed whilst a field has focus
11 lines
314 B
JavaScript
11 lines
314 B
JavaScript
import {find, triggerEvent} from '@ember/test-helpers';
|
|
|
|
export async function submitForm(elementOrSelector) {
|
|
if (typeof elementOrSelector === 'string') {
|
|
elementOrSelector = find(elementOrSelector);
|
|
}
|
|
|
|
const form = elementOrSelector.closest('form');
|
|
await triggerEvent(form, 'submit');
|
|
}
|