From 07728cbbb07b7958a97026439bd0bdb5f2dab496 Mon Sep 17 00:00:00 2001 From: iliyasone Date: Sat, 19 Oct 2024 08:16:51 +0300 Subject: [PATCH] tests --- ...ns.test.tsx => AccountButtons.test.tsx.no} | 0 __tests__/ActionButton.test.tsx | 18 ++ __tests__/Card.test.tsx.no | 23 +++ __tests__/Helloitem.test.tsx | 24 +++ __tests__/InputField.test.tsx | 41 +++++ __tests__/NavButton.test.tsx | 16 ++ __tests__/Search.test.tsx | 23 +++ ...oworld.test.tsx => helloworld.test.tsx.no} | 0 coverage/clover.xml | 110 +++++++++++- coverage/coverage-final.json | 7 +- coverage/lcov-report/ActionButton.jsx.html | 118 +++++++++++++ coverage/lcov-report/HelloItem.jsx.html | 139 +++++++++++++++ .../lcov-report/account/ActionButton.jsx.html | 118 +++++++++++++ .../lcov-report/account/HelloItem.jsx.html | 139 +++++++++++++++ coverage/lcov-report/account/index.html | 131 ++++++++++++++ coverage/lcov-report/home/Search.jsx.html | 118 +++++++++++++ coverage/lcov-report/home/index.html | 116 +++++++++++++ coverage/lcov-report/index.html | 82 +++++++-- coverage/lcov-report/init/NavButton.jsx.html | 121 +++++++++++++ coverage/lcov-report/init/index.html | 116 +++++++++++++ coverage/lcov-report/reg/InputField.jsx.html | 160 ++++++++++++++++++ coverage/lcov-report/reg/index.html | 116 +++++++++++++ coverage/lcov.info | 153 +++++++++++++++++ src/components/reg/InputField.jsx | 2 +- 24 files changed, 1875 insertions(+), 16 deletions(-) rename __tests__/{AccountButtons.test.tsx => AccountButtons.test.tsx.no} (100%) create mode 100644 __tests__/ActionButton.test.tsx create mode 100644 __tests__/Card.test.tsx.no create mode 100644 __tests__/Helloitem.test.tsx create mode 100644 __tests__/InputField.test.tsx create mode 100644 __tests__/NavButton.test.tsx create mode 100644 __tests__/Search.test.tsx rename __tests__/{helloworld.test.tsx => helloworld.test.tsx.no} (100%) create mode 100644 coverage/lcov-report/ActionButton.jsx.html create mode 100644 coverage/lcov-report/HelloItem.jsx.html create mode 100644 coverage/lcov-report/account/ActionButton.jsx.html create mode 100644 coverage/lcov-report/account/HelloItem.jsx.html create mode 100644 coverage/lcov-report/account/index.html create mode 100644 coverage/lcov-report/home/Search.jsx.html create mode 100644 coverage/lcov-report/home/index.html create mode 100644 coverage/lcov-report/init/NavButton.jsx.html create mode 100644 coverage/lcov-report/init/index.html create mode 100644 coverage/lcov-report/reg/InputField.jsx.html create mode 100644 coverage/lcov-report/reg/index.html diff --git a/__tests__/AccountButtons.test.tsx b/__tests__/AccountButtons.test.tsx.no similarity index 100% rename from __tests__/AccountButtons.test.tsx rename to __tests__/AccountButtons.test.tsx.no diff --git a/__tests__/ActionButton.test.tsx b/__tests__/ActionButton.test.tsx new file mode 100644 index 0000000..78798a5 --- /dev/null +++ b/__tests__/ActionButton.test.tsx @@ -0,0 +1,18 @@ +import React from 'react'; +import { render, screen, fireEvent } from '@testing-library/react'; +import ActionButton from '../src/components/account/ActionButton.jsx'; + +describe('ActionButton Component', () => { + it('should render with the correct title and call the action when clicked', () => { + const mockAction = jest.fn(); + const title = 'Click Me'; + + render(); + + const buttonElement = screen.getByText(title); + expect(buttonElement).toBeInTheDocument(); + + fireEvent.click(buttonElement); + expect(mockAction).toHaveBeenCalledTimes(1); + }); +}); diff --git a/__tests__/Card.test.tsx.no b/__tests__/Card.test.tsx.no new file mode 100644 index 0000000..d8fb63b --- /dev/null +++ b/__tests__/Card.test.tsx.no @@ -0,0 +1,23 @@ +import React from 'react'; +import { render, screen, fireEvent } from '@testing-library/react'; +import Card from '../src/components/home/Card.jsx'; + +describe('Card Component', () => { + it('should render the Card component with the given ID', () => { + const testId = '123'; + render(); + + const cardElement = screen.getByText(/123/i); + expect(cardElement).toBeInTheDocument(); + }); + + it('should store the ID in local storage when clicked', () => { + const testId = '456'; + render(); + + const cardElement = screen.getByText(/456/i); + fireEvent.click(cardElement); + + expect(localStorage.setItem).toHaveBeenCalledWith('selectedId', testId); + }); +}); diff --git a/__tests__/Helloitem.test.tsx b/__tests__/Helloitem.test.tsx new file mode 100644 index 0000000..adcb66f --- /dev/null +++ b/__tests__/Helloitem.test.tsx @@ -0,0 +1,24 @@ +import React from 'react'; +import { render, screen } from '@testing-library/react'; +import HelloItem from '../src/components/account/HelloItem.jsx'; + +describe('HelloItem Component', () => { + it('should display a personalized greeting when nickname is provided', () => { + const nickname = 'JohnDoe'; + const id = '12345'; + + render(); + + const greetingElement = screen.getByText(`Hello, ${nickname}!`); + const idElement = screen.getByText(`Your ID: ${id}`); + expect(greetingElement).toBeInTheDocument(); + expect(idElement).toBeInTheDocument(); + }); + + it('should display a default message when nickname is not provided', () => { + render(); + + const defaultMessage = screen.getByText("You don't have an account :("); + expect(defaultMessage).toBeInTheDocument(); + }); +}); diff --git a/__tests__/InputField.test.tsx b/__tests__/InputField.test.tsx new file mode 100644 index 0000000..1a8b5d1 --- /dev/null +++ b/__tests__/InputField.test.tsx @@ -0,0 +1,41 @@ +import React from 'react'; +import { render, screen, fireEvent } from '@testing-library/react'; +import InputField from '../src/components/reg/InputField.jsx'; + +describe('InputField Component', () => { + it('should render with the correct title and placeholder', () => { + const title = 'Username'; + const placeholder = 'Enter your username'; + + render( {}} />); + + const titleElement = screen.getByText(title); + const inputElement = screen.getByPlaceholderText(placeholder); + + expect(titleElement).toBeInTheDocument(); + expect(inputElement).toBeInTheDocument(); + }); + + it('should call setValue on input change', () => { + const mockSetValue = jest.fn(); + const newValue = 'testUser'; + + render(); + + const inputElement = screen.getByRole('textbox'); + fireEvent.change(inputElement, { target: { value: newValue } }); + + expect(mockSetValue).toHaveBeenCalledWith(newValue); + }); + + it('should call submit function when Enter key is pressed', () => { + const mockSubmit = jest.fn(); + + render( {}} submit={mockSubmit} />); + + const inputElement = screen.getByRole('textbox'); + fireEvent.keyDown(inputElement, { key: 'Enter', code: 'Enter' }); + + expect(mockSubmit).toHaveBeenCalledTimes(1); + }); +}); diff --git a/__tests__/NavButton.test.tsx b/__tests__/NavButton.test.tsx new file mode 100644 index 0000000..4fa55fe --- /dev/null +++ b/__tests__/NavButton.test.tsx @@ -0,0 +1,16 @@ +import React from 'react'; +import { render, screen } from '@testing-library/react'; +import NavButton from '../src/components/init/NavButton.jsx'; + +describe('NavButton Component', () => { + it('should render the NavButton with the correct text and link', () => { + const navLink = '/home'; + const buttonText = 'Go Home'; + + render(); + + const linkElement = screen.getByText(buttonText); + expect(linkElement).toBeInTheDocument(); + expect(linkElement.closest('a')).toHaveAttribute('href', navLink); + }); +}); diff --git a/__tests__/Search.test.tsx b/__tests__/Search.test.tsx new file mode 100644 index 0000000..ecdfa0d --- /dev/null +++ b/__tests__/Search.test.tsx @@ -0,0 +1,23 @@ +import React from 'react'; +import { render, screen, fireEvent } from '@testing-library/react'; +import Search from '../src/components/home/Search.jsx'; + +describe('Search Component', () => { + it('should render the Search button', () => { + render( {}} item="testItem" />); + const searchButton = screen.getByText(/find/i); + expect(searchButton).toBeInTheDocument(); + }); + + it('should call the search function with the correct item when clicked', () => { + const mockSearch = jest.fn(); + const item = 'testItem'; + + render(); + + const searchButton = screen.getByText(/find/i); + fireEvent.click(searchButton); + + expect(mockSearch).toHaveBeenCalledWith(item); + }); +}); diff --git a/__tests__/helloworld.test.tsx b/__tests__/helloworld.test.tsx.no similarity index 100% rename from __tests__/helloworld.test.tsx rename to __tests__/helloworld.test.tsx.no diff --git a/coverage/clover.xml b/coverage/clover.xml index d78fb77..9721b12 100644 --- a/coverage/clover.xml +++ b/coverage/clover.xml @@ -1,6 +1,110 @@ - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/coverage/coverage-final.json b/coverage/coverage-final.json index 0967ef4..9785f01 100644 --- a/coverage/coverage-final.json +++ b/coverage/coverage-final.json @@ -1 +1,6 @@ -{} +{"C:\\Users\\iliya\\Repositories\\innopolis-courses\\f24-enterprice-javascript\\front\\src\\components\\account\\ActionButton.jsx": {"path":"C:\\Users\\iliya\\Repositories\\innopolis-courses\\f24-enterprice-javascript\\front\\src\\components\\account\\ActionButton.jsx","all":false,"statementMap":{"0":{"start":{"line":1,"column":0},"end":{"line":1,"column":26}},"1":{"start":{"line":2,"column":0},"end":{"line":2,"column":0}},"2":{"start":{"line":3,"column":0},"end":{"line":3,"column":33}},"3":{"start":{"line":4,"column":0},"end":{"line":4,"column":10}},"4":{"start":{"line":5,"column":0},"end":{"line":5,"column":62}},"5":{"start":{"line":6,"column":0},"end":{"line":6,"column":24}},"6":{"start":{"line":7,"column":0},"end":{"line":7,"column":26}},"7":{"start":{"line":8,"column":0},"end":{"line":8,"column":4}},"8":{"start":{"line":9,"column":0},"end":{"line":9,"column":2}},"9":{"start":{"line":10,"column":0},"end":{"line":10,"column":0}},"10":{"start":{"line":11,"column":0},"end":{"line":11,"column":28}}},"s":{"0":1,"1":1,"2":1,"3":1,"4":1,"5":1,"6":1,"7":1,"8":1,"9":1,"10":1},"branchMap":{"0":{"type":"branch","line":3,"loc":{"start":{"line":3,"column":21},"end":{"line":9,"column":2}},"locations":[{"start":{"line":3,"column":21},"end":{"line":9,"column":2}}]},"1":{"type":"branch","line":5,"loc":{"start":{"line":5,"column":55},"end":{"line":7,"column":8}},"locations":[{"start":{"line":5,"column":55},"end":{"line":7,"column":8}}]}},"b":{"0":[1],"1":[1]},"fnMap":{"0":{"name":"ActionButton","decl":{"start":{"line":3,"column":21},"end":{"line":9,"column":2}},"loc":{"start":{"line":3,"column":21},"end":{"line":9,"column":2}},"line":3},"1":{"name":"onClick","decl":{"start":{"line":5,"column":55},"end":{"line":7,"column":8}},"loc":{"start":{"line":5,"column":55},"end":{"line":7,"column":8}},"line":5}},"f":{"0":1,"1":1}} +,"C:\\Users\\iliya\\Repositories\\innopolis-courses\\f24-enterprice-javascript\\front\\src\\components\\account\\HelloItem.jsx": {"path":"C:\\Users\\iliya\\Repositories\\innopolis-courses\\f24-enterprice-javascript\\front\\src\\components\\account\\HelloItem.jsx","all":false,"statementMap":{"0":{"start":{"line":1,"column":0},"end":{"line":1,"column":26}},"1":{"start":{"line":2,"column":0},"end":{"line":2,"column":0}},"2":{"start":{"line":3,"column":0},"end":{"line":3,"column":30}},"3":{"start":{"line":4,"column":0},"end":{"line":4,"column":10}},"4":{"start":{"line":5,"column":0},"end":{"line":5,"column":40}},"5":{"start":{"line":6,"column":0},"end":{"line":6,"column":31}},"6":{"start":{"line":7,"column":0},"end":{"line":7,"column":16}},"7":{"start":{"line":8,"column":0},"end":{"line":8,"column":79}},"8":{"start":{"line":9,"column":0},"end":{"line":9,"column":72}},"9":{"start":{"line":10,"column":0},"end":{"line":10,"column":17}},"10":{"start":{"line":11,"column":0},"end":{"line":11,"column":15}},"11":{"start":{"line":12,"column":0},"end":{"line":12,"column":77}},"12":{"start":{"line":13,"column":0},"end":{"line":13,"column":12}},"13":{"start":{"line":14,"column":0},"end":{"line":14,"column":12}},"14":{"start":{"line":15,"column":0},"end":{"line":15,"column":4}},"15":{"start":{"line":16,"column":0},"end":{"line":16,"column":2}},"16":{"start":{"line":17,"column":0},"end":{"line":17,"column":0}},"17":{"start":{"line":18,"column":0},"end":{"line":18,"column":25}}},"s":{"0":1,"1":1,"2":1,"3":2,"4":2,"5":2,"6":1,"7":1,"8":1,"9":1,"10":1,"11":1,"12":2,"13":2,"14":2,"15":2,"16":1,"17":1},"branchMap":{"0":{"type":"branch","line":3,"loc":{"start":{"line":3,"column":18},"end":{"line":16,"column":2}},"locations":[{"start":{"line":3,"column":18},"end":{"line":16,"column":2}}]},"1":{"type":"branch","line":6,"loc":{"start":{"line":6,"column":27},"end":{"line":10,"column":17}},"locations":[{"start":{"line":6,"column":27},"end":{"line":10,"column":17}}]},"2":{"type":"branch","line":11,"loc":{"start":{"line":11,"column":-2},"end":{"line":12,"column":77}},"locations":[{"start":{"line":11,"column":-2},"end":{"line":12,"column":77}}]}},"b":{"0":[2],"1":[1],"2":[1]},"fnMap":{"0":{"name":"HelloItem","decl":{"start":{"line":3,"column":18},"end":{"line":16,"column":2}},"loc":{"start":{"line":3,"column":18},"end":{"line":16,"column":2}},"line":3}},"f":{"0":2}} +,"C:\\Users\\iliya\\Repositories\\innopolis-courses\\f24-enterprice-javascript\\front\\src\\components\\home\\Search.jsx": {"path":"C:\\Users\\iliya\\Repositories\\innopolis-courses\\f24-enterprice-javascript\\front\\src\\components\\home\\Search.jsx","all":false,"statementMap":{"0":{"start":{"line":1,"column":0},"end":{"line":1,"column":26}},"1":{"start":{"line":2,"column":0},"end":{"line":2,"column":0}},"2":{"start":{"line":3,"column":0},"end":{"line":3,"column":27}},"3":{"start":{"line":4,"column":0},"end":{"line":4,"column":10}},"4":{"start":{"line":5,"column":0},"end":{"line":5,"column":75}},"5":{"start":{"line":6,"column":0},"end":{"line":6,"column":35}},"6":{"start":{"line":7,"column":0},"end":{"line":7,"column":17}},"7":{"start":{"line":8,"column":0},"end":{"line":8,"column":4}},"8":{"start":{"line":9,"column":0},"end":{"line":9,"column":2}},"9":{"start":{"line":10,"column":0},"end":{"line":10,"column":0}},"10":{"start":{"line":11,"column":0},"end":{"line":11,"column":22}}},"s":{"0":1,"1":1,"2":1,"3":2,"4":2,"5":1,"6":2,"7":2,"8":2,"9":1,"10":1},"branchMap":{"0":{"type":"branch","line":3,"loc":{"start":{"line":3,"column":15},"end":{"line":9,"column":2}},"locations":[{"start":{"line":3,"column":15},"end":{"line":9,"column":2}}]},"1":{"type":"branch","line":5,"loc":{"start":{"line":5,"column":68},"end":{"line":7,"column":8}},"locations":[{"start":{"line":5,"column":68},"end":{"line":7,"column":8}}]}},"b":{"0":[2],"1":[1]},"fnMap":{"0":{"name":"Search","decl":{"start":{"line":3,"column":15},"end":{"line":9,"column":2}},"loc":{"start":{"line":3,"column":15},"end":{"line":9,"column":2}},"line":3},"1":{"name":"onClick","decl":{"start":{"line":5,"column":68},"end":{"line":7,"column":8}},"loc":{"start":{"line":5,"column":68},"end":{"line":7,"column":8}},"line":5}},"f":{"0":2,"1":1}} +,"C:\\Users\\iliya\\Repositories\\innopolis-courses\\f24-enterprice-javascript\\front\\src\\components\\init\\NavButton.jsx": {"path":"C:\\Users\\iliya\\Repositories\\innopolis-courses\\f24-enterprice-javascript\\front\\src\\components\\init\\NavButton.jsx","all":false,"statementMap":{"0":{"start":{"line":1,"column":0},"end":{"line":1,"column":26}},"1":{"start":{"line":2,"column":0},"end":{"line":2,"column":0}},"2":{"start":{"line":3,"column":0},"end":{"line":3,"column":0}},"3":{"start":{"line":4,"column":0},"end":{"line":4,"column":30}},"4":{"start":{"line":5,"column":0},"end":{"line":5,"column":10}},"5":{"start":{"line":6,"column":0},"end":{"line":6,"column":63}},"6":{"start":{"line":7,"column":0},"end":{"line":7,"column":57}},"7":{"start":{"line":8,"column":0},"end":{"line":8,"column":10}},"8":{"start":{"line":9,"column":0},"end":{"line":9,"column":4}},"9":{"start":{"line":10,"column":0},"end":{"line":10,"column":2}},"10":{"start":{"line":11,"column":0},"end":{"line":11,"column":0}},"11":{"start":{"line":12,"column":0},"end":{"line":12,"column":25}}},"s":{"0":1,"1":1,"2":1,"3":1,"4":1,"5":1,"6":1,"7":1,"8":1,"9":1,"10":1,"11":1},"branchMap":{"0":{"type":"branch","line":4,"loc":{"start":{"line":4,"column":18},"end":{"line":10,"column":2}},"locations":[{"start":{"line":4,"column":18},"end":{"line":10,"column":2}}]}},"b":{"0":[1]},"fnMap":{"0":{"name":"NavButton","decl":{"start":{"line":4,"column":18},"end":{"line":10,"column":2}},"loc":{"start":{"line":4,"column":18},"end":{"line":10,"column":2}},"line":4}},"f":{"0":1}} +,"C:\\Users\\iliya\\Repositories\\innopolis-courses\\f24-enterprice-javascript\\front\\src\\components\\reg\\InputField.jsx": {"path":"C:\\Users\\iliya\\Repositories\\innopolis-courses\\f24-enterprice-javascript\\front\\src\\components\\reg\\InputField.jsx","all":false,"statementMap":{"0":{"start":{"line":1,"column":0},"end":{"line":1,"column":26}},"1":{"start":{"line":2,"column":0},"end":{"line":2,"column":0}},"2":{"start":{"line":3,"column":0},"end":{"line":3,"column":31}},"3":{"start":{"line":4,"column":0},"end":{"line":4,"column":42}},"4":{"start":{"line":5,"column":0},"end":{"line":5,"column":10}},"5":{"start":{"line":6,"column":0},"end":{"line":6,"column":11}},"6":{"start":{"line":7,"column":0},"end":{"line":7,"column":30}},"7":{"start":{"line":8,"column":0},"end":{"line":8,"column":16}},"8":{"start":{"line":9,"column":0},"end":{"line":9,"column":62}},"9":{"start":{"line":10,"column":0},"end":{"line":10,"column":33}},"10":{"start":{"line":11,"column":0},"end":{"line":11,"column":31}},"11":{"start":{"line":12,"column":0},"end":{"line":12,"column":72}},"12":{"start":{"line":13,"column":0},"end":{"line":13,"column":33}},"13":{"start":{"line":14,"column":0},"end":{"line":14,"column":42}},"14":{"start":{"line":15,"column":0},"end":{"line":15,"column":41}},"15":{"start":{"line":16,"column":0},"end":{"line":16,"column":41}},"16":{"start":{"line":17,"column":0},"end":{"line":17,"column":23}},"17":{"start":{"line":18,"column":0},"end":{"line":18,"column":19}},"18":{"start":{"line":19,"column":0},"end":{"line":19,"column":16}},"19":{"start":{"line":20,"column":0},"end":{"line":20,"column":12}},"20":{"start":{"line":21,"column":0},"end":{"line":21,"column":12}},"21":{"start":{"line":22,"column":0},"end":{"line":22,"column":4}},"22":{"start":{"line":23,"column":0},"end":{"line":23,"column":2}},"23":{"start":{"line":24,"column":0},"end":{"line":24,"column":0}},"24":{"start":{"line":25,"column":0},"end":{"line":25,"column":26}}},"s":{"0":1,"1":1,"2":1,"3":3,"4":3,"5":3,"6":3,"7":3,"8":3,"9":3,"10":3,"11":3,"12":3,"13":1,"14":1,"15":1,"16":1,"17":1,"18":1,"19":3,"20":3,"21":3,"22":3,"23":1,"24":1},"branchMap":{"0":{"type":"branch","line":3,"loc":{"start":{"line":3,"column":19},"end":{"line":23,"column":2}},"locations":[{"start":{"line":3,"column":19},"end":{"line":23,"column":2}}]},"1":{"type":"branch","line":12,"loc":{"start":{"line":12,"column":45},"end":{"line":12,"column":66}},"locations":[{"start":{"line":12,"column":45},"end":{"line":12,"column":66}}]},"2":{"type":"branch","line":12,"loc":{"start":{"line":12,"column":66},"end":{"line":12,"column":72}},"locations":[{"start":{"line":12,"column":66},"end":{"line":12,"column":72}}]},"3":{"type":"branch","line":9,"loc":{"start":{"line":9,"column":24},"end":{"line":9,"column":62}},"locations":[{"start":{"line":9,"column":24},"end":{"line":9,"column":62}}]},"4":{"type":"branch","line":13,"loc":{"start":{"line":13,"column":25},"end":{"line":19,"column":16}},"locations":[{"start":{"line":13,"column":25},"end":{"line":19,"column":16}}]}},"b":{"0":[3],"1":[1],"2":[2],"3":[1],"4":[1]},"fnMap":{"0":{"name":"InputField","decl":{"start":{"line":3,"column":19},"end":{"line":23,"column":2}},"loc":{"start":{"line":3,"column":19},"end":{"line":23,"column":2}},"line":3},"1":{"name":"onChange","decl":{"start":{"line":9,"column":24},"end":{"line":9,"column":62}},"loc":{"start":{"line":9,"column":24},"end":{"line":9,"column":62}},"line":9},"2":{"name":"onKeyDown","decl":{"start":{"line":13,"column":25},"end":{"line":19,"column":16}},"loc":{"start":{"line":13,"column":25},"end":{"line":19,"column":16}},"line":13}},"f":{"0":3,"1":1,"2":1}} +} diff --git a/coverage/lcov-report/ActionButton.jsx.html b/coverage/lcov-report/ActionButton.jsx.html new file mode 100644 index 0000000..5ca0279 --- /dev/null +++ b/coverage/lcov-report/ActionButton.jsx.html @@ -0,0 +1,118 @@ + + + + + + Code coverage report for ActionButton.jsx + + + + + + + + + +
+
+

