Skip to content

Commit

Permalink
Merge pull request #118 from MahtabBukhari/resolve-open-bouties-hover…
Browse files Browse the repository at this point in the history
…-affect-issue

resolve open bounties background disappear on hover issue
  • Loading branch information
kevkevinpal authored Feb 1, 2024
2 parents 763c408 + 4eedc60 commit a6f748f
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 7 deletions.
2 changes: 1 addition & 1 deletion public/static/unassigned_bounty_hover_bg.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
10 changes: 5 additions & 5 deletions src/people/utils/AssignedUnassignedBounties.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -63,13 +63,10 @@ const DescriptionPriceContainer = styled.div<containerProps>`
background-size: cover;
:hover {
background: url('static/unassigned_bounty_hover_bg.svg');
background: url('/static/unassigned_bounty_hover_bg.svg');
background-repeat: no-repeat;
background-size: cover;
}
:active {
background: url('static/unassigned_bounty_active_bg.svg');
}
`;

const UnassignedPersonProfile = styled.div<containerProps>`
Expand Down Expand Up @@ -204,7 +201,10 @@ const Bounties = (props: BountiesProps) => {
</BountyLink>
) : (
<BountyContainer color={color}>
<DescriptionPriceContainer unAssignedBackgroundImage='url("/static/unassigned_bounty_bg.svg")'>
<DescriptionPriceContainer
data-testid="description-price-container"
unAssignedBackgroundImage={'url("/static/unassigned_bounty_bg.svg")'}
>
<BountyLink
to={props.org_uuid ? `/bounty/${props.id}/${props.org_uuid}` : `/bounty/${props.id}`}
>
Expand Down
36 changes: 35 additions & 1 deletion src/people/utils/__test__/AssignedUnassignedBounties.spec.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import '@testing-library/jest-dom';
import { Router } from 'react-router-dom';
import { queryByText, render, screen } from '@testing-library/react';
import { render, screen, fireEvent } from '@testing-library/react';
import nock from 'nock';
import React from 'react';
import { setupStore } from '../../../__test__/__mockData__/setupStore';
Expand Down Expand Up @@ -32,6 +32,7 @@ beforeEach(() => {
*/
describe('Bounties Component', () => {
nock(user.url).get('/person/id/1').reply(200, {});

test('display bounty', () => {
const bountyProps = {
assignee: person,
Expand All @@ -55,4 +56,37 @@ describe('Bounties Component', () => {
);
expect(screen.queryByText(bountyProps.title)).toBeInTheDocument();
});

test('display bounty with hover effect on DescriptionPriceContainer', async () => {
const bountyProps = {
assignee: undefined,
price: 0,
sessionLength: '',
priceMin: 0,
priceMax: 0,
codingLanguage: [],
title: 'test_title',
person: person,
onPanelClick: () => {},
widget: {},
created: 0,
isPaid: false
};

render(
<Router history={history}>
<Bounties {...bountyProps} />
</Router>
);

const descriptionPriceContainer = screen.getByTestId('description-price-container');

expect(descriptionPriceContainer).toBeInTheDocument();

fireEvent.mouseEnter(descriptionPriceContainer);

expect(descriptionPriceContainer).toHaveStyle({
background: 'url("/static/unassigned_bounty_hover_bg.svg")'
});
});
});

0 comments on commit a6f748f

Please sign in to comment.