From f1fa04f866a668b7800814069a0bcf03776d3189 Mon Sep 17 00:00:00 2001 From: XieZongChen <46394163+amadeus711@users.noreply.github.com> Date: Wed, 11 Aug 2021 18:32:13 -0500 Subject: [PATCH] test(utils): add css test (#848) --- src/_utils/tests/Utils.spec.ts | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/src/_utils/tests/Utils.spec.ts b/src/_utils/tests/Utils.spec.ts index bdf44fb6a..546498147 100644 --- a/src/_utils/tests/Utils.spec.ts +++ b/src/_utils/tests/Utils.spec.ts @@ -1,5 +1,5 @@ -// import { mount } from '@vue/test-utils' import { createHoverColor, createPressedColor } from '../color' +import { formatLength } from '..' describe('color', () => { it('should work with createHoverColor', () => { @@ -14,3 +14,18 @@ describe('color', () => { ) }) }) + +describe('css', () => { + it('should work with formatLength', () => { + expect(formatLength(7)).toBe('7px') + expect(formatLength(2, { offset: 3 })).toBe('5px') + expect(formatLength(3, { offset: 4, c: 2 })).toBe('14px') + expect(formatLength('3')).toBe('3px') + expect(formatLength('3', { attachPx: false })).toBe('3') + expect(formatLength('2', { offset: 3 })).toBe('5px') + expect(formatLength('3', { offset: 4, c: 2 })).toBe('14px') + expect(formatLength('4px')).toBe('4px') + expect(formatLength('2px', { offset: 3 })).toBe('5px') + expect(formatLength('3px', { offset: 4, c: 2 })).toBe('14px') + }) +})