feat(positions): do not show liquidation price if position openVolume is 0 (#5990)

This commit is contained in:
Bartłomiej Głownia 2024-03-13 16:31:38 +01:00 committed by GitHub
parent 7620f0b67d
commit 475b52bcaf
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 11 additions and 2 deletions

View File

@ -102,7 +102,7 @@ describe('Positions', () => {
expect(cell.getByTestId('stack-cell-secondary')).toHaveTextContent('12.3');
});
it('doesnt render entry / mark if market is in opening auction', async () => {
it('does not render entry / mark if market is in opening auction', async () => {
await renderComponent({
...singleRow,
marketTradingMode: Schema.MarketTradingMode.TRADING_MODE_OPENING_AUCTION,
@ -118,6 +118,15 @@ describe('Positions', () => {
expect(cells[4].textContent).toEqual('liquidation price');
});
it('do not displays liquidation price if openVolume is 0', async () => {
await renderComponent({
...singleRow,
openVolume: '0',
});
const cells = screen.getAllByRole('gridcell');
expect(cells[4].textContent).toEqual('-');
});
it('displays margin and leverage', async () => {
await renderComponent(singleRow);
const cells = screen.getAllByRole('gridcell');

View File

@ -400,7 +400,7 @@ export const PositionsTable = ({
sortable: false,
filter: false,
cellRenderer: ({ data }: VegaICellRendererParams<Position>) => {
if (!data) {
if (!data || data.openVolume === '0') {
return '-';
}
return (