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:
21
admin/src/components/form/codeeditor/editor.ts
Normal file
21
admin/src/components/form/codeeditor/editor.ts
Normal 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')
|
||||
}
|
||||
13
admin/src/components/form/fields/CodeEditorField.vue
Normal file
13
admin/src/components/form/fields/CodeEditorField.vue
Normal 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>
|
||||
Reference in New Issue
Block a user