Files
backend/admin-web/src/components/Ellipsis/index.test.js
2019-02-27 11:06:55 +08:00

14 lines
437 B
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
import { getStrFullLength, cutStrByFullLength } from './index';
describe('test calculateShowLength', () => {
it('get full length', () => {
expect(getStrFullLength('一二a,')).toEqual(8);
});
it('cut str by full length', () => {
expect(cutStrByFullLength('一二a,', 7)).toEqual('一二a');
});
it('cut str when length small', () => {
expect(cutStrByFullLength('一22三', 5)).toEqual('一22');
});
});