This repository was archived by the owner on Mar 5, 2022. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +81
-0
lines changed
cypress/component/component tests/advanced/material-ui-example Expand file tree Collapse file tree 2 files changed +81
-0
lines changed Original file line number Diff line number Diff line change 1+ import React from 'react'
2+ import { makeStyles } from '@material-ui/core/styles'
3+ import List from '@material-ui/core/List'
4+ import ListItem from '@material-ui/core/ListItem'
5+ import ListItemIcon from '@material-ui/core/ListItemIcon'
6+ import ListItemText from '@material-ui/core/ListItemText'
7+ import Divider from '@material-ui/core/Divider'
8+ import InboxIcon from '@material-ui/icons/Inbox'
9+ import DraftsIcon from '@material-ui/icons/Drafts'
10+
11+ const useStyles = makeStyles ( theme => ( {
12+ root : {
13+ width : '100%' ,
14+ maxWidth : 360 ,
15+ backgroundColor : theme . palette . background . paper ,
16+ } ,
17+ } ) )
18+
19+ function ListItemLink ( props ) {
20+ return < ListItem button component = "a" { ...props } />
21+ }
22+
23+ export default function SimpleList ( ) {
24+ const classes = useStyles ( )
25+
26+ return (
27+ < div className = { classes . root } >
28+ < List component = "nav" aria-label = "main mailbox folders" >
29+ < ListItem button >
30+ < ListItemIcon >
31+ < InboxIcon />
32+ </ ListItemIcon >
33+ < ListItemText primary = "Inbox" />
34+ </ ListItem >
35+ < ListItem button >
36+ < ListItemIcon >
37+ < DraftsIcon />
38+ </ ListItemIcon >
39+ < ListItemText primary = "Drafts" />
40+ </ ListItem >
41+ </ List >
42+ < Divider />
43+ < List component = "nav" aria-label = "secondary mailbox folders" >
44+ < ListItem button >
45+ < ListItemText primary = "Trash" />
46+ </ ListItem >
47+ < ListItemLink href = "#simple-list" >
48+ < ListItemText primary = "Spam" />
49+ </ ListItemLink >
50+ </ List >
51+ </ div >
52+ )
53+ }
Original file line number Diff line number Diff line change 1+ /// <reference types="cypress" />
2+ import React from 'react'
3+ import { mount } from 'cypress-react-unit-test'
4+ import ListItem from '@material-ui/core/ListItem'
5+ import { ListItemText } from '@material-ui/core'
6+ import SimpleList from './list-demo'
7+
8+ it ( 'renders a list item' , ( ) => {
9+ const Demo = ( ) => (
10+ < ListItem >
11+ < ListItemText primary = { 'my example list item' } />
12+ </ ListItem >
13+ )
14+ mount ( < Demo /> )
15+ cy . contains ( 'my example list item' )
16+ } )
17+
18+ // demo from https://material-ui.com/components/lists/
19+ it ( 'renders full list' , ( ) => {
20+ cy . viewport ( 500 , 800 )
21+ mount ( < SimpleList /> )
22+ cy . contains ( 'Drafts' )
23+ . click ( )
24+ . wait ( 1000 )
25+ . click ( )
26+ . wait ( 1000 )
27+ . click ( )
28+ } )
You can’t perform that action at this time.
0 commit comments