All files ActionButton.jsx

+
+ +
+ 100% + Statements + 11/11 +
+ + +
+ 100% + Branches + 2/2 +
+ + +
+ 100% + Functions + 2/2 +
+ + +
+ 100% + Lines + 11/11 +
+ + +
+

+ Press n or j to go to the next uncovered block, b, p or k for the previous block. +

+ +
+
+

+
1 +2 +3 +4 +5 +6 +7 +8 +9 +10 +11 +121x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x + 
import React from 'react';
+ 
+const ActionButton = (props) => {
+  return (
+      <a className="MyButton mclaren-regular" onClick={() => {
+          props.action()
+      }}>{props.title}</a>
+  );
+};
+ 
+export default ActionButton;
+ 
+ +
+
+ + + + + + + + \ No newline at end of file diff --git a/coverage/lcov-report/HelloItem.jsx.html b/coverage/lcov-report/HelloItem.jsx.html new file mode 100644 index 0000000..22cc97e --- /dev/null +++ b/coverage/lcov-report/HelloItem.jsx.html @@ -0,0 +1,139 @@ + + + + + + Code coverage report for HelloItem.jsx + + + + + + + + + +
+
+

All files HelloItem.jsx

+
+ +
+ 100% + Statements + 18/18 +
+ + +
+ 100% + Branches + 3/3 +
+ + +
+ 100% + Functions + 1/1 +
+ + +
+ 100% + Lines + 18/18 +
+ + +
+

