File tree Expand file tree Collapse file tree 2 files changed +23
-1
lines changed
x-pack/legacy/plugins/lens/public/app_plugin Expand file tree Collapse file tree 2 files changed +23
-1
lines changed Original file line number Diff line number Diff line change @@ -12,6 +12,7 @@ import { EditorFrameInstance } from '../types';
1212import { Storage } from '../../../../../../src/plugins/kibana_utils/public' ;
1313import { Document , SavedObjectStore } from '../persistence' ;
1414import { mount } from 'enzyme' ;
15+ import { SavedObjectSaveModal } from '../../../../../../src/plugins/saved_objects/public' ;
1516import {
1617 esFilters ,
1718 FilterManager ,
@@ -647,6 +648,27 @@ describe('Lens App', () => {
647648 } ,
648649 } ) ;
649650 } ) ;
651+
652+ it ( 'does not show the copy button on first save' , async ( ) => {
653+ const args = defaultArgs ;
654+ args . editorFrame = frame ;
655+
656+ instance = mount ( < App { ...args } /> ) ;
657+
658+ const onChange = frame . mount . mock . calls [ 0 ] [ 1 ] . onChange ;
659+ await act ( async ( ) =>
660+ onChange ( {
661+ filterableIndexPatterns : [ ] ,
662+ doc : ( { expression : 'valid expression' } as unknown ) as Document ,
663+ } )
664+ ) ;
665+ instance . update ( ) ;
666+
667+ await act ( async ( ) => getButton ( instance ) . run ( instance . getDOMNode ( ) ) ) ;
668+ instance . update ( ) ;
669+
670+ expect ( instance . find ( SavedObjectSaveModal ) . prop ( 'showCopyOnSave' ) ) . toEqual ( false ) ;
671+ } ) ;
650672 } ) ;
651673 } ) ;
652674
Original file line number Diff line number Diff line change @@ -385,7 +385,7 @@ export function App({
385385 } }
386386 onClose = { ( ) => setState ( s => ( { ...s , isSaveModalVisible : false } ) ) }
387387 title = { lastKnownDoc . title || '' }
388- showCopyOnSave = { ! addToDashboardMode }
388+ showCopyOnSave = { ! ! lastKnownDoc . id && ! addToDashboardMode }
389389 objectType = { i18n . translate ( 'xpack.lens.app.saveModalType' , {
390390 defaultMessage : 'Lens visualization' ,
391391 } ) }
You can’t perform that action at this time.
0 commit comments