Skip to content

Commit

Permalink
feat: add test
Browse files Browse the repository at this point in the history
  • Loading branch information
yuantongkang authored Jun 22, 2022
1 parent fe76323 commit 1c4252a
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions tests/overflow.test.tsx
Original file line number Diff line number Diff line change
@@ -1,17 +1,16 @@
import React from 'react';
import type { ReactWrapper } from 'enzyme';
import { mount } from 'enzyme';
import KeyCode from 'rc-util/lib/KeyCode';
import { spyElementPrototypes } from 'rc-util/lib/test/domHook';
import { act } from 'react-dom/test-utils';
import { TabPane } from '../src';
import {
getOffsetSizeFunc,
getTabs,
triggerResize,
getTransformX,
getTransformY,
triggerResize,
} from './common/util';
import { TabPane } from '../src';

describe('Tabs.Overflow', () => {
let domSpy: ReturnType<typeof spyElementPrototypes>;
Expand Down Expand Up @@ -375,6 +374,12 @@ describe('Tabs.Overflow', () => {
expect(wrapper.find('.rc-tabs-dropdown-menu').first().text()).not.toContain('miu');
});

it('should support getPopupContainer', () => {
const getPopupContainer = trigger => trigger.parentNode;
const wrapper = mount(getTabs({ getPopupContainer }));
expect(wrapper.find('Trigger').first().props().getPopupContainer).toBe(getPopupContainer);
});

it('should support popupClassName', () => {
jest.useFakeTimers();
const wrapper = mount(getTabs({ popupClassName: 'custom-popup' }));
Expand Down

0 comments on commit 1c4252a

Please sign in to comment.