File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -67,3 +67,13 @@ test('should render the items', async () => {
6767 expect ( await screen . findByText ( 'English' ) ) . toBeInTheDocument ( ) ;
6868 expect ( await screen . findByText ( 'Italian' ) ) . toBeInTheDocument ( ) ;
6969} ) ;
70+
71+ test ( 'renders the down-chevron caret icon, not the caret glyph (regression #43531)' , async ( ) => {
72+ render ( < TestLanguagePicker { ...mockedProps } /> , {
73+ useRouter : true ,
74+ } ) ;
75+ const menuItem = await screen . findByRole ( 'menuitem' ) ;
76+ const caret = menuItem . querySelector ( '.ant-menu-item-icon' ) ;
77+ expect ( caret ) . toHaveClass ( 'anticon-down' ) ;
78+ expect ( caret ?. querySelector ( 'svg' ) ) . toHaveAttribute ( 'data-icon' , 'down' ) ;
79+ } ) ;
Original file line number Diff line number Diff line change @@ -387,6 +387,20 @@ test('should render all the top navbar menu items', async () => {
387387 } ) ;
388388} ) ;
389389
390+ test ( 'renders the down-chevron caret icon on top-level category dropdowns, not the caret glyph (regression #43531)' , async ( ) => {
391+ useSelectorMock . mockReturnValue ( { roles : user . roles } ) ;
392+ render ( < Menu { ...mockedProps } /> , {
393+ useRedux : true ,
394+ useQueryParams : true ,
395+ useRouter : true ,
396+ useTheme : true ,
397+ } ) ;
398+ const sources = await screen . findByText ( 'Sources' ) ;
399+ const caret = sources . closest ( 'li' ) ?. querySelector ( '.ant-menu-item-icon' ) ;
400+ expect ( caret ) . toHaveClass ( 'anticon-down' ) ;
401+ expect ( caret ?. querySelector ( 'svg' ) ) . toHaveAttribute ( 'data-icon' , 'down' ) ;
402+ } ) ;
403+
390404test ( 'should render the top navbar child menu items' , async ( ) => {
391405 useSelectorMock . mockReturnValue ( { roles : user . roles } ) ;
392406 const {
Original file line number Diff line number Diff line change @@ -384,6 +384,34 @@ test('If there is NOT a DB with allow_file_upload set as True the option should
384384 ) ;
385385} ) ;
386386
387+ test ( 'renders the down-chevron caret icon on the "+" and Settings dropdowns, not the caret glyph (regression #43531)' , async ( ) => {
388+ const mockedProps = createProps ( ) ;
389+ resetUseSelectorMock ( ) ;
390+ render ( < RightMenu { ...mockedProps } /> , {
391+ useRedux : true ,
392+ useQueryParams : true ,
393+ useRouter : true ,
394+ useTheme : true ,
395+ } ) ;
396+
397+ const newDropdownIcon = screen . getByTestId ( 'new-dropdown-icon' ) ;
398+ const newCaret = newDropdownIcon
399+ . closest ( 'li' )
400+ ?. querySelector ( '.ant-menu-item-icon' ) ;
401+ expect ( newCaret ) . toHaveClass ( 'anticon-down' ) ;
402+ expect ( newCaret ?. querySelector ( 'svg' ) ) . toHaveAttribute ( 'data-icon' , 'down' ) ;
403+
404+ const settings = await screen . findByText ( / S e t t i n g s / i) ;
405+ const settingsCaret = settings
406+ . closest ( 'li' )
407+ ?. querySelector ( '.ant-menu-item-icon' ) ;
408+ expect ( settingsCaret ) . toHaveClass ( 'anticon-down' ) ;
409+ expect ( settingsCaret ?. querySelector ( 'svg' ) ) . toHaveAttribute (
410+ 'data-icon' ,
411+ 'down' ,
412+ ) ;
413+ } ) ;
414+
387415test ( 'Logs out and clears local storage item redux' , async ( ) => {
388416 const mockedProps = createProps ( ) ;
389417 resetUseSelectorMock ( ) ;
Original file line number Diff line number Diff line change @@ -271,4 +271,14 @@ describe('useThemeMenuItems', () => {
271271
272272 expect ( divider ) . toBeNull ( ) ;
273273 } ) ;
274+
275+ test ( 'renders the down-chevron caret icon, not the caret glyph (regression #43531)' , async ( ) => {
276+ renderThemeMenu ( ) ;
277+
278+ const menuItem = await screen . findByRole ( 'menuitem' ) ;
279+ const caret = menuItem . querySelector ( '.ant-menu-item-icon' ) ;
280+
281+ expect ( caret ) . toHaveClass ( 'anticon-down' ) ;
282+ expect ( caret ?. querySelector ( 'svg' ) ) . toHaveAttribute ( 'data-icon' , 'down' ) ;
283+ } ) ;
274284} ) ;
You can’t perform that action at this time.
0 commit comments