test(35-03): add failing tests for codeeditor field

- Browser smoke: Tab leaves, Mod+S/Mod+Enter save, Esc does not cancel
- Happy-dom: loading box, read-only pre, chunk-failure textarea fallback
- Stub field/editor so imports resolve; assertions fail until GREEN

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
2026-11-13 13:24:19 +01:00
parent ee0bbc27f8
commit 7e2c01172f
4 changed files with 269 additions and 0 deletions

View File

@@ -0,0 +1,21 @@
// Stub for TDD RED (35-03 Task 4): real CodeMirror factory lands in GREEN.
export interface CodeEditorOptions {
parent: HTMLElement
doc: string
language: 'html' | 'css' | 'text'
height: number
attributes: Record<string, string>
onChange: (doc: string) => void
}
export interface CodeEditorHandle {
view: unknown
insert(text: string): void
destroy(): void
setDoc(doc: string): void
}
/** Builds the field's CodeMirror editor on options.parent. */
export function createCodeEditor(_options: CodeEditorOptions): CodeEditorHandle {
throw new Error('codeeditor not implemented')
}

View File

@@ -0,0 +1,13 @@
<script setup lang="ts">
// Stub for TDD RED (35-03 Task 4): loading, lazy CodeMirror, fallback and
// read-only rendering land in GREEN. Emits nothing and shows an empty box so
// the planned behavior assertions fail intentionally.
import type { FieldControlProps } from '../control'
defineProps<FieldControlProps>()
defineEmits<{ 'update:modelValue': [value: string] }>()
</script>
<template>
<div data-codeeditor-stub class="rounded-control border border-border bg-surface" />
</template>