File tree Expand file tree Collapse file tree 6 files changed +31
-520
lines changed
packages/components/src/Dialog/Layout Expand file tree Collapse file tree 6 files changed +31
-520
lines changed Original file line number Diff line number Diff line change 2424
2525 */
2626
27- import 'jest-styled-components'
2827import React from 'react'
29- import { assertSnapshot } from '@looker/components-test-utils'
28+ import { renderWithTheme } from '@looker/components-test-utils'
29+ import { screen } from '@testing-library/react'
3030import { DialogContent } from './DialogContent'
3131
3232describe ( 'DialogContent' , ( ) => {
33- test ( 'Snapshot' , ( ) => {
34- assertSnapshot ( < DialogContent > Stuff</ DialogContent > )
33+ test ( 'basic' , ( ) => {
34+ renderWithTheme ( < DialogContent > Stuff</ DialogContent > )
35+ expect ( screen . getByText ( 'Stuff' ) ) . toBeInTheDocument ( )
3536 } )
3637
37- test ( 'Snapshot - No overflow ' , ( ) => {
38- assertSnapshot (
39- < DialogContent >
40- < div style = { { height : '4rem' } } > Stuff</ div >
38+ test ( 'hasHeader & hasFooter ' , ( ) => {
39+ renderWithTheme (
40+ < DialogContent hasHeader hasFooter >
41+ Stuff
4142 </ DialogContent >
4243 )
44+ expect ( screen . getByText ( 'Stuff' ) ) . toBeInTheDocument ( )
4345 } )
4446} )
Original file line number Diff line number Diff line change 2424
2525 */
2626
27- import 'jest-styled-components'
2827import React from 'react'
29- import { assertSnapshot } from '@looker/components-test-utils'
30- import { DialogContext } from '../DialogContext '
28+ import { renderWithTheme } from '@looker/components-test-utils'
29+ import { screen } from '@testing-library/react '
3130import { DialogFooter } from './DialogFooter'
3231
33- test ( 'DialogFooter with Button' , ( ) => {
34- assertSnapshot (
35- < DialogFooter >
36- < button > Cancel</ button >
37- </ DialogFooter >
38- )
39- } )
40-
41- test ( 'DialogFooter with DialogContext' , ( ) => {
42- assertSnapshot (
43- < DialogContext . Consumer >
44- { ( { closeModal } ) => (
45- < DialogFooter >
46- < button onClick = { closeModal } > Cancel</ button >
47- < button
48- onClick = { ( ) => {
49- alert ( 'Doing things...' )
50- closeModal ( )
51- } }
52- >
53- Yes, Delete "Stuff"
54- </ button >
55- </ DialogFooter >
56- ) }
57- </ DialogContext . Consumer >
58- )
32+ describe ( 'DialogFooter' , ( ) => {
33+ test ( 'basic' , ( ) => {
34+ renderWithTheme (
35+ < DialogFooter >
36+ < button > Cancel</ button >
37+ </ DialogFooter >
38+ )
39+ expect ( screen . getByRole ( 'button' ) ) . toBeInTheDocument ( )
40+ } )
41+
42+ test ( 'secondary' , ( ) => {
43+ renderWithTheme (
44+ < DialogFooter secondary = { < button > Nevermind</ button > } >
45+ < button > Cancel</ button >
46+ </ DialogFooter >
47+ )
48+ expect ( screen . getByText ( 'Nevermind' ) ) . toBeInTheDocument ( )
49+ } )
5950} )
Original file line number Diff line number Diff line change 2626
2727import 'jest-styled-components'
2828import React from 'react'
29- import { assertSnapshot , renderWithTheme } from '@looker/components-test-utils'
29+ import { renderWithTheme } from '@looker/components-test-utils'
3030import { screen } from '@testing-library/react'
3131import { DialogHeader } from './DialogHeader'
3232
3333describe ( 'DialogHeader' , ( ) => {
34- test ( 'Snapshot' , ( ) => {
35- assertSnapshot (
36- < DialogHeader id = "test-DialogHeader" >
37- The Heading for a Dialog
38- </ DialogHeader >
39- )
40- } )
41-
4234 test ( 'Passes through DOM props' , async ( ) => {
4335 renderWithTheme (
4436 < DialogHeader aria-label = "ARIA label" > Heading</ DialogHeader >
Load Diff This file was deleted.
Load Diff This file was deleted.
You can’t perform that action at this time.
0 commit comments