+ Press n or j to go to the next uncovered block, b, p or k for the previous block. +

+ +
+
+

+
1 +2 +3 +4 +5 +6 +7 +8 +9 +10 +11 +12 +13 +14 +15 +16 +17 +18 +191x +1x +1x +2x +2x +2x +1x +1x +1x +1x +1x +1x +2x +2x +2x +2x +1x +1x + 
import React from 'react';
+ 
+const HelloItem = (props) => {
+  return (
+      <div className="hello-item-class">
+          {!!props.nickname ? (
+              <>
+                  <h1 className="mclaren-regular">Hello, {props.nickname}!</h1>
+                  <p className="mclaren-regular">Your ID: {props.id}</p>
+              </>
+          ) : (
+              <p className="mclaren-regular">You don't have an account :(</p>
+          )}
+      </div>
+  );
+};
+ 
+export default HelloItem;
+ 
+ +
+
+ + + + + + + + \ No newline at end of file diff --git a/coverage/lcov-report/account/ActionButton.jsx.html b/coverage/lcov-report/account/ActionButton.jsx.html new file mode 100644 index 0000000..55bbcb8 --- /dev/null +++ b/coverage/lcov-report/account/ActionButton.jsx.html @@ -0,0 +1,118 @@ + + + + + + Code coverage report for account/ActionButton.jsx + + + + + + + + + +
+
+

