文件操作 - TimeSyncButton.test.tsx
返回文件管理
返回主菜单
删除本文件
文件: /usr/share/grafana/public/app/features/explore/TimeSyncButton.test.tsx
编辑文件内容
import React from 'react'; import { TimeSyncButton } from './TimeSyncButton'; import { mount } from 'enzyme'; const setup = (isSynced: boolean) => { const onClick = () => {}; return mount(<TimeSyncButton onClick={onClick} isSynced={isSynced} />); }; describe('TimeSyncButton', () => { it('should render component', () => { const wrapper = setup(true); expect(wrapper).toMatchSnapshot(); }); it('should change style when synced', () => { const wrapper = setup(true); expect(wrapper.find('button').props()['aria-label']).toEqual('Synced times'); }); it('should not change style when not synced', () => { const wrapper = setup(false); expect(wrapper.find('button').props()['aria-label']).toEqual('Unsynced times'); }); });
修改文件时间
将文件时间修改为当前时间的前一年
删除文件