test(utils): add css test (#848)

This commit is contained in:
XieZongChen 2021-08-11 18:32:13 -05:00 committed by GitHub
parent 71ec0cb47a
commit f1fa04f866
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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')
})
})