Skip to content

Commit 09da8bc

Browse files
committed
test commit
1 parent e63f936 commit 09da8bc

File tree

3 files changed

+27
-21
lines changed

3 files changed

+27
-21
lines changed

.theia/settings.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"editor.autoSave": "on",
3+
"typescript.tsdk": "node_modules/typescript/lib"
4+
}

src/App.test.tsx

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,13 @@ import React from 'react';
22
import { render, screen } from '@testing-library/react';
33
import App from './App';
44

5-
test('renders learn react link', () => {
6-
render(<App />);
7-
const linkElement = screen.getByText(/learn react/i);
8-
expect(linkElement).toBeInTheDocument();
9-
});
5+
describe('<App />', () => {
6+
test('render elements without any problem', () => {
7+
render(<App />);
8+
const wrapper = screen.getByTestId('app-wrapper');
9+
expect(wrapper).toBeInTheDocument();
10+
11+
const input = screen.getByTestId('app-input');
12+
expect(input).toBeInTheDocument();
13+
});
14+
})

src/App.tsx

Lines changed: 13 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,21 @@
1-
import React from 'react';
1+
import React, { useState } from 'react';
22
import logo from './logo.svg';
33
import './App.css';
44

55
function App() {
6+
const [text, setText] = useState('');
7+
8+
const updateState = (event: any) => {
9+
setText(event.target.value)
10+
}
11+
612
return (
7-
<div className="App">
8-
<header className="App-header">
9-
<img src={logo} className="App-logo" alt="logo" />
10-
<p>
11-
Edit <code>src/App.tsx</code> and save to reload.
12-
</p>
13-
<a
14-
className="App-link"
15-
href="https://reactjs.org"
16-
target="_blank"
17-
rel="noopener noreferrer"
18-
>
19-
Learn React
20-
</a>
21-
</header>
13+
<div data-testid="app-wrapper">
14+
<input
15+
onChange={(event) => updateState(event)}
16+
type="text"
17+
data-testid="app-input"
18+
/>
2219
</div>
2320
);
2421
}

0 commit comments

Comments
 (0)