some reformattings

added badges
This commit is contained in:
2020-06-09 23:22:43 +02:00
parent 83823dceab
commit bb18a62a3d
14 changed files with 53 additions and 11 deletions

19
src/elements/Tag/Tag.css Normal file
View File

@ -0,0 +1,19 @@
.tagbtn {
color: white;
margin: 10px;
background-color: #3574fe;
border: none;
border-radius: 10px;
padding: 5px 15px 5px 15px;
/*font-weight: bold;*/
display: block;
}
.tagbtn:focus {
background-color: #004eff;
outline: none;
}
.tagbtn:hover {
background-color: #004eff;
}

21
src/elements/Tag/Tag.js Normal file
View File

@ -0,0 +1,21 @@
import React from "react";
import "./Tag.css"
class Tag extends React.Component {
constructor(props, context) {
super(props, context);
this.props = props;
}
render() {
// todo onclick events correctlyy
return (
<button className='tagbtn' onClick={this.props.onClick} data-testid="Test-Tag">{this.props.children}</button>
);
}
}
export default Tag;

View File

@ -0,0 +1,19 @@
import React from "react";
import ReactDom from 'react-dom'
import Tag from './Tag'
import {render} from '@testing-library/react'
import "@testing-library/jest-dom"
describe('<Tag/>', function () {
it('renders without crashing ', function () {
const div = document.createElement("div");
ReactDom.render(<Tag/>,div);
ReactDom.unmountComponentAtNode(div);
});
it('renders childs correctly', function () {
const {getByTestId} = render(<Tag>test</Tag>);
expect(getByTestId("Test-Tag")).toHaveTextContent("test");
});
});