Brijesh619 commented on code in PR #728:
URL: https://github.com/apache/atlas/pull/728#discussion_r3967025402
##########
dashboard/src/views/DashboardOverview/__tests__/LatestEntitiesList.test.tsx:
##########
@@ -624,4 +622,89 @@ describe('LatestEntitiesList', () => {
)
expect(screen.getByText('Created today')).toBeInTheDocument()
})
+
+ it('renders fallback Typography when detailHref is absent (no guid)',
() => {
Review Comment:
I've consolidated those overlapping tests! The renders span without link
when guid missing test block now includes the more comprehensive tagName and
className assertions from the other test, which I've deleted. I also ran the
tests to make sure everything's still green.
Let me know if there are any other PR comments you want me to address!
##########
dashboard/src/components/__tests__/muiComponents.test.tsx:
##########
@@ -69,6 +70,100 @@ describe('muiComponents', () => {
expect(screen.getByText('Tooltip Child')).toBeTruthy()
})
+ describe('OverflowTooltip', () => {
+ let triggerResize: ResizeObserverCallback | undefined
+ const originalResizeObserver = global.ResizeObserver
+
+ beforeAll(() => {
+ global.ResizeObserver = class {
+ constructor(callback: ResizeObserverCallback) {
+ triggerResize = callback
+ }
+ observe = jest.fn()
+ unobserve = jest.fn()
+ disconnect = jest.fn()
+ } as any
Review Comment:
I've removed the as any type assertion in the mock ResizeObserver
implementation in dashboard/src/components/__tests__/muiComponents.test.tsx and
replaced it with as unknown as typeof ResizeObserver to maintain type-safety
goals. I've also run the tests locally to ensure they still pass successfully!
##########
dashboard/src/views/DashboardOverview/LatestEntitiesList.scss:
##########
@@ -0,0 +1,113 @@
+/*
+ * 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.
+ */
+
+.latest-entities-paper {
Review Comment:
've updated dashboard/src/views/DashboardOverview/LatestEntitiesList.scss to
use a 4-space indent instead of a 2-space indent, bringing it in line with the
rest of the existing SCSS like AuditResults.scss. The file has been
successfully reformatted.
##########
dashboard/src/views/DashboardOverview/__tests__/LatestEntitiesList.test.tsx:
##########
@@ -624,4 +622,68 @@ describe('LatestEntitiesList', () => {
)
expect(screen.getByText('Created today')).toBeInTheDocument()
})
+
+ it('renders fallback Typography when detailHref is absent (no guid)',
() => {
+ render(
+ <MemoryRouter>
+ <LatestEntitiesList
+ entities={[
+ {
+ name:
'EntityWithoutGuid',
+ typeName: 'T',
+ attributes: {
__timestamp: Date.now() },
+ },
+ ]}
+ />
+ </MemoryRouter>,
+ )
+ const fallbackText = screen.getByText('EntityWithoutGuid')
+ expect(fallbackText).toBeInTheDocument()
+ expect(fallbackText.tagName).toBe('SPAN')
+
expect(fallbackText).toHaveClass('latest-entities-entity-name-fallback')
+ })
+
+
+ it('renders extremely long entity name without crashing', () => {
+ const longName = 'A'.repeat(500)
+ render(
+ <MemoryRouter>
+ <LatestEntitiesList
+ entities={[
+ {
+ guid: 'g1',
+ name: longName,
+ typeName: 'T',
+ attributes: {
__timestamp: Date.now() },
+ },
+ ]}
+ />
+ </MemoryRouter>,
+ )
+ const link = screen.getByRole('link', { name: longName })
+ expect(link).toBeInTheDocument()
+ expect(link.textContent).toBe(longName)
+
+ const span = link.parentElement
+ expect(span).toHaveStyle('overflow: hidden')
+ expect(span).toHaveStyle('text-overflow: ellipsis')
+ expect(span).toHaveStyle('white-space: nowrap')
+ })
+
Review Comment:
I've updated the test case in LatestEntitiesList.test.tsx to verify that the
extreme length typeName rendering also applies the correct truncation styles to
the wrapper element without breaking the layout.
The test now properly asserts the existence of the overflow, text-overflow,
and white-space CSS rules on the type wrapper. I've also run the tests locally
to make sure it passes successfully!
--
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]