AmoghAtreya commented on code in PR #44959:
URL: https://github.com/apache/superset/pull/44959#discussion_r4187582854


##########
superset-frontend/src/explore/components/controls/ControlPopover/ControlPopover.test.tsx:
##########
@@ -209,6 +209,42 @@ test('Controlled mode', async () => {
   });
 });
 
+test('stays closed when a parent keeps open={false}', async () => {
+  const onOpenChange = jest.fn();
+  setupTest({
+    ...createProps(),
+    destroyOnHidden: true,
+    open: false,
+    onOpenChange,
+  });
+
+  expect(screen.queryByText('Control Popover Test')).not.toBeInTheDocument();
+  await userEvent.click(screen.getByTestId('control-popover'));
+  expect(onOpenChange).toHaveBeenCalledWith(true);
+  expect(screen.queryByText('Control Popover Test')).not.toBeInTheDocument();
+});
+
+test('does not close on Escape when a parent keeps open={true}', async () => {
+  const onOpenChange = jest.fn();
+  setupTest({
+    ...createProps(),
+    destroyOnHidden: true,
+    open: true,
+    onOpenChange,
+  });
+
+  expect(await screen.findByText('Control Popover Test')).toBeInTheDocument();
+
+  fireEvent.keyDown(screen.getByTestId('control-popover'), {
+    key: 'Escape',
+    code: 27,
+    charCode: 0,

Review Comment:
   Updated. The controlled Escape test now fires `key: 'Escape'`, `code: 
'Escape'`, and `keyCode: 27`.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to