File tree 3 files changed +21
-2
lines changed
3 files changed +21
-2
lines changed Original file line number Diff line number Diff line change @@ -148,6 +148,24 @@ describe('The FolderTree Component', () => {
148
148
) . toContain ( folderTreeEditClassName ) ;
149
149
} ) ;
150
150
151
+ test ( 'Should NOT call loadData in editing' , ( ) => {
152
+ const mockFn = jest . fn ( ( ) => Promise . resolve ( ) ) ;
153
+ const { getByRole } = render (
154
+ < FolderTreeViewPanel
155
+ folderTree = { {
156
+ data : [ { ...mockTreeData [ 0 ] , children : [ mockEditFile ] } ] ,
157
+ } }
158
+ onLoadData = { mockFn }
159
+ />
160
+ ) ;
161
+
162
+ const input = getByRole ( 'input' ) as HTMLInputElement ;
163
+ expect ( input ) . toBeInTheDocument ( ) ;
164
+
165
+ fireEvent . click ( input ) ;
166
+ expect ( mockFn ) . not . toBeCalled ( ) ;
167
+ } ) ;
168
+
151
169
test ( 'Should support to update file name via blur or keypress' , ( ) => {
152
170
const mockFn = jest . fn ( ) ;
153
171
const { getByRole } = render (
Original file line number Diff line number Diff line change @@ -205,6 +205,7 @@ const FolderTree: React.FunctionComponent<IFolderTreeProps> = (props) => {
205
205
autoComplete = "off"
206
206
autoFocus
207
207
onBlur = { ( e ) => handleInputBlur ( e , node ) }
208
+ onClick = { ( e ) => e . stopPropagation ( ) }
208
209
/>
209
210
) : (
210
211
name !
Original file line number Diff line number Diff line change 34
34
font-family : inherit ;
35
35
font-size : 13px ;
36
36
height : 20px ;
37
- left : -2 px ;
37
+ left : 0 ;
38
38
margin : 0 ;
39
39
outline : none ;
40
40
padding : 0 ;
41
41
position : relative ;
42
- width : 100% ;
42
+ width : calc ( 100% - 2 px ) ;
43
43
44
44
& :focus ,
45
45
& :active {
You can’t perform that action at this time.
0 commit comments