All files / account ActionButton.jsx

+
+ +
+ 100% + Statements + 11/11 +
+ + +
+ 100% + Branches + 2/2 +
+ + +
+ 100% + Functions + 2/2 +
+ + +
+ 100% + Lines + 11/11 +
+ + +
+

+ Press n or j to go to the next uncovered block, b, p or k for the previous block. +

+ +
+
+

+
1 +2 +3 +4 +5 +6 +7 +8 +9 +10 +11 +121x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x + 
import React from 'react';
+ 
+const ActionButton = (props) => {
+  return (
+      <a className="MyButton mclaren-regular" onClick={() => {
+          props.action()
+      }}>{props.title}</a>
+  );
+};
+ 
+export default ActionButton;
+ 
+ +
+
+ + + + + + + + \ No newline at end of file diff --git a/coverage/lcov-report/account/HelloItem.jsx.html b/coverage/lcov-report/account/HelloItem.jsx.html new file mode 100644 index 0000000..5f51438 --- /dev/null +++ b/coverage/lcov-report/account/HelloItem.jsx.html @@ -0,0 +1,139 @@ + + + + + + Code coverage report for account/HelloItem.jsx + + + + + + + + + +
+
+

All files / account HelloItem.jsx

+
+ +
+ 100% + Statements + 18/18 +
+ + +
+ 100% + Branches + 3/3 +
+ + +
+ 100% + Functions + 1/1 +
+ + +
+ 100% + Lines + 18/18 +
+ + +
+

