about summary refs log tree commit diff
path: root/app/javascript/mastodon/features/ui/components/__tests__/column-test.js
diff options
context:
space:
mode:
authorYamagishi Kazutoshi <ykzts@desire.sh>2020-06-29 20:58:07 +0900
committerGitHub <noreply@github.com>2020-06-29 13:58:07 +0200
commit5e8f51b29fccfb7d19d53854f3472f7370593ebf (patch)
treeb075c743ca0c725bb8dda37c8d02122e0f11d571 /app/javascript/mastodon/features/ui/components/__tests__/column-test.js
parentd1c6dd2d277fee0cf65b480adc868c69df952622 (diff)
Replace to testing-library from enzyme (#14152)
Diffstat (limited to 'app/javascript/mastodon/features/ui/components/__tests__/column-test.js')
-rw-r--r--app/javascript/mastodon/features/ui/components/__tests__/column-test.js15
1 files changed, 7 insertions, 8 deletions
diff --git a/app/javascript/mastodon/features/ui/components/__tests__/column-test.js b/app/javascript/mastodon/features/ui/components/__tests__/column-test.js
index d2791ce08..a56859be0 100644
--- a/app/javascript/mastodon/features/ui/components/__tests__/column-test.js
+++ b/app/javascript/mastodon/features/ui/components/__tests__/column-test.js
@@ -1,25 +1,24 @@
+import { render, fireEvent, screen } from '@testing-library/react';
 import React from 'react';
-import { mount } from 'enzyme';
 import Column from '../column';
-import ColumnHeader from '../column_header';
 
 describe('<Column />', () => {
   describe('<ColumnHeader /> click handler', () => {
     it('runs the scroll animation if the column contains scrollable content', () => {
-      const wrapper = mount(
+      const scrollToMock = jest.fn();
+      const { container } = render(
         <Column heading='notifications'>
           <div className='scrollable' />
         </Column>,
       );
-      const scrollToMock = jest.fn();
-      wrapper.find(Column).find('.scrollable').getDOMNode().scrollTo = scrollToMock;
-      wrapper.find(ColumnHeader).find('button').simulate('click');
+      container.querySelector('.scrollable').scrollTo = scrollToMock;
+      fireEvent.click(screen.getByText('notifications'));
       expect(scrollToMock).toHaveBeenCalledWith({ behavior: 'smooth', top: 0 });
     });
 
     it('does not try to scroll if there is no scrollable content', () => {
-      const wrapper = mount(<Column heading='notifications' />);
-      wrapper.find(ColumnHeader).find('button').simulate('click');
+      render(<Column heading='notifications' />);
+      fireEvent.click(screen.getByText('notifications'));
     });
   });
 });