fix(filechooser): cancel is sync (#6937)

BREAKING CHANGE: FileChooser.cancel() is now synchronous.
This commit is contained in:
Darío Kondratiuk 2021-03-02 11:27:11 -03:00 committed by GitHub
parent 0c26301bee
commit 2ba61e04e9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 8 additions and 3 deletions

View File

@ -2790,7 +2790,6 @@ await fileChooser.accept(['/tmp/myfile.pdf']);
- returns: <[Promise]>
#### fileChooser.cancel()
- returns: <[Promise]>
Closes the file chooser without selecting any files.

View File

@ -75,7 +75,7 @@ export class FileChooser {
/**
* Closes the file chooser without selecting any files.
*/
async cancel(): Promise<void> {
cancel() {
assert(
!this._handled,
'Cannot cancel FileChooser which is already handled!'

View File

@ -295,7 +295,13 @@ describe('input tests', function () {
]);
await fileChooser.cancel();
let error = null;
await fileChooser.cancel().catch((error_) => (error = error_));
try {
fileChooser.cancel();
} catch (error_) {
error = error_;
}
expect(error.message).toBe(
'Cannot cancel FileChooser which is already handled!'
);