+ Press n or j to go to the next uncovered block, b, p or k for the previous block. +

+ +
+
+

+
1 +2 +3 +4 +5 +6 +7 +8 +9 +10 +11 +12 +13 +14 +15 +16 +17 +18 +191x +1x +1x +2x +2x +2x +1x +1x +1x +1x +1x +1x +2x +2x +2x +2x +1x +1x + 
import React from 'react';
+ 
+const HelloItem = (props) => {
+  return (
+      <div className="hello-item-class">
+          {!!props.nickname ? (
+              <>
+                  <h1 className="mclaren-regular">Hello, {props.nickname}!</h1>
+                  <p className="mclaren-regular">Your ID: {props.id}</p>
+              </>
+          ) : (
+              <p className="mclaren-regular">You don't have an account :(</p>
+          )}
+      </div>
+  );
+};
+ 
+export default HelloItem;
+ 
+ +
+
+ + + + + + + + \ No newline at end of file diff --git a/coverage/lcov-report/account/index.html b/coverage/lcov-report/account/index.html new file mode 100644 index 0000000..3fe944c --- /dev/null +++ b/coverage/lcov-report/account/index.html @@ -0,0 +1,131 @@ + + + + + + Code coverage report for account + + + + + + + + + +
+
+

All files account

+
+ +
+ 100% + Statements + 29/29 +
+ + +
+ 100% + Branches + 5/5 +
+ + +
+ 100% + Functions + 3/3 +
+ + +
+ 100% + Lines + 29/29 +
+ + +
+

