bito-code-review[bot] commented on code in PR #37022:
URL: https://github.com/apache/superset/pull/37022#discussion_r2799034886


##########
superset-frontend/plugins/plugin-chart-echarts/src/utils/tooltip.test.tsx:
##########
@@ -0,0 +1,87 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+/** @jest-environment jsdom */
+import '@testing-library/jest-dom';
+import React from 'react';
+import { getDefaultTooltip } from './tooltip';
+import type { Refs } from '../types';
+
+test('getDefaultTooltip computes height and sets scroll styles', () => {
+  const div = document.createElement('div');
+  jest.spyOn(div, 'getBoundingClientRect').mockReturnValue({
+    x: 0,
+    y: 0,
+    width: 100,
+    height: 100,
+    top: 0,
+    right: 100,
+    bottom: 100,
+    left: 0,
+    toJSON: () => ({}),
+  } as DOMRect);
+
+  const divRef = React.createRef<HTMLDivElement>();
+  Object.defineProperty(divRef, 'current', { value: div });
+
+  const refs: Refs = { divRef };
+
+  // Set viewport dimensions
+  Object.defineProperty(document.documentElement, 'clientWidth', {
+    value: 1200,
+    configurable: true,
+  });
+  Object.defineProperty(document.documentElement, 'clientHeight', {
+    value: 1000,
+    configurable: true,
+  });
+
+  const tooltip = getDefaultTooltip(refs);
+
+  // Test behavioral properties
+  expect(tooltip.enterable).toBe(true);
+  expect(tooltip.confine).toBe(true);
+  expect(tooltip.hideDelay).toBe(50);
+
+  // Test that position function exists and is callable
+  expect(typeof tooltip.position).toBe('function');
+
+  // Test position function behavior - returns coordinates
+  const tooltipDom = document.createElement('div');
+  const result = tooltip.position(
+    [200, 300],
+    {} as any,
+    tooltipDom,
+    {} as any,
+    { contentSize: [300, 600], viewSize: [1200, 1000] },
+  );
+
+  // Verify position returns coordinate tuple
+  expect(Array.isArray(result)).toBe(true);
+  expect(result).toHaveLength(2);
+  expect(typeof result[0]).toBe('number');
+  expect(typeof result[1]).toBe('number');

Review Comment:
   <div>
   
   
   <div id="suggestion">
   <div id="issue"><b>Incomplete position assertions</b></div>
   <div id="fix">
   
   The test checks that the position function returns an array of two numbers, 
but doesn't verify the actual computed coordinates. To fully assert the 
behavior logic as per BITO rule [6262], add expectations for the position 
values. For the given test inputs, the expected result should be [210, 310].
   </div>
   
   
   </div>
   
   
   
   
   <small><i>Code Review Run #ad12bb</i></small>
   </div>
   
   ---
   Should Bito avoid suggestions like this for future reviews? (<a 
href=https://alpha.bito.ai/home/ai-agents/review-rules>Manage Rules</a>)
   - [ ] Yes, avoid them



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