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]>
|
- returns: <[Promise]>
|
||||||
|
|
||||||
#### fileChooser.cancel()
|
#### fileChooser.cancel()
|
||||||
- returns: <[Promise]>
|
|
||||||
|
|
||||||
Closes the file chooser without selecting any files.
|
Closes the file chooser without selecting any files.
|
||||||
|
|
||||||
|
@ -75,7 +75,7 @@ export class FileChooser {
|
|||||||
/**
|
/**
|
||||||
* Closes the file chooser without selecting any files.
|
* Closes the file chooser without selecting any files.
|
||||||
*/
|
*/
|
||||||
async cancel(): Promise<void> {
|
cancel() {
|
||||||
assert(
|
assert(
|
||||||
!this._handled,
|
!this._handled,
|
||||||
'Cannot cancel FileChooser which is already handled!'
|
'Cannot cancel FileChooser which is already handled!'
|
||||||
|
@ -295,7 +295,13 @@ describe('input tests', function () {
|
|||||||
]);
|
]);
|
||||||
await fileChooser.cancel();
|
await fileChooser.cancel();
|
||||||
let error = null;
|
let error = null;
|
||||||
await fileChooser.cancel().catch((error_) => (error = error_));
|
|
||||||
|
try {
|
||||||
|
fileChooser.cancel();
|
||||||
|
} catch (error_) {
|
||||||
|
error = error_;
|
||||||
|
}
|
||||||
|
|
||||||
expect(error.message).toBe(
|
expect(error.message).toBe(
|
||||||
'Cannot cancel FileChooser which is already handled!'
|
'Cannot cancel FileChooser which is already handled!'
|
||||||
);
|
);
|
||||||
|
Loading…
Reference in New Issue
Block a user