forked from mui/material-ui
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathBackdrop.test.js
More file actions
55 lines (47 loc) · 1.43 KB
/
Backdrop.test.js
File metadata and controls
55 lines (47 loc) · 1.43 KB
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
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
import { expect } from 'chai';
import { spy } from 'sinon';
import { createRenderer } from '@mui/internal-test-utils';
import Backdrop, { backdropClasses as classes } from '@mui/material/Backdrop';
import Fade from '@mui/material/Fade';
import describeConformance from '../../test/describeConformance';
describe('<Backdrop />', () => {
const { clock, render } = createRenderer();
describeConformance(<Backdrop open />, () => ({
classes,
inheritComponent: Fade,
render,
refInstanceof: window.HTMLDivElement,
muiName: 'MuiBackdrop',
testVariantProps: { invisible: true },
slots: {
root: {
expectedClassName: classes.root,
},
transition: {
testWithElement: null,
},
},
}));
it('should render a backdrop div with content of nested children', () => {
const { container } = render(
<Backdrop open>
<h1>Hello World</h1>
</Backdrop>,
);
expect(container.querySelector('h1')).to.have.text('Hello World');
});
describe('prop: transitionDuration', () => {
clock.withFakeTimers();
it('delays appearance of its children', () => {
const handleEntered = spy();
render(
<Backdrop open transitionDuration={1954} onEntered={handleEntered}>
<div />
</Backdrop>,
);
expect(handleEntered.callCount).to.equal(0);
clock.tick(1954);
expect(handleEntered.callCount).to.equal(1);
});
});
});