+ Press n or j to go to the next uncovered block, b, p or k for the previous block. +

+ +
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
FileStatementsBranchesFunctionsLines
ActionButton.jsx +
+
100%11/11100%2/2100%2/2100%11/11
HelloItem.jsx +
+
100%18/18100%3/3100%1/1100%18/18
+
+
+
+ + + + + + + + \ No newline at end of file diff --git a/coverage/lcov-report/home/Search.jsx.html b/coverage/lcov-report/home/Search.jsx.html new file mode 100644 index 0000000..0156c10 --- /dev/null +++ b/coverage/lcov-report/home/Search.jsx.html @@ -0,0 +1,118 @@ + + + + + + Code coverage report for home/Search.jsx + + + + + + + + + +
+
+

All files / home Search.jsx

+
+ +
+ 100% + Statements + 11/11 +
+ + +
+ 100% + Branches + 2/2 +
+ + +
+ 100% + Functions + 2/2 +
+ + +
+ 100% + Lines + 11/11 +
+ + +
+

+ Press n or j to go to the next uncovered block, b, p or k for the previous block. +

+ +
+
+

+
1 +2 +3 +4 +5 +6 +7 +8 +9 +10 +11 +121x +1x +1x +2x +2x +1x +2x +2x +2x +1x +1x + 
import React from 'react';
+ 
+const Search = (props) => {
+  return (
+      <a className="MyButton search-class mclaren-regular" onClick={() => {
+          props.search(props.item);
+      }}>Find</a>
+  );
+};
+ 
+export default Search;
+ 
+ +
+
+ + + + + + + + \ No newline at end of file diff --git a/coverage/lcov-report/home/index.html b/coverage/lcov-report/home/index.html new file mode 100644 index 0000000..7ddb74e --- /dev/null +++ b/coverage/lcov-report/home/index.html @@ -0,0 +1,116 @@ + + + + + + Code coverage report for home + + + + + + + + + +
+
+

