|
1 | 1 | import * as React from 'react'; |
2 | 2 | import { expect } from 'chai'; |
3 | | -import { stub } from 'sinon'; |
4 | 3 | import { createMount, getClasses } from '@material-ui/core/test-utils'; |
5 | 4 | import describeConformance from '@material-ui/core/test-utils/describeConformance'; |
6 | 5 | import { createClientRender } from 'test/utils/createClientRender'; |
@@ -29,47 +28,30 @@ describe('<AvatarGroup />', () => { |
29 | 28 | skip: ['componentProp'], |
30 | 29 | })); |
31 | 30 |
|
32 | | - it('should display 1 avatar and "+X" if `max` is lower than 2', () => { |
33 | | - const consoleWarn = stub(console, 'warn'); |
34 | | - const { container } = render( |
35 | | - <AvatarGroup max={1}> |
36 | | - <Avatar src="image-url" /> |
37 | | - <Avatar src="image-url" /> |
38 | | - <Avatar src="image-url" /> |
39 | | - <Avatar src="image-url" /> |
40 | | - </AvatarGroup>, |
41 | | - ); |
42 | | - expect(consoleWarn.callCount).to.equal(1); |
43 | | - expect(container.querySelectorAll('.MuiAvatar-root').length).to.equal(2); |
44 | | - expect(container.querySelectorAll('img').length).to.equal(1); |
45 | | - expect(container.textContent).to.equal('+3'); |
46 | | - }); |
47 | | - |
48 | | - it('should display first `max` avatars, followed by "+X"', () => { |
| 31 | + it('should display all the avatars', () => { |
49 | 32 | const { container } = render( |
50 | 33 | <AvatarGroup max={3}> |
51 | 34 | <Avatar src="image-url" /> |
52 | 35 | <Avatar src="image-url" /> |
53 | 36 | <Avatar src="image-url" /> |
54 | | - <Avatar src="image-url" /> |
55 | | - <Avatar src="image-url" /> |
56 | 37 | </AvatarGroup>, |
57 | 38 | ); |
58 | 39 | expect(container.querySelectorAll('.MuiAvatar-root').length).to.equal(3); |
59 | | - expect(container.querySelectorAll('img').length).to.equal(2); |
60 | | - expect(container.textContent).to.equal('+3'); |
| 40 | + expect(container.querySelectorAll('img').length).to.equal(3); |
| 41 | + expect(container.textContent).to.equal(''); |
61 | 42 | }); |
62 | 43 |
|
63 | | - it('should display all avatars instead of `max` avatars followed by "+1"', () => { |
| 44 | + it('should display 2 avatars and "+2"', () => { |
64 | 45 | const { container } = render( |
65 | 46 | <AvatarGroup max={3}> |
66 | 47 | <Avatar src="image-url" /> |
67 | 48 | <Avatar src="image-url" /> |
68 | 49 | <Avatar src="image-url" /> |
| 50 | + <Avatar src="image-url" /> |
69 | 51 | </AvatarGroup>, |
70 | 52 | ); |
71 | 53 | expect(container.querySelectorAll('.MuiAvatar-root').length).to.equal(3); |
72 | | - expect(container.querySelectorAll('img').length).to.equal(3); |
73 | | - expect(container.textContent).to.have.lengthOf(0); |
| 54 | + expect(container.querySelectorAll('img').length).to.equal(2); |
| 55 | + expect(container.textContent).to.equal('+2'); |
74 | 56 | }); |
75 | 57 | }); |
0 commit comments