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

Add tests for severitylevelsgroup, radio and task trend #1413

Merged
merged 5 commits into from
May 20, 2019
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
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
## [8.0.1] - (unreleased)

### Added
- Add tests for severitylevelsgroup, radio button and task trend [#1413](https://github.com/greenbone/gsa/pull/1413)
- Allow to show error details [#1403](https://github.com/greenbone/gsa/pull/1403)
- Add test for solution type group [#1402](https://github.com/greenbone/gsa/pull/1402)
- Add tests for loginpage and structure components [#1390](https://github.com/greenbone/gsa/pull/1390)
Expand Down
113 changes: 113 additions & 0 deletions gsa/src/web/components/form/__tests__/__snapshots__/radio.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -106,3 +106,116 @@ exports[`Radio tests should render radio 1`] = `
</div>
</label>
`;

exports[`Radio tests should render radio with children 1`] = `
.c2 {
display: -webkit-box;
display: -webkit-flex;
display: -ms-flexbox;
display: flex;
-webkit-flex-direction: row;
-ms-flex-direction: row;
flex-direction: row;
-webkit-box-pack: start;
-webkit-justify-content: start;
-ms-flex-pack: start;
justify-content: start;
-webkit-align-items: center;
-webkit-box-align: center;
-ms-flex-align: center;
align-items: center;
}

.c3 {
margin-left: -5px;
}

.c3 > * {
display: -webkit-inline-box;
display: -webkit-inline-flex;
display: -ms-inline-flexbox;
display: inline-flex;
}

.c3 > * {
margin-left: 5px;
}

.c1 {
display: -webkit-inline-box;
display: -webkit-inline-flex;
display: -ms-inline-flexbox;
display: inline-flex;
}

.c0 {
display: -webkit-inline-box;
display: -webkit-inline-flex;
display: -ms-inline-flexbox;
display: inline-flex;
-webkit-flex-direction: row;
-ms-flex-direction: row;
flex-direction: row;
-webkit-align-items: center;
-webkit-box-align: center;
-ms-flex-align: center;
align-items: center;
font-weight: normal;
cursor: pointer;
}

.c5 {
font-family: inherit;
font-size: inherit;
padding: 0;
margin: 0;
margin-left: 10px;
line-height: normal;
width: auto;
height: auto;
}

.c4 {
display: -webkit-box;
display: -webkit-flex;
display: -ms-flexbox;
display: flex;
-webkit-flex-direction: row;
-ms-flex-direction: row;
flex-direction: row;
-webkit-box-pack: start;
-webkit-justify-content: flex-start;
-ms-flex-pack: start;
justify-content: flex-start;
-webkit-align-items: center;
-webkit-box-align: center;
-ms-flex-align: center;
align-items: center;
}

<label
class="c0"
>
<div
class="c1 c2"
>
<div
class="c3 c2"
margin="5px"
>
<input
class="c4 c5"
data-testid="radio-input"
type="radio"
value=""
/>
<span>
child1
</span>
<span>
child2
</span>
</div>
</div>
</label>
`;
10 changes: 10 additions & 0 deletions gsa/src/web/components/form/__tests__/radio.js
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,16 @@ describe('Radio tests', () => {
expect(element).toMatchSnapshot();
});

test('should render radio with children', () => {
const {element} = render(
<Radio>
<span>child1</span>
<span>child2</span>
</Radio>,
);
expect(element).toMatchSnapshot();
});

test('should call change handler', () => {
const onChange = jest.fn();

Expand Down
Loading