Skip to content

Commit

Permalink
fix: no dashboard-item-content class anymore
Browse files Browse the repository at this point in the history
  • Loading branch information
jenniferarnesen committed Jan 17, 2025
1 parent 9d06b4d commit 6c615f0
Show file tree
Hide file tree
Showing 3 changed files with 64 additions and 14 deletions.
11 changes: 5 additions & 6 deletions src/components/Item/AppItem/Item.js
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ const AppItem = ({

if (node.classList.contains(itemHeaderClasses.itemHeaderWrap)) {
headerRef.current = node
} else if (node.classList.contains('dashboard-item-content')) {
} else if (node.classList.contains('content')) {
contentRef.current = node
}

Expand Down Expand Up @@ -141,10 +141,6 @@ const AppItem = ({
<iframe
title={appDetails.name}
src={iframeSrc}
className={cx(styles.content, {
[styles.hiddenTitle]: hideTitle,
[styles.fullscreen]: isFullscreen,
})}
style={{
border: 'none',
width: style.width,
Expand Down Expand Up @@ -193,7 +189,10 @@ const AppItem = ({
onFatalError={onFatalError}
>
<div
className="dashboard-item-content"
className={cx(styles.content, {
[styles.hiddenTitle]: hideTitle,
[styles.fullscreen]: isFullscreen,
})}
ref={onElementMount}
>
{isMounted && renderPlugin(iframeSrc)}
Expand Down
23 changes: 23 additions & 0 deletions src/components/Item/AppItem/__tests__/Item.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,10 @@ jest.mock(
}
)

jest.mock('../ItemContextMenu.js', () => ({
ItemContextMenu: () => <div className="ItemContextMenu" />,
}))

const mockStore = configureMockStore()

const item = {
Expand Down Expand Up @@ -204,6 +208,25 @@ test('renders a valid legacy widget item', () => {
expect(container).toMatchSnapshot()
})

test('renders a valid legacy widget item when in slideshow', () => {
const store = {
itemFilters: {},
editDashboard: {},
selected: { id: 'some-dashboard' },
slideshow: 1,
}
const { container } = render(
<Provider store={mockStore(store)}>
<SystemSettingsProvider>
<WindowDimensionsProvider>
<Item item={itemLegacyWidget} dashboardMode={'view'} />
</WindowDimensionsProvider>
</SystemSettingsProvider>
</Provider>
)
expect(container).toMatchSnapshot()
})

test('renders an invalid App item', () => {
const store = {
itemFilters: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,15 @@ exports[`renders a valid App item in view mode 1`] = `
>
<div
class="itemActionsWrap"
/>
>
<div
class="ItemContextMenu"
/>
</div>
</div>
</div>
<div
class="dashboard-item-content"
class="content"
/>
</div>
`;
Expand Down Expand Up @@ -47,7 +51,7 @@ exports[`renders a valid App item with filter in edit mode 1`] = `
</div>
</div>
<div
class="dashboard-item-content"
class="content"
/>
</div>
`;
Expand All @@ -67,11 +71,15 @@ exports[`renders a valid App item with filter in view mode 1`] = `
>
<div
class="itemActionsWrap"
/>
>
<div
class="ItemContextMenu"
/>
</div>
</div>
</div>
<div
class="dashboard-item-content"
class="content"
/>
</div>
`;
Expand Down Expand Up @@ -99,7 +107,7 @@ exports[`renders a valid App item with title in edit mode irrespective of app se
</div>
</div>
<div
class="dashboard-item-content"
class="content"
/>
</div>
`;
Expand All @@ -117,7 +125,7 @@ exports[`renders a valid App item without title in view mode if specified in app
/>
</div>
<div
class="dashboard-item-content"
class="content hiddenTitle"
/>
</div>
`;
Expand All @@ -137,7 +145,27 @@ exports[`renders a valid legacy widget item 1`] = `
/>
</div>
<div
class="dashboard-item-content"
class="content"
/>
</div>
`;

exports[`renders a valid legacy widget item when in slideshow 1`] = `
<div>
<div
class="itemHeaderWrap"
>
<p
class="itemTitle"
>
Scorecard
</p>
<div
class="itemHeaderRightWrap"
/>
</div>
<div
class="content"
/>
</div>
`;
Expand Down

0 comments on commit 6c615f0

Please sign in to comment.