test(utils): add naive's getTitleAttribute test (#856)

This commit is contained in:
XieZongChen 2021-08-12 09:43:43 -05:00 committed by GitHub
parent f1fa04f866
commit 4b2798c017
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1,5 +1,5 @@
import { createHoverColor, createPressedColor } from '../color'
import { formatLength } from '..'
import { formatLength, getTitleAttribute } from '..'
describe('color', () => {
it('should work with createHoverColor', () => {
@ -29,3 +29,13 @@ describe('css', () => {
expect(formatLength('3px', { offset: 4, c: 2 })).toBe('14px')
})
})
describe('naive', () => {
it('should work with getTitleAttribute', () => {
expect(getTitleAttribute(7)).toBe('7')
expect(getTitleAttribute('test')).toBe('test')
expect(getTitleAttribute([])).toBe(undefined)
expect(getTitleAttribute({})).toBe(undefined)
expect(getTitleAttribute(() => '')).toBe(undefined)
})
})