sadpandajoe commented on code in PR #43940:
URL: https://github.com/apache/superset/pull/43940#discussion_r3962078290


##########
superset-frontend/src/dashboard/components/gridComponents/TabsRenderer/TabsRenderer.test.tsx:
##########
@@ -263,5 +264,117 @@ describe('TabsRenderer', () => {
     expect(container).toHaveStyleRule('cursor', 'move', {
       target: '.dragdroppable-tab *',
     });
+
+    // Release the pointer so the drag does not outlive this test. dnd-kit
+    // keeps swallowing clicks on the shared document for 50ms after a drag
+    // ends, which would eat the tab click of whichever test runs next.
+    fireEvent.pointerUp(document, { button: 0, isPrimary: true, clientX: 50 });
+    await sleep(60);
+  });
+
+  // jsdom's cascade ignores specificity, so assert on the emotion rule rather
+  // than the computed style, which antd's own `position: relative` would win
+  const TAB_BAR = { target: /> ?\.ant-tabs ?> ?\.ant-tabs-nav$/ };
+
+  test('pins the tab bar below the offset supplied by the dashboard', () => {
+    render(
+      <StickyTabsOffsetContext.Provider value={64}>
+        <TabsRenderer {...mockProps} />
+      </StickyTabsOffsetContext.Provider>,
+    );
+    const container = screen.getByTestId('dashboard-component-tabs');
+
+    expect(container).toHaveStyleRule('position', 'sticky', TAB_BAR);
+    expect(container).toHaveStyleRule('top', '64px', TAB_BAR);
+  });
+
+  test('leaves the tab bar in document flow without a dashboard offset', () => 
{
+    render(<TabsRenderer {...mockProps} />);
+    const container = screen.getByTestId('dashboard-component-tabs');
+
+    expect(container).not.toHaveStyleRule('position', 'sticky', TAB_BAR);
+  });
+
+  test('leaves the tab bar in document flow in edit mode', () => {
+    render(
+      <StickyTabsOffsetContext.Provider value={64}>
+        <TabsRenderer {...mockProps} editMode />
+      </StickyTabsOffsetContext.Provider>,
+    );
+    const container = screen.getByTestId('dashboard-component-tabs');
+
+    expect(container).not.toHaveStyleRule('position', 'sticky', TAB_BAR);
+  });
+
+  test('stacks nested tab bars beneath its own tab bar', () => {

Review Comment:
   The child offset now depends on `ResizeObserver`, but this only asserts the 
initial height. When a parent tab bar reflows after mount (for example after 
font loading or a narrow viewport wraps labels), a stale child offset lets 
sticky bars overlap. Could this trigger the observer after changing the 
measured height and assert the descendant offset updates?



-- 
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