File tree Expand file tree Collapse file tree 3 files changed +35
-1
lines changed Expand file tree Collapse file tree 3 files changed +35
-1
lines changed Original file line number Diff line number Diff line change @@ -428,6 +428,32 @@ describe('App', () => {
428428 } )
429429 } )
430430
431+ it ( 'should not toggle the checkpoint plots section if a link is clicked' , ( ) => {
432+ renderAppWithOptionalData ( {
433+ checkpoint : checkpointPlotsFixture
434+ } )
435+
436+ const checkpointsTooltipToggle = screen . getAllByTestId (
437+ 'info-tooltip-toggle'
438+ ) [ 2 ]
439+ fireEvent . mouseEnter ( checkpointsTooltipToggle , {
440+ bubbles : true ,
441+ cancelable : true
442+ } )
443+
444+ const tooltip = screen . getByTestId ( 'tooltip-checkpoint-plots' )
445+ const tooltipLink = within ( tooltip ) . getByRole ( 'link' )
446+ fireEvent . click ( tooltipLink , {
447+ bubbles : true ,
448+ cancelable : true
449+ } )
450+
451+ expect ( mockPostMessage ) . not . toHaveBeenCalledWith ( {
452+ payload : { [ Section . CHECKPOINT_PLOTS ] : true } ,
453+ type : MessageFromWebviewType . TOGGLE_PLOTS_SECTION
454+ } )
455+ } )
456+
431457 it ( 'should not toggle the checkpoint plots section when its header is clicked and the content of its tooltip is selected' , async ( ) => {
432458 renderAppWithOptionalData ( {
433459 checkpoint : checkpointPlotsFixture
Original file line number Diff line number Diff line change @@ -18,6 +18,7 @@ import {
1818 Lines
1919} from '../../shared/components/icons'
2020import { isSelecting } from '../../util/strings'
21+ import { EventTargetWithNodeName } from '../../util/objects'
2122
2223export interface CommonPlotsContainerProps {
2324 onResize : ( size : PlotSize ) => void
@@ -139,7 +140,10 @@ export const PlotsContainer: React.FC<PlotsContainerProps> = ({
139140
140141 const toggleSection = ( e : MouseEvent ) => {
141142 e . preventDefault ( )
142- if ( ! isSelecting ( [ title , SectionDescription [ sectionKey ] . props . children ] ) ) {
143+ if (
144+ ! isSelecting ( [ title , SectionDescription [ sectionKey ] . props . children ] ) &&
145+ ! [ 'A' , 'BUTTON' ] . includes ( ( e . target as EventTargetWithNodeName ) . nodeName )
146+ ) {
143147 sendMessage ( {
144148 payload : {
145149 [ sectionKey ] : ! sectionCollapsed
Original file line number Diff line number Diff line change @@ -15,3 +15,7 @@ export type Obj = { [key: string]: Any }
1515
1616export const keepReferenceIfEqual = ( old : BaseType , recent : BaseType ) =>
1717 isEqual ( old , recent ) ? old : recent
18+
19+ export interface EventTargetWithNodeName extends EventTarget {
20+ nodeName : string
21+ }
You can’t perform that action at this time.
0 commit comments