-
-
Notifications
You must be signed in to change notification settings - Fork 278
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(frontend): more frontend test fixes, fix mistakes in merge - task…
…Selection
- Loading branch information
Showing
17 changed files
with
130 additions
and
131 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1 change: 0 additions & 1 deletion
1
frontend/src/components/notifications/tests/actionButtons.test.jsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
60 changes: 0 additions & 60 deletions
60
frontend/src/components/projectCard/tests/projectProgressBar.test.js
This file was deleted.
Oops, something went wrong.
60 changes: 60 additions & 0 deletions
60
frontend/src/components/projectCard/tests/projectProgressBar.test.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
import ProjectProgressBar from '../projectProgressBar'; | ||
import { createComponentWithIntl, IntlProviders } from '../../../utils/testWithIntl'; | ||
import { render, screen } from '@testing-library/react'; | ||
|
||
describe('test if projectProgressBar', () => { | ||
const setup = () => render( | ||
<IntlProviders> | ||
<ProjectProgressBar className="pb2" percentMapped={40} percentValidated={25} /> | ||
</IntlProviders> | ||
); | ||
it('mapped bar has the correct width', async () => { | ||
const { container } = setup(); | ||
const element = container.querySelector('.absolute.bg-blue-grey.br-pill.hhalf.hide-child') as HTMLDivElement; | ||
expect(element).toBeInTheDocument(); | ||
expect(element.style.width).toBe('40%'); | ||
}); | ||
it('validated bar has the correct width', () => { | ||
const { container } = setup(); | ||
const element = container.querySelector('.absolute.bg-red.br-pill.hhalf.hide-child') as HTMLDivElement; | ||
expect(element).toBeInTheDocument(); | ||
expect(element.style.width).toBe('25%'); | ||
}); | ||
it('has a div with the complete background bar', () => { | ||
const { container } = setup(); | ||
const element = container.querySelector('.bg-tan.br-pill.hhalf.overflow-y-hidden') as HTMLDivElement; | ||
expect(element).toBeInTheDocument(); | ||
}); | ||
it('the first div has the correct classes', () => { | ||
const { container } = setup(); | ||
const element = container.querySelector('.cf.db.pb2') as HTMLDivElement; | ||
expect(element).toBeInTheDocument(); | ||
expect(element.className).toBe('cf db pb2'); | ||
}); | ||
it('tooltip is not present because it is not hovered', async () => { | ||
const { container } = setup(); | ||
const element = container.querySelector(".db.absolute.top-1.z-1.dib.bg-blue-dark.ba.br2.b--blue-dark.pa2.shadow-5") as HTMLDivElement; | ||
expect(element).not.toBeInTheDocument(); | ||
expect(container.getElementsByTagName("span").length).toBe(0); | ||
}); | ||
}); | ||
|
||
describe('test if projectProgressBar with value higher than 100%', () => { | ||
const setup = () => render( | ||
<IntlProviders> | ||
<ProjectProgressBar className="pb2" percentMapped={140} percentValidated={125} />, | ||
</IntlProviders> | ||
); | ||
it('to mapped returns 100% width', () => { | ||
const { container } = setup(); | ||
const element = container.querySelector('.absolute.bg-blue-grey.br-pill.hhalf.hide-child') as HTMLDivElement; | ||
expect(element).toBeInTheDocument(); | ||
expect(element.style.width).toBe('100%'); | ||
}); | ||
it('to validated returns 100% width', () => { | ||
const { container } = setup(); | ||
const element = container.querySelector('.absolute.bg-red.br-pill.hhalf.hide-child') as HTMLDivElement; | ||
expect(element).toBeInTheDocument(); | ||
expect(element.style.width).toBe('100%'); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.