All files home

+
+ +
+ 100% + Statements + 11/11 +
+ + +
+ 100% + Branches + 2/2 +
+ + +
+ 100% + Functions + 2/2 +
+ + +
+ 100% + Lines + 11/11 +
+ + +
+

+ Press n or j to go to the next uncovered block, b, p or k for the previous block. +

+ +
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
FileStatementsBranchesFunctionsLines
Search.jsx +
+
100%11/11100%2/2100%2/2100%11/11
+
+
+
+ + + + + + + + \ No newline at end of file diff --git a/coverage/lcov-report/index.html b/coverage/lcov-report/index.html index 034c003..184efa9 100644 --- a/coverage/lcov-report/index.html +++ b/coverage/lcov-report/index.html @@ -23,30 +23,30 @@
- Unknown% + 100% Statements - 0/0 + 77/77
- Unknown% + 100% Branches - 0/0 + 13/13
- Unknown% + 100% Functions - 0/0 + 9/9
- Unknown% + 100% Lines - 0/0 + 77/77
@@ -61,7 +61,7 @@
-
+
@@ -78,7 +78,67 @@ - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
account +
+
100%29/29100%5/5100%3/3100%29/29
home +
+
100%11/11100%2/2100%2/2100%11/11
init +
+
100%12/12100%1/1100%1/1100%12/12
reg +
+
100%25/25100%5/5100%3/3100%25/25
@@ -86,7 +146,7 @@ + + + + + + \ No newline at end of file diff --git a/coverage/lcov-report/init/index.html b/coverage/lcov-report/init/index.html new file mode 100644 index 0000000..d3f5016 --- /dev/null +++ b/coverage/lcov-report/init/index.html @@ -0,0 +1,116 @@ + + + + + + Code coverage report for init + + + + + + + + + +
+
+

All files init

+
+ +
+ 100% + Statements + 12/12 +
+ + +
+ 100% + Branches + 1/1 +
+ + +
+ 100% + Functions + 1/1 +
+ + +
+ 100% + Lines + 12/12 +
+ + +
+

+ Press n or j to go to the next uncovered block, b, p or k for the previous block. +

+ +
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
FileStatementsBranchesFunctionsLines
NavButton.jsx +
+
100%12/12100%1/1100%1/1100%12/12
+
+
+
+ + + + + + + + \ No newline at end of file diff --git a/coverage/lcov-report/reg/InputField.jsx.html b/coverage/lcov-report/reg/InputField.jsx.html new file mode 100644 index 0000000..485cb4f --- /dev/null +++ b/coverage/lcov-report/reg/InputField.jsx.html @@ -0,0 +1,160 @@ + + + + + + Code coverage report for reg/InputField.jsx + + + + + + + + + +
+
+

All files / reg InputField.jsx

+
+ +
+ 100% + Statements + 25/25 +
+ + +
+ 100% + Branches + 5/5 +
+ + +
+ 100% + Functions + 3/3 +
+ + +
+ 100% + Lines + 25/25 +
+ + +
+

+ Press n or j to go to the next uncovered block, b, p or k for the previous block. +

+ +
+
+

+
1 +2 +3 +4 +5 +6 +7 +8 +9 +10 +11 +12 +13 +14 +15 +16 +17 +18 +19 +20 +21 +22 +23 +24 +25 +261x +1x +1x +3x +3x +3x +3x +3x +3x +3x +3x +3x +3x +1x +1x +1x +1x +1x +1x +3x +3x +3x +3x +1x +1x + 
import React from 'react';
+ 
+const InputField = (props) => {
+    console.log('class:', props.className)
+  return (
+      <div>
+          <p>{props.title}</p>
+          <input
+              onChange={(e) => props.setValue(e.target.value)}
+              value={props.value}
+              className="Input"
+              placeholder={(props.placeholder) ? props.placeholder : ''}
+              onKeyDown={(e) => {
+                  if (e.key === 'Enter') {
+                      if (props.submit) {
+                          props.submit();
+                      }
+                  }
+              }}
+          />
+      </div>
+  );
+};
+ 
+export default InputField;
+ 
+ +
+
+ + + + + + + + \ No newline at end of file diff --git a/coverage/lcov-report/reg/index.html b/coverage/lcov-report/reg/index.html new file mode 100644 index 0000000..f25c94c --- /dev/null +++ b/coverage/lcov-report/reg/index.html @@ -0,0 +1,116 @@ + + + + + + Code coverage report for reg + + + + + + + + + +
+
+

