mirror of
https://github.com/pgadmin-org/pgadmin4.git
synced 2024-11-22 08:46:39 -06:00
45 lines
1.2 KiB
JavaScript
45 lines
1.2 KiB
JavaScript
/////////////////////////////////////////////////////////////
|
|
//
|
|
// pgAdmin 4 - PostgreSQL Tools
|
|
//
|
|
// Copyright (C) 2013 - 2024, The pgAdmin Development Team
|
|
// This software is released under the PostgreSQL Licence
|
|
//
|
|
//////////////////////////////////////////////////////////////
|
|
|
|
|
|
import React from 'react';
|
|
|
|
import { render } from '@testing-library/react';
|
|
import Theme from '../../../pgadmin/static/js/Theme';
|
|
import { ItemView } from '../../../pgadmin/misc/file_manager/static/js/components/GridView';
|
|
import userEvent from '@testing-library/user-event';
|
|
|
|
describe('GridView', ()=>{
|
|
|
|
|
|
describe('ItemView', ()=>{
|
|
let row = {'Filename': 'test.sql', 'Size': '1KB', 'file_type': 'dir'},
|
|
ctrlMount = (props)=>{
|
|
return render(<Theme>
|
|
<ItemView
|
|
idx={0}
|
|
selected={false}
|
|
row={row}
|
|
{...props}
|
|
/>
|
|
</Theme>);
|
|
};
|
|
|
|
it('keydown Escape', async ()=>{
|
|
const onEditComplete = jest.fn();
|
|
ctrlMount({
|
|
onEditComplete: onEditComplete,
|
|
});
|
|
const user = userEvent.setup();
|
|
await user.keyboard('{Escape}');
|
|
expect(onEditComplete).toHaveBeenCalled();
|
|
});
|
|
});
|
|
});
|