Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
chore: updated tests
  • Loading branch information
juanmigdr committed Dec 12, 2025
commit 828c4c5619d59777f91802933dd79c1ec81735d7
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ exports[`NftGrid matches the snapshot 1`] = `
style="margin: 16px;"
>
<div
class="mm-box nft-items__wrapper mm-box--display-grid mm-box--gap-4"
class="relative w-full"
style="height: 200px;"
/>
</div>
</DocumentFragment>
Expand Down
15 changes: 15 additions & 0 deletions ui/components/app/assets/nfts/nft-grid/nft-grid.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,21 @@ jest.mock('../../../../../selectors', () => ({
getNftIsStillFetchingIndication: jest.fn(),
}));

// Mock window.matchMedia
Object.defineProperty(window, 'matchMedia', {
writable: true,
value: jest.fn().mockImplementation((query) => ({
matches: false,
media: query,
onchange: null,
addListener: jest.fn(), // Deprecated
removeListener: jest.fn(), // Deprecated
addEventListener: jest.fn(),
removeEventListener: jest.fn(),
dispatchEvent: jest.fn(),
})),
});

describe('NftGrid', () => {
const mockStore = configureStore([]);

Expand Down
8 changes: 2 additions & 6 deletions ui/components/app/assets/nfts/nft-grid/nft-grid.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -128,10 +128,9 @@ export default function NftGrid({
return (
<Box style={{ margin: 16 }}>
<div
className="relative w-full"
style={{
height: `${virtualizer.getTotalSize()}px`,
width: '100%',
position: 'relative',
}}
>
{virtualizer.getVirtualItems().map((virtualRow) => {
Expand All @@ -141,11 +140,8 @@ export default function NftGrid({
key={virtualRow.index}
data-index={virtualRow.index}
ref={virtualizer.measureElement}
className="absolute top-0 left-0 w-full"
style={{
position: 'absolute',
top: 0,
left: 0,
width: '100%',
transform: `translateY(${virtualRow.start}px)`,
paddingBottom: '16px',
}}
Expand Down
Loading