All files reg

+
+ +
+ 100% + Statements + 25/25 +
+ + +
+ 100% + Branches + 5/5 +
+ + +
+ 100% + Functions + 3/3 +
+ + +
+ 100% + Lines + 25/25 +
+ + +
+

+ Press n or j to go to the next uncovered block, b, p or k for the previous block. +

+ +
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
FileStatementsBranchesFunctionsLines
InputField.jsx +
+
100%25/25100%5/5100%3/3100%25/25
+
+
+
+ + + + + + + + \ No newline at end of file diff --git a/coverage/lcov.info b/coverage/lcov.info index e69de29..985a6ad 100644 --- a/coverage/lcov.info +++ b/coverage/lcov.info @@ -0,0 +1,153 @@ +TN: +SF:src\components\account\ActionButton.jsx +FN:3,ActionButton +FN:5,onClick +FNF:2 +FNH:2 +FNDA:1,ActionButton +FNDA:1,onClick +DA:1,1 +DA:2,1 +DA:3,1 +DA:4,1 +DA:5,1 +DA:6,1 +DA:7,1 +DA:8,1 +DA:9,1 +DA:10,1 +DA:11,1 +LF:11 +LH:11 +BRDA:3,0,0,1 +BRDA:5,1,0,1 +BRF:2 +BRH:2 +end_of_record +TN: +SF:src\components\account\HelloItem.jsx +FN:3,HelloItem +FNF:1 +FNH:1 +FNDA:2,HelloItem +DA:1,1 +DA:2,1 +DA:3,1 +DA:4,2 +DA:5,2 +DA:6,2 +DA:7,1 +DA:8,1 +DA:9,1 +DA:10,1 +DA:11,1 +DA:12,1 +DA:13,2 +DA:14,2 +DA:15,2 +DA:16,2 +DA:17,1 +DA:18,1 +LF:18 +LH:18 +BRDA:3,0,0,2 +BRDA:6,1,0,1 +BRDA:11,2,0,1 +BRF:3 +BRH:3 +end_of_record +TN: +SF:src\components\home\Search.jsx +FN:3,Search +FN:5,onClick +FNF:2 +FNH:2 +FNDA:2,Search +FNDA:1,onClick +DA:1,1 +DA:2,1 +DA:3,1 +DA:4,2 +DA:5,2 +DA:6,1 +DA:7,2 +DA:8,2 +DA:9,2 +DA:10,1 +DA:11,1 +LF:11 +LH:11 +BRDA:3,0,0,2 +BRDA:5,1,0,1 +BRF:2 +BRH:2 +end_of_record +TN: +SF:src\components\init\NavButton.jsx +FN:4,NavButton +FNF:1 +FNH:1 +FNDA:1,NavButton +DA:1,1 +DA:2,1 +DA:3,1 +DA:4,1 +DA:5,1 +DA:6,1 +DA:7,1 +DA:8,1 +DA:9,1 +DA:10,1 +DA:11,1 +DA:12,1 +LF:12 +LH:12 +BRDA:4,0,0,1 +BRF:1 +BRH:1 +end_of_record +TN: +SF:src\components\reg\InputField.jsx +FN:3,InputField +FN:9,onChange +FN:13,onKeyDown +FNF:3 +FNH:3 +FNDA:3,InputField +FNDA:1,onChange +FNDA:1,onKeyDown +DA:1,1 +DA:2,1 +DA:3,1 +DA:4,3 +DA:5,3 +DA:6,3 +DA:7,3 +DA:8,3 +DA:9,3 +DA:10,3 +DA:11,3 +DA:12,3 +DA:13,3 +DA:14,1 +DA:15,1 +DA:16,1 +DA:17,1 +DA:18,1 +DA:19,1 +DA:20,3 +DA:21,3 +DA:22,3 +DA:23,3 +DA:24,1 +DA:25,1 +LF:25 +LH:25 +BRDA:3,0,0,3 +BRDA:12,1,0,1 +BRDA:12,2,0,2 +BRDA:9,3,0,1 +BRDA:13,4,0,1 +BRF:5 +BRH:5 +end_of_record diff --git a/src/components/reg/InputField.jsx b/src/components/reg/InputField.jsx index 730a4d4..743d18c 100644 --- a/src/components/reg/InputField.jsx +++ b/src/components/reg/InputField.jsx @@ -13,7 +13,7 @@ const InputField = (props) => { onKeyDown={(e) => { if (e.key === 'Enter') { if (props.submit) { - props.enter(props.submit); + props.submit(); } } }}