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


##########
superset-frontend/src/components/Accessibility/VisuallyHidden.test.tsx:
##########
@@ -0,0 +1,54 @@
+/**
+ * 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.
+ */
+import { render, screen } from 'spec/helpers/testing-library';
+import VisuallyHidden from './VisuallyHidden';
+
+test('renders children', () => {
+  render(<VisuallyHidden>Screen-reader only text</VisuallyHidden>);
+  expect(screen.getByText('Screen-reader only text')).toBeInTheDocument();
+});
+
+test('renders as span by default', () => {
+  render(<VisuallyHidden>Default tag</VisuallyHidden>);
+  const el = screen.getByText('Default tag');
+  expect(el.tagName).toBe('SPAN');
+});
+
+test('renders as a custom element when as prop is provided', () => {
+  render(<VisuallyHidden as="h1">Page heading</VisuallyHidden>);
+  const el = screen.getByText('Page heading');
+  expect(el.tagName).toBe('H1');
+});
+
+test('forwards id and className props', () => {
+  render(
+    <VisuallyHidden id="my-id" className="my-class">
+      Text
+    </VisuallyHidden>,
+  );
+  const el = screen.getByText('Text');
+  expect(el).toHaveAttribute('id', 'my-id');
+  expect(el).toHaveClass('my-class');
+});
+
+test('applies clip-rect style for screen-reader-only behavior', () => {
+  render(<VisuallyHidden>Hidden</VisuallyHidden>);
+  const el = screen.getByText('Hidden');
+  expect(el).toHaveStyle({ position: 'absolute' });

Review Comment:
   <div>
   
   
   <div id="suggestion">
   <div id="issue"><b>Test assertion mismatch</b></div>
   <div id="fix">
   
   The test 'applies clip-rect style for screen-reader-only behavior' claims to 
verify clip-rect application but only asserts position: 'absolute'. The 
VisuallyHidden component uses clip: rect(0, 0, 0, 0) as the primary mechanism 
for visual hiding while maintaining accessibility. Update the assertion to 
check clip to match the test's intent and prevent potential regressions.
   </div>
   
   
   <details>
   <summary>
   <b>Code suggestion</b>
   </summary>
   <blockquote>Check the AI-generated fix before applying</blockquote>
   <div id="code">
   
   
   ````suggestion
       expect(el).toHaveStyle({ clip: 'rect(0, 0, 0, 0)' });
   ````
   
   </div>
   </details>
   
   
   
   </div>
   
   
   
   
   <small><i>Code Review Run #a27561</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