-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #774 from qonto/fixPastInputWithSpace
Improve pasting from clipboard values support
- Loading branch information
Showing
4 changed files
with
72 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
21 changes: 21 additions & 0 deletions
21
test-app/tests/integration/components/amount-input/helpers/paste-value.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import { triggerEvent } from '@ember/test-helpers'; | ||
import type { Target } from '@ember/test-helpers'; | ||
|
||
/** | ||
* Simulates a user pasting a value into a target element. | ||
* | ||
* @param {Target} target - The target element to paste the value into | ||
* @param {string} value - The value to paste | ||
* @return {Promise<void>} A Promise that resolves when the paste event is triggered | ||
*/ | ||
export function simulateUserPasteValue( | ||
target: Target, | ||
value: string, | ||
): Promise<void> { | ||
const getData = (): string => value; | ||
return triggerEvent(target, 'paste', { | ||
clipboardData: { | ||
getData, | ||
}, | ||
}); | ||
} |