Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

resolve open bounties background disappear on hover issue #118

Merged
Show file tree
Hide file tree
Changes from all commits
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
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}`}
MahtabBukhari marked this conversation as resolved.
Show resolved Hide resolved
>
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")'
});
});
});
Loading