11e1b3ca3b
CI / docker (push) Failing after 11s
包含 JSON 格式化、文本/JSON 对比、编解码、变量名转换、二维码、时间戳与颜色转换等工具;修复编辑器行号同步;补充 Vitest 单元测试、Docker 部署与 Gitea CI;完善开源文档;支持通过环境变量配置站点标题、备案号及第三方集成。 Co-authored-by: Cursor <cursoragent@cursor.com>
20 lines
587 B
JavaScript
20 lines
587 B
JavaScript
import { describe, it, expect } from 'vitest'
|
|
import { countLines } from '../../src/composables/useLineNumberEditor.js'
|
|
|
|
describe('useLineNumberEditor.countLines', () => {
|
|
it('returns 1 for empty or whitespace-only text', () => {
|
|
expect(countLines('')).toBe(1)
|
|
expect(countLines(null)).toBe(1)
|
|
expect(countLines(undefined)).toBe(1)
|
|
})
|
|
|
|
it('counts single line without trailing newline', () => {
|
|
expect(countLines('hello')).toBe(1)
|
|
})
|
|
|
|
it('counts multiple lines', () => {
|
|
expect(countLines('a\nb\nc')).toBe(3)
|
|
expect(countLines('a\nb\n')).toBe(3)
|
|
})
|
|
})
|