|
@ -4,11 +4,26 @@ import PageHeader from '..'; |
|
|
import ConfigProvider from '../../config-provider'; |
|
|
import ConfigProvider from '../../config-provider'; |
|
|
import mountTest from '../../../tests/shared/mountTest'; |
|
|
import mountTest from '../../../tests/shared/mountTest'; |
|
|
import rtlTest from '../../../tests/shared/rtlTest'; |
|
|
import rtlTest from '../../../tests/shared/rtlTest'; |
|
|
|
|
|
import { spyElementPrototypes } from '../../__tests__/util/domHook'; |
|
|
|
|
|
|
|
|
describe('PageHeader', () => { |
|
|
describe('PageHeader', () => { |
|
|
mountTest(PageHeader); |
|
|
mountTest(PageHeader); |
|
|
rtlTest(PageHeader); |
|
|
rtlTest(PageHeader); |
|
|
|
|
|
|
|
|
|
|
|
let spy; |
|
|
|
|
|
|
|
|
|
|
|
beforeAll(() => { |
|
|
|
|
|
spy = spyElementPrototypes(HTMLElement, { |
|
|
|
|
|
getBoundingClientRect: () => ({ |
|
|
|
|
|
width: 100, |
|
|
|
|
|
}), |
|
|
|
|
|
}); |
|
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
afterAll(() => { |
|
|
|
|
|
spy.mockRestore(); |
|
|
|
|
|
}); |
|
|
|
|
|
|
|
|
it('pageHeader should not contain back it back', () => { |
|
|
it('pageHeader should not contain back it back', () => { |
|
|
const routes = [ |
|
|
const routes = [ |
|
|
{ |
|
|
{ |
|
@ -101,4 +116,11 @@ describe('PageHeader', () => { |
|
|
|
|
|
|
|
|
expect(render(wrapper)).toMatchSnapshot(); |
|
|
expect(render(wrapper)).toMatchSnapshot(); |
|
|
}); |
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
it('change container width', () => { |
|
|
|
|
|
const wrapper = mount(<PageHeader title="Page Title" extra="extra" />); |
|
|
|
|
|
wrapper.triggerResize(); |
|
|
|
|
|
wrapper.update(); |
|
|
|
|
|
expect(wrapper.find('.ant-page-header').hasClass('ant-page-header-compact')).toBe(true); |
|
|
|
|
|
}); |
|
|
}); |
|
|
}); |
|
|