@@ -1409,8 +1409,9 @@ describe('App', () => {
14091409 } )
14101410
14111411 expect ( screen . queryByTestId ( 'modal' ) ) . not . toBeInTheDocument ( )
1412-
1413- const plot = within ( screen . getAllByTestId ( / ^ p l o t _ / ) [ 0 ] ) . getByRole ( 'button' )
1412+ const plot = within ( screen . getAllByTestId ( / ^ p l o t _ / ) [ 0 ] ) . getByLabelText (
1413+ 'Open Plot in Popup'
1414+ )
14141415
14151416 fireEvent . click ( plot )
14161417
@@ -1424,7 +1425,9 @@ describe('App', () => {
14241425
14251426 expect ( screen . queryByTestId ( 'modal' ) ) . not . toBeInTheDocument ( )
14261427
1427- const plot = within ( screen . getAllByTestId ( / ^ p l o t _ / ) [ 0 ] ) . getByRole ( 'button' )
1428+ const plot = within ( screen . getAllByTestId ( / ^ p l o t _ / ) [ 0 ] ) . getByLabelText (
1429+ 'Open Plot in Popup'
1430+ )
14281431
14291432 fireEvent . click ( plot )
14301433
@@ -1471,13 +1474,63 @@ describe('App', () => {
14711474
14721475 expect ( screen . queryByTestId ( 'modal' ) ) . not . toBeInTheDocument ( )
14731476
1474- const plot = within ( screen . getAllByTestId ( / ^ p l o t - / ) [ 0 ] ) . getByRole ( 'button' )
1477+ const plot = within ( screen . getAllByTestId ( / ^ p l o t - / ) [ 0 ] ) . getByLabelText (
1478+ 'Open Plot in Popup'
1479+ )
14751480
14761481 fireEvent . click ( plot )
14771482
14781483 expect ( screen . getByTestId ( 'modal' ) ) . toBeInTheDocument ( )
14791484 } )
14801485
1486+ it ( 'should open a modal with the plot zoomed in and actions menu open when clicking on a plot actions button' , async ( ) => {
1487+ renderAppWithOptionalData ( {
1488+ custom : customPlotsFixture
1489+ } )
1490+
1491+ expect ( screen . queryByTestId ( 'modal' ) ) . not . toBeInTheDocument ( )
1492+
1493+ const plotActionsButton = within (
1494+ screen . getAllByTestId ( / ^ p l o t - / ) [ 0 ]
1495+ ) . getByLabelText ( 'See Plot Export Options' )
1496+
1497+ fireEvent . click ( plotActionsButton )
1498+
1499+ expect ( screen . getByTestId ( 'modal' ) ) . toBeInTheDocument ( )
1500+ await waitFor (
1501+ ( ) => {
1502+ expect ( screen . getByTitle ( 'Click to view actions' ) ) . toHaveAttribute (
1503+ 'open'
1504+ )
1505+ } ,
1506+ { timeout : 1000 }
1507+ )
1508+ } )
1509+
1510+ it ( 'should open a modal with the plot zoomed in and actions menu open when key pressing on a plot actions button' , async ( ) => {
1511+ renderAppWithOptionalData ( {
1512+ custom : customPlotsFixture
1513+ } )
1514+
1515+ expect ( screen . queryByTestId ( 'modal' ) ) . not . toBeInTheDocument ( )
1516+
1517+ const plotActionsButton = within (
1518+ screen . getAllByTestId ( / ^ p l o t - / ) [ 0 ]
1519+ ) . getByLabelText ( 'See Plot Export Options' )
1520+
1521+ fireEvent . keyDown ( plotActionsButton , { key : 'Enter' } )
1522+
1523+ expect ( screen . getByTestId ( 'modal' ) ) . toBeInTheDocument ( )
1524+ await waitFor (
1525+ ( ) => {
1526+ expect ( screen . getByTitle ( 'Click to view actions' ) ) . toHaveAttribute (
1527+ 'open'
1528+ )
1529+ } ,
1530+ { timeout : 1000 }
1531+ )
1532+ } )
1533+
14811534 it ( 'should not open a modal with the plot zoomed in when clicking a comparison table plot' , ( ) => {
14821535 renderAppWithOptionalData ( {
14831536 comparison : comparisonTableFixture ,
@@ -1500,7 +1553,9 @@ describe('App', () => {
15001553 template : complexTemplatePlotsFixture
15011554 } )
15021555
1503- const plot = within ( screen . getAllByTestId ( / ^ p l o t _ / ) [ 0 ] ) . getByRole ( 'button' )
1556+ const plot = within ( screen . getAllByTestId ( / ^ p l o t _ / ) [ 0 ] ) . getByLabelText (
1557+ 'Open Plot in Popup'
1558+ )
15041559
15051560 fireEvent . click ( plot )
15061561 fireEvent . click ( screen . getByTestId ( 'modal' ) )
@@ -1518,7 +1573,9 @@ describe('App', () => {
15181573 template : complexTemplatePlotsFixture
15191574 } )
15201575
1521- const plot = within ( screen . getAllByTestId ( / ^ p l o t _ / ) [ 0 ] ) . getByRole ( 'button' )
1576+ const plot = within ( screen . getAllByTestId ( / ^ p l o t _ / ) [ 0 ] ) . getByLabelText (
1577+ 'Open Plot in Popup'
1578+ )
15221579
15231580 fireEvent . click ( plot )
15241581 fireEvent . click ( screen . getByTestId ( 'modal-content' ) )
@@ -1533,7 +1590,9 @@ describe('App', () => {
15331590
15341591 expect ( screen . queryByTestId ( 'modal' ) ) . not . toBeInTheDocument ( )
15351592
1536- const plot = within ( screen . getAllByTestId ( / ^ p l o t _ / ) [ 0 ] ) . getByRole ( 'button' )
1593+ const plot = within ( screen . getAllByTestId ( / ^ p l o t _ / ) [ 0 ] ) . getByLabelText (
1594+ 'Open Plot in Popup'
1595+ )
15371596
15381597 fireEvent . click ( plot )
15391598
@@ -1558,7 +1617,9 @@ describe('App', () => {
15581617
15591618 expect ( screen . queryByTestId ( 'modal' ) ) . not . toBeInTheDocument ( )
15601619
1561- const plot = within ( screen . getAllByTestId ( / ^ p l o t _ / ) [ 0 ] ) . getByRole ( 'button' )
1620+ const plot = within ( screen . getAllByTestId ( / ^ p l o t _ / ) [ 0 ] ) . getByLabelText (
1621+ 'Open Plot in Popup'
1622+ )
15621623
15631624 fireEvent . click ( plot )
15641625
@@ -1583,7 +1644,9 @@ describe('App', () => {
15831644
15841645 expect ( screen . queryByTestId ( 'modal' ) ) . not . toBeInTheDocument ( )
15851646
1586- const plot = within ( screen . getAllByTestId ( / ^ p l o t _ / ) [ 0 ] ) . getByRole ( 'button' )
1647+ const plot = within ( screen . getAllByTestId ( / ^ p l o t _ / ) [ 0 ] ) . getByLabelText (
1648+ 'Open Plot in Popup'
1649+ )
15871650
15881651 fireEvent . click ( plot )
15891652
@@ -2341,7 +2404,8 @@ describe('App', () => {
23412404
23422405 const smoothPlot = within (
23432406 screen . getByTestId ( `plot_${ smoothId } ` )
2344- ) . getByRole ( 'button' )
2407+ ) . getByLabelText ( 'Open Plot in Popup' )
2408+
23452409 fireEvent . click ( smoothPlot )
23462410
23472411 const popup = screen . getByTestId ( 'zoomed-in-plot' )
@@ -2382,7 +2446,8 @@ describe('App', () => {
23822446
23832447 const smoothPlot = within (
23842448 screen . getByTestId ( `plot_${ smoothId } ` )
2385- ) . getByRole ( 'button' )
2449+ ) . getByLabelText ( 'Open Plot in Popup' )
2450+
23862451 fireEvent . click ( smoothPlot )
23872452
23882453 const popup = screen . getByTestId ( 'zoomed-in-plot' )
0 commit comments