File tree Expand file tree Collapse file tree 2 files changed +15
-7
lines changed
packages/material-ui-lab/src/SpeedDial Expand file tree Collapse file tree 2 files changed +15
-7
lines changed Original file line number Diff line number Diff line change @@ -158,19 +158,15 @@ class SpeedDial extends React.Component {
158
158
return React . cloneElement ( child , {
159
159
delay,
160
160
open,
161
- onKeyDown : this . handleKeyDown ,
162
161
id : `${ id } -item-${ validChildCount } ` ,
163
162
} ) ;
164
163
} ) ;
165
164
166
165
const icon = ( ) => {
167
- if ( ! React . isValidElement ( iconProp ) ) {
168
- return iconProp ;
169
- }
170
- if ( isMuiElement ( iconProp , [ 'SpeedDialIcon' ] ) ) {
166
+ if ( React . isValidElement ( iconProp ) && isMuiElement ( iconProp , [ 'SpeedDialIcon' ] ) ) {
171
167
return React . cloneElement ( iconProp , { open } ) ;
172
168
}
173
- return icon ;
169
+ return iconProp ;
174
170
} ;
175
171
176
172
const actionsPlacementClass = {
Original file line number Diff line number Diff line change 1
1
import React from 'react' ;
2
2
import { assert } from 'chai' ;
3
3
import { spy } from 'sinon' ;
4
- import { createShallow , getClasses } from '@material-ui/core/test-utils' ;
4
+ import { createMount , createShallow , getClasses } from '@material-ui/core/test-utils' ;
5
5
import Icon from '@material-ui/core/Icon' ;
6
6
import Button from '@material-ui/core/Button' ;
7
7
import SpeedDial from './SpeedDial' ;
8
8
import SpeedDialAction from '../SpeedDialAction' ;
9
9
10
10
describe ( '<SpeedDial />' , ( ) => {
11
+ let mount ;
11
12
let shallow ;
12
13
let classes ;
13
14
const icon = < Icon > font_icon</ Icon > ;
@@ -17,6 +18,7 @@ describe('<SpeedDial />', () => {
17
18
} ;
18
19
19
20
before ( ( ) => {
21
+ mount = createMount ( ) ;
20
22
shallow = createShallow ( { dive : true } ) ;
21
23
classes = getClasses (
22
24
< SpeedDial { ...defaultProps } icon = { icon } >
@@ -25,6 +27,16 @@ describe('<SpeedDial />', () => {
25
27
) ;
26
28
} ) ;
27
29
30
+ it ( 'should render with a minimal setup' , ( ) => {
31
+ const wrapper = mount (
32
+ < SpeedDial { ...defaultProps } icon = { icon } >
33
+ < SpeedDialAction icon = { < Icon > save_icon</ Icon > } tooltipTitle = "Save" />
34
+ </ SpeedDial > ,
35
+ ) ;
36
+
37
+ wrapper . unmount ( ) ;
38
+ } ) ;
39
+
28
40
it ( 'should render a Fade transition' , ( ) => {
29
41
const wrapper = shallow (
30
42
< SpeedDial { ...defaultProps } icon = { icon } >
You can’t perform that action at this time.
0 commit comments