fix(filechooser): cancel is sync (#6937)
BREAKING CHANGE: FileChooser.cancel() is now synchronous.
This commit is contained in:
parent
0c26301bee
commit
2ba61e04e9
@ -2790,7 +2790,6 @@ await fileChooser.accept(['/tmp/myfile.pdf']);
|
||||
- returns: <[Promise]>
|
||||
|
||||
#### fileChooser.cancel()
|
||||
- returns: <[Promise]>
|
||||
|
||||
Closes the file chooser without selecting any files.
|
||||
|
||||
|
@ -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!'
|
||||
|
@ -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!'
|
||||
);
|
||||
|
Loading…
Reference in New Issue
Block a user