mirror of
https://github.com/ueberdosis/tiptap.git
synced 2024-12-24 17:47:50 +08:00
d3aeac4afa
* Fix TipTap getting loaded as CommonJS when the intent is to use the ES Module version. * `package.json` change also makes explicit exports required * Update `core` utilities exports to include all utilities * Update tests to use exported utilities
54 lines
1.0 KiB
TypeScript
54 lines
1.0 KiB
TypeScript
/// <reference types="cypress" />
|
|
|
|
import { fromString } from '@tiptap/core'
|
|
|
|
describe('fromString', () => {
|
|
it('should return a string', () => {
|
|
const value = fromString('test')
|
|
|
|
expect(value).to.eq('test')
|
|
})
|
|
|
|
it('should return an empty string', () => {
|
|
const value = fromString('')
|
|
|
|
expect(value).to.eq('')
|
|
})
|
|
|
|
it('should convert to a number', () => {
|
|
const value = fromString('1')
|
|
|
|
expect(value).to.eq(1)
|
|
})
|
|
|
|
it('should convert to a floating number', () => {
|
|
const value = fromString('1.2')
|
|
|
|
expect(value).to.eq(1.2)
|
|
})
|
|
|
|
it('should not convert to a number with exponent', () => {
|
|
const value = fromString('1e1')
|
|
|
|
expect(value).to.eq('1e1')
|
|
})
|
|
|
|
it('should convert to true', () => {
|
|
const value = fromString('true')
|
|
|
|
expect(value).to.eq(true)
|
|
})
|
|
|
|
it('should convert to false', () => {
|
|
const value = fromString('false')
|
|
|
|
expect(value).to.eq(false)
|
|
})
|
|
|
|
it('should return non-strings', () => {
|
|
const value = fromString(null)
|
|
|
|
expect(value).to.eq(null)
|
|
})
|
|
})
|