ui: Add an isDestroyed check for the MenuPanel component (#11104)

This solves an occasionally flakey tests I see every so often
This commit is contained in:
John Cowen 2021-09-22 18:33:31 +01:00 committed by GitHub
parent e088d8674c
commit ececa7da45
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 10 additions and 8 deletions

View File

@ -12,14 +12,16 @@ export default Component.extend(Slotted, {
actions: {
connect: function($el) {
next(() => {
// if theres only a single choice in the menu and it doesn't have an
// immediate button/link/label to click then it will be a
// confirmation/informed action
const isConfirmationMenu = this.dom.element(
'li:only-child > [role="menu"]:first-child',
$el
);
set(this, 'isConfirmation', typeof isConfirmationMenu !== 'undefined');
if(!this.isDestroyed) {
// if theres only a single choice in the menu and it doesn't have an
// immediate button/link/label to click then it will be a
// confirmation/informed action
const isConfirmationMenu = this.dom.element(
'li:only-child > [role="menu"]:first-child',
$el
);
set(this, 'isConfirmation', typeof isConfirmationMenu !== 'undefined');
}
});
},
change: function(e) {