文件操作 - multiOptions.test.ts
返回文件管理
返回主菜单
删除本文件
文件: /usr/share/grafana/public/app/features/variables/shared/multiOptions.test.ts
编辑文件内容
import { VariableOption } from 'app/features/variables/types'; import { alignCurrentWithMulti } from './multiOptions'; describe('alignCurrentWithMulti', () => { describe('when current has string array values and multi is false', () => { it('should return current without string arrays', () => { const current: VariableOption = { value: ['A'], text: ['A'], selected: false, }; const next = alignCurrentWithMulti(current, false); expect(next).toEqual({ value: 'A', text: 'A', selected: false, }); }); }); describe('when current has string values and multi is true', () => { it('should return current with string arrays', () => { const current: VariableOption = { value: 'A', text: 'A', selected: false, }; const next = alignCurrentWithMulti(current, true); expect(next).toEqual({ value: ['A'], text: ['A'], selected: false, }); }); }); describe('when current has string values and multi is false', () => { it('should return current without string arrays', () => { const current: VariableOption = { value: 'A', text: 'A', selected: false, }; const next = alignCurrentWithMulti(current, false); expect(next).toEqual({ value: 'A', text: 'A', selected: false, }); }); }); describe('when current has string array values and multi is true', () => { it('should return current with string arrays', () => { const current: VariableOption = { value: ['A'], text: ['A'], selected: false, }; const next = alignCurrentWithMulti(current, true); expect(next).toEqual({ value: ['A'], text: ['A'], selected: false, }); }); }); });
修改文件时间
将文件时间修改为当前时间的前一年
删除文件