文件操作 - RichHistoryContainer.test.tsx
返回文件管理
返回主菜单
删除本文件
文件: /usr/share/grafana/public/app/features/explore/RichHistory/RichHistoryContainer.test.tsx
编辑文件内容
import React from 'react'; import { mount } from 'enzyme'; import { Resizable } from 're-resizable'; import { ExploreId } from '../../../types/explore'; import { RichHistoryContainer, Props } from './RichHistoryContainer'; import { Tabs } from './RichHistory'; jest.mock('../state/selectors', () => ({ getExploreDatasources: jest.fn() })); const setup = (propOverrides?: Partial<Props>) => { const props: Props = { width: 500, exploreId: ExploreId.left, activeDatasourceInstance: 'Test datasource', richHistory: [], firstTab: Tabs.RichHistory, deleteRichHistory: jest.fn(), onClose: jest.fn(), }; Object.assign(props, propOverrides); const wrapper = mount(<RichHistoryContainer {...props} />); return wrapper; }; describe('RichHistoryContainer', () => { it('should render reseizable component', () => { const wrapper = setup(); expect(wrapper.find(Resizable)).toHaveLength(1); }); it('should render component with correct width', () => { const wrapper = setup(); expect(wrapper.getDOMNode().getAttribute('style')).toContain('width: 531.5px'); }); it('should render component with correct height', () => { const wrapper = setup(); expect(wrapper.getDOMNode().getAttribute('style')).toContain('height: 400px'); }); });
修改文件时间
将文件时间修改为当前时间的前一年
删除文件