File tree Expand file tree Collapse file tree 4 files changed +20
-3
lines changed Expand file tree Collapse file tree 4 files changed +20
-3
lines changed Original file line number Diff line number Diff line change 8
8
"web-vitals" : " ^2.1.0"
9
9
},
10
10
"devDependencies" : {
11
- "cypress" : " ^12.1.0"
11
+ "cypress" : " ^12.1.0" ,
12
+ "@ui5/webcomponents-cypress-commands" : " latest"
12
13
},
13
14
"scripts" : {
14
15
"test" : " cypress run --component --browser chrome" ,
Original file line number Diff line number Diff line change @@ -21,6 +21,8 @@ import './commands';
21
21
22
22
import { mount } from 'cypress/react18' ;
23
23
import { ThemeProvider } from '@ui5/webcomponents-react' ;
24
+ // Cypress commands and queries that help interacting with ui5-webcomponents
25
+ import '@ui5/webcomponents-cypress-commands' ;
24
26
25
27
/**
26
28
* Cypress mount with ThemeProvider
Original file line number Diff line number Diff line change 1
1
import App from './App' ;
2
2
3
3
describe ( 'Component tests' , ( ) => {
4
- it ( 'render Link' , ( ) => {
4
+ it ( 'render Link component with text ' , ( ) => {
5
5
cy . mount ( < App /> ) ;
6
- cy . get ( '[ui5-link]' ) . should ( 'be.visible' ) . should ( 'have.text' , 'Getting Started with UI5 Web Component for React' ) ;
6
+ cy . get ( '[ui5-link]' ) . should ( 'be.visible' ) . and ( 'have.text' , 'Getting Started with UI5 Web Component for React' ) ;
7
+ } ) ;
8
+ it ( 'type into Input component' , ( ) => {
9
+ cy . mount ( < App /> ) ;
10
+ cy . get ( '[ui5-input]' ) . typeIntoUi5Input ( 'Hello there!' ) ;
11
+ cy . get ( '[ui5-label]' ) . should ( 'be.visible' ) . and ( 'have.text' , 'Hello there!' ) ;
7
12
} ) ;
8
13
} ) ;
Original file line number Diff line number Diff line change
1
+ import { useState } from 'react' ;
1
2
import {
2
3
FlexBox ,
3
4
FlexBoxAlignItems ,
4
5
FlexBoxDirection ,
5
6
FlexBoxJustifyContent ,
7
+ Input ,
8
+ Label ,
6
9
Link ,
7
10
LinkDesign ,
8
11
ShellBar
9
12
} from '@ui5/webcomponents-react' ;
10
13
import './App.css' ;
11
14
12
15
function App ( ) {
16
+ const [ inputVal , setInputVal ] = useState ( '' ) ;
17
+ const handleInput = ( e ) => {
18
+ setInputVal ( e . target . value ) ;
19
+ } ;
13
20
return (
14
21
< >
15
22
< ShellBar primaryTitle = "UI5 Web Components for React Template" />
@@ -22,6 +29,8 @@ function App() {
22
29
< Link href = "https://sap.github.io/ui5-webcomponents-react/" target = "_blank" design = { LinkDesign . Emphasized } >
23
30
Getting Started with UI5 Web Component for React
24
31
</ Link >
32
+ < Input placeholder = "Hello World" onInput = { handleInput } value = { inputVal } />
33
+ < Label > { inputVal } </ Label >
25
34
</ FlexBox >
26
35
</ >
27
36
) ;
You can’t perform that action at this time.
0 commit comments