@@ -1939,6 +1939,12 @@ describe('App', () => {
19391939 describe ( 'Title truncation' , ( ) => {
19401940 const longTitle =
19411941 'we-need-a-very-very-very-long-title-to-test-with-many-many-many-characters-at-least-seventy-characters'
1942+ const longAxisTitleHorizontal = `${ longTitle } -x`
1943+ const longAxisTitleVertical = `${ longTitle } -y`
1944+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
1945+ const layers = ( templatePlotsFixture . plots [ 0 ] . entries [ 0 ] . content as any )
1946+ . layer
1947+
19421948 const withLongTemplatePlotTitle = ( title : Text | Title = longTitle ) => ( {
19431949 ...templatePlotsFixture ,
19441950 plots : [
@@ -1949,6 +1955,23 @@ describe('App', () => {
19491955 ...templatePlotsFixture . plots [ 0 ] . entries [ 0 ] ,
19501956 content : {
19511957 ...templatePlotsFixture . plots [ 0 ] . entries [ 0 ] . content ,
1958+ layer : [
1959+ {
1960+ ...layers [ 0 ] ,
1961+ encoding : {
1962+ ...layers [ 0 ] . encoding ,
1963+ x : {
1964+ ...layers [ 0 ] . encoding . x ,
1965+ title : longAxisTitleHorizontal
1966+ } ,
1967+ y : {
1968+ ...layers [ 0 ] . encoding . y ,
1969+ title : longAxisTitleVertical
1970+ }
1971+ }
1972+ } ,
1973+ ...layers . slice ( 1 )
1974+ ] ,
19521975 title
19531976 } ,
19541977 id : longTitle
@@ -1958,27 +1981,37 @@ describe('App', () => {
19581981 } as TemplatePlotSection
19591982 ]
19601983 } )
1961- it ( 'should truncate the title of the plot from the left to 50 characters for large plots' , async ( ) => {
1984+ it ( 'should truncate all titles from the left to 50 characters for large plots' , async ( ) => {
19621985 await renderAppAndChangeSize (
19631986 {
19641987 template : withLongTemplatePlotTitle ( )
19651988 } ,
19661989 'Large' ,
19671990 Section . TEMPLATE_PLOTS
19681991 )
1992+
19691993 const longTitlePlot = screen . getByTestId ( `plot_${ longTitle } ` )
19701994
19711995 await waitForVega ( longTitlePlot )
19721996
19731997 const truncatedTitle =
19741998 '…-many-many-characters-at-least-seventy-characters'
1999+ const truncatedHorizontalTitle =
2000+ '…any-many-characters-at-least-seventy-characters-x'
2001+ const truncatedVerticalTitle = '…racters-at-least-seventy-characters-y'
19752002
19762003 expect (
19772004 within ( longTitlePlot ) . getByText ( truncatedTitle )
19782005 ) . toBeInTheDocument ( )
2006+ expect (
2007+ within ( longTitlePlot ) . getByText ( truncatedHorizontalTitle )
2008+ ) . toBeInTheDocument ( )
2009+ expect (
2010+ within ( longTitlePlot ) . getByText ( truncatedVerticalTitle )
2011+ ) . toBeInTheDocument ( )
19792012 } )
19802013
1981- it ( 'should truncate the title of the plot from the left to 50 characters for regular plots' , async ( ) => {
2014+ it ( 'should truncate all titles from the left to 50 characters for regular plots' , async ( ) => {
19822015 await renderAppAndChangeSize (
19832016 {
19842017 template : withLongTemplatePlotTitle ( )
@@ -1991,13 +2024,22 @@ describe('App', () => {
19912024 await waitForVega ( longTitlePlot )
19922025 const truncatedTitle =
19932026 '…-many-many-characters-at-least-seventy-characters'
2027+ const truncatedHorizontalTitle =
2028+ '…any-many-characters-at-least-seventy-characters-x'
2029+ const truncatedVerticalTitle = '…racters-at-least-seventy-characters-y'
19942030
19952031 expect (
19962032 within ( longTitlePlot ) . getByText ( truncatedTitle )
19972033 ) . toBeInTheDocument ( )
2034+ expect (
2035+ within ( longTitlePlot ) . getByText ( truncatedHorizontalTitle )
2036+ ) . toBeInTheDocument ( )
2037+ expect (
2038+ within ( longTitlePlot ) . getByText ( truncatedVerticalTitle )
2039+ ) . toBeInTheDocument ( )
19982040 } )
19992041
2000- it ( 'should truncate the title of the plot from the left to 30 characters for large plots' , async ( ) => {
2042+ it ( 'should truncate all titles from the left to 30 characters for large plots' , async ( ) => {
20012043 await renderAppAndChangeSize (
20022044 {
20032045 template : withLongTemplatePlotTitle ( )
@@ -2009,10 +2051,18 @@ describe('App', () => {
20092051
20102052 await waitForVega ( longTitlePlot )
20112053 const truncatedTitle = '…s-at-least-seventy-characters'
2054+ const truncatedHorizontalTitle = '…at-least-seventy-characters-x'
2055+ const truncatedVerticalTitle = '…t-seventy-characters-y'
20122056
20132057 expect (
20142058 within ( longTitlePlot ) . getByText ( truncatedTitle )
20152059 ) . toBeInTheDocument ( )
2060+ expect (
2061+ within ( longTitlePlot ) . getByText ( truncatedHorizontalTitle )
2062+ ) . toBeInTheDocument ( )
2063+ expect (
2064+ within ( longTitlePlot ) . getByText ( truncatedVerticalTitle )
2065+ ) . toBeInTheDocument ( )
20162066 } )
20172067
20182068 it ( 'should truncate the title and the subtitle' , async ( ) => {
0 commit comments