mirror of
https://gitee.com/ant-design/ant-design.git
synced 2024-12-16 01:41:02 +08:00
dd31d7775a
* test: migrate part of utils tests * test: migrate part of utils tests * test: migrate part of utils tests
15 lines
569 B
TypeScript
15 lines
569 B
TypeScript
import ResponsiveObserve, { responsiveMap } from '../responsiveObserve';
|
|
|
|
describe('Test ResponsiveObserve', () => {
|
|
it('test ResponsiveObserve subscribe and unsubscribe', () => {
|
|
const { xs } = responsiveMap;
|
|
const subscribeFunc = jest.fn();
|
|
const token = ResponsiveObserve.subscribe(subscribeFunc);
|
|
expect(ResponsiveObserve.matchHandlers[xs].mql.matches).toBeTruthy();
|
|
expect(subscribeFunc).toBeCalledTimes(1);
|
|
|
|
ResponsiveObserve.unsubscribe(token);
|
|
expect(ResponsiveObserve.matchHandlers[xs].mql.removeListener).toBeCalled();
|
|
});
|
|
});
|