@airalogy/aimd-editor 1.12.0 → 1.13.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +24 -0
- package/README.zh-CN.md +24 -0
- package/dist/AimdEditorTopBar.vue_vue_type_script_setup_true_lang-x8F65dCh.js +2277 -0
- package/dist/{AimdSourceEditor.vue_vue_type_script_setup_true_lang-CJJTlVZ7.js → AimdSourceEditor.vue_vue_type_script_setup_true_lang-m07PHAyw.js} +29 -27
- package/dist/{AimdWysiwygEditor.vue_vue_type_script_setup_true_lang-Dme3UQEf.js → AimdWysiwygEditor.vue_vue_type_script_setup_true_lang-8nbo78nG.js} +6118 -5822
- package/dist/aimd-editor.css +1 -1
- package/dist/authoring.js +15 -8
- package/dist/embedded.js +2 -2
- package/dist/fields-DZsN-S-N.js +51 -0
- package/dist/fig-DzERhLmG.js +219 -0
- package/dist/index.js +54 -45
- package/dist/{index-BqB8Xukp.js → lexer-Dj-IVtCT.js} +932 -1053
- package/dist/vue.js +28 -26
- package/dist/wysiwyg.js +1 -1
- package/package.json +4 -3
- package/src/__tests__/check-authoring.test.ts +46 -0
- package/src/__tests__/code-block-metadata.test.ts +40 -0
- package/src/__tests__/input-authoring.test.ts +93 -0
- package/src/__tests__/input-dialog-layout.test.ts +52 -0
- package/src/__tests__/input-toolbar.test.ts +88 -0
- package/src/__tests__/multiline-field-roundtrip.test.ts +70 -0
- package/src/__tests__/quoted-inline-roundtrip.test.ts +80 -0
- package/src/__tests__/step-authoring.test.ts +62 -0
- package/src/__tests__/type-picker.test.ts +48 -0
- package/src/authoring/fields.ts +86 -0
- package/src/authoring/index.ts +1 -0
- package/src/vue/AimdEditor.vue +112 -0
- package/src/vue/AimdEditorToolbar.vue +4 -1
- package/src/vue/AimdFieldDialog.vue +14 -9
- package/src/vue/AimdInputFieldDialog.vue +166 -0
- package/src/vue/AimdInputToolbar.vue +77 -0
- package/src/vue/AimdStepFieldDialog.vue +112 -0
- package/src/vue/AimdTypePicker.vue +42 -0
- package/src/vue/AimdWysiwygEditor.vue +24 -2
- package/src/vue/aimdInlineMarkdownNormalization.ts +37 -5
- package/src/vue/index.ts +2 -0
- package/src/vue/locales.ts +94 -7
- package/src/vue/milkdown-aimd-plugin.ts +148 -16
- package/src/vue/milkdown-code-block-metadata.ts +46 -0
- package/src/vue/types.ts +6 -4
- package/dist/AimdEditorTopBar.vue_vue_type_script_setup_true_lang-BXsn4cFX.js +0 -1171
package/dist/vue.js
CHANGED
|
@@ -1,30 +1,32 @@
|
|
|
1
|
-
import { _ as
|
|
2
|
-
import { _ as
|
|
3
|
-
import { A as
|
|
1
|
+
import { _ as d, a as e, b as s, c as o, A as r, d as t, u as m } from "./AimdEditorTopBar.vue_vue_type_script_setup_true_lang-x8F65dCh.js";
|
|
2
|
+
import { _ as l } from "./AimdSourceEditor.vue_vue_type_script_setup_true_lang-m07PHAyw.js";
|
|
3
|
+
import { A as I, a as D, _, D as T, M as F, b as u, c as M, d as g, e as n, f as c, g as p, h as L, i as O, j as S, k as y, l as b, m as f, n as x, r as N } from "./AimdWysiwygEditor.vue_vue_type_script_setup_true_lang-8nbo78nG.js";
|
|
4
4
|
export {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
5
|
+
I as AIMD_FIELD_TYPES,
|
|
6
|
+
D as AIMD_FIELD_TYPE_DEFINITIONS,
|
|
7
|
+
d as AimdEditor,
|
|
8
|
+
e as AimdEditorToolbar,
|
|
9
9
|
s as AimdEditorTopBar,
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
F as
|
|
17
|
-
|
|
18
|
-
|
|
10
|
+
o as AimdFieldDialog,
|
|
11
|
+
r as AimdInputFieldDialog,
|
|
12
|
+
l as AimdSourceEditor,
|
|
13
|
+
t as AimdStepFieldDialog,
|
|
14
|
+
_ as AimdWysiwygEditor,
|
|
15
|
+
T as DEFAULT_AIMD_EDITOR_LOCALE,
|
|
16
|
+
F as MD_TOOLBAR_ITEMS,
|
|
17
|
+
u as MD_TOOLBAR_ITEM_DEFINITIONS,
|
|
18
|
+
M as aimdFieldInputRule,
|
|
19
|
+
g as aimdFieldNode,
|
|
20
|
+
n as aimdFieldView,
|
|
19
21
|
c as aimdMilkdownPlugins,
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
22
|
+
p as aimdRemarkPlugin,
|
|
23
|
+
L as buildAimdSyntax,
|
|
24
|
+
O as createAimdEditorMessages,
|
|
25
|
+
S as createAimdFieldTypes,
|
|
26
|
+
y as createAimdVarTypePresets,
|
|
27
|
+
b as createMdToolbarItems,
|
|
28
|
+
f as getDefaultAimdFields,
|
|
29
|
+
x as getQuickAimdSyntax,
|
|
30
|
+
N as resolveAimdEditorLocale,
|
|
31
|
+
m as useEditorContent
|
|
30
32
|
};
|
package/dist/wysiwyg.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { _ as a, D as r, i, j as d, k as t, r as A } from "./AimdWysiwygEditor.vue_vue_type_script_setup_true_lang-
|
|
1
|
+
import { _ as a, D as r, i, j as d, k as t, r as A } from "./AimdWysiwygEditor.vue_vue_type_script_setup_true_lang-8nbo78nG.js";
|
|
2
2
|
export {
|
|
3
3
|
a as AimdWysiwygEditor,
|
|
4
4
|
r as DEFAULT_AIMD_EDITOR_LOCALE,
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@airalogy/aimd-editor",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "1.
|
|
4
|
+
"version": "1.13.1",
|
|
5
5
|
"description": "AIMD (Airalogy Markdown) editor with Monaco source mode and Milkdown WYSIWYG mode",
|
|
6
6
|
"license": "Apache-2.0",
|
|
7
7
|
"repository": {
|
|
@@ -60,11 +60,12 @@
|
|
|
60
60
|
"dependencies": {
|
|
61
61
|
"@codingame/monaco-vscode-editor-api": "^20.2.1",
|
|
62
62
|
"@codingame/monaco-vscode-standalone-languages": "^20.2.1",
|
|
63
|
+
"@lucide/vue": "^1.62.0",
|
|
63
64
|
"@milkdown/kit": "^7.18.0",
|
|
64
65
|
"@milkdown/theme-nord": "^7.18.0",
|
|
65
66
|
"@milkdown/vue": "^7.18.0",
|
|
66
|
-
"@airalogy/aimd-core": "^2.
|
|
67
|
-
"@airalogy/aimd-renderer": "^2.
|
|
67
|
+
"@airalogy/aimd-core": "^2.18.0",
|
|
68
|
+
"@airalogy/aimd-renderer": "^2.14.0"
|
|
68
69
|
},
|
|
69
70
|
"peerDependencies": {
|
|
70
71
|
"monaco-editor": ">=0.50.0",
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { afterEach, describe, expect, it } from 'vitest'
|
|
2
|
+
import { flushPromises, mount, type VueWrapper } from '@vue/test-utils'
|
|
3
|
+
import { parseCheckContent } from '@airalogy/aimd-core/parser'
|
|
4
|
+
import { updateAimdCheckField } from '../authoring/fields'
|
|
5
|
+
import AimdStepFieldDialog from '../vue/AimdStepFieldDialog.vue'
|
|
6
|
+
import { createAimdEditorMessages } from '../vue/locales'
|
|
7
|
+
import { buildAimdSyntax } from '../vue/types'
|
|
8
|
+
|
|
9
|
+
const messages = createAimdEditorMessages('en-US')
|
|
10
|
+
const wrappers: VueWrapper[] = []
|
|
11
|
+
afterEach(() => wrappers.splice(0).forEach(wrapper => wrapper.unmount()))
|
|
12
|
+
|
|
13
|
+
async function openDialog(fieldContent?: string) {
|
|
14
|
+
const wrapper = mount(AimdStepFieldDialog, { props: { visible: false, fieldType: 'check', content: '{{check|check_1}}', fieldContent, messages, reservedIds: ['check_2'] }, global: { stubs: { teleport: true } } })
|
|
15
|
+
wrappers.push(wrapper)
|
|
16
|
+
await wrapper.setProps({ visible: true })
|
|
17
|
+
await flushPromises()
|
|
18
|
+
return wrapper
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
describe('checkpoint authoring', () => {
|
|
22
|
+
it('generates a unique ID and saves a quoted optional title without step controls', async () => {
|
|
23
|
+
const wrapper = await openDialog()
|
|
24
|
+
expect(wrapper.find('select[name="timer"]').exists()).toBe(false)
|
|
25
|
+
expect(wrapper.get('details').attributes('open')).toBeUndefined()
|
|
26
|
+
await wrapper.get('input[name="title"]').setValue('防护检查, confirm "PPE"')
|
|
27
|
+
await wrapper.get('form').trigger('submit')
|
|
28
|
+
expect(parseCheckContent(wrapper.emitted('save')![0][0] as string)).toMatchObject({ id: 'check_3', title: '防护检查, confirm "PPE"' })
|
|
29
|
+
})
|
|
30
|
+
|
|
31
|
+
it('edits a title without renaming the record key or dropping the checked message', async () => {
|
|
32
|
+
const wrapper = await openDialog('safety_ready, title="Old", checked_message="Confirmed"')
|
|
33
|
+
expect(wrapper.get('input[name="id"]').attributes('readonly')).toBeDefined()
|
|
34
|
+
await wrapper.get('input[name="title"]').setValue('New')
|
|
35
|
+
await wrapper.get('form').trigger('submit')
|
|
36
|
+
expect(parseCheckContent(wrapper.emitted('save')![0][0] as string)).toMatchObject({ id: 'safety_ready', title: 'New', checked_message: 'Confirmed' })
|
|
37
|
+
})
|
|
38
|
+
|
|
39
|
+
it('allows a title-free checkpoint and clearing an existing title', async () => {
|
|
40
|
+
const wrapper = await openDialog()
|
|
41
|
+
await wrapper.get('form').trigger('submit')
|
|
42
|
+
expect(wrapper.emitted('save')![0][0]).toBe('check_3')
|
|
43
|
+
expect(updateAimdCheckField('safety_ready, title="Old"', { id: 'not_renamed', title: '', checkedMessage: '' })).toBe('safety_ready')
|
|
44
|
+
expect(buildAimdSyntax('check', { name: 'safe', title: 'Check "PPE"' })).toBe('{{check|safe, title="Check \\"PPE\\""}}')
|
|
45
|
+
})
|
|
46
|
+
})
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { afterEach, expect, it } from 'vitest'
|
|
2
|
+
import { Editor, defaultValueCtx, editorViewCtx, rootCtx } from '@milkdown/kit/core'
|
|
3
|
+
import { commonmark } from '@milkdown/kit/preset/commonmark'
|
|
4
|
+
import { DOMParser, DOMSerializer } from '@milkdown/kit/prose/model'
|
|
5
|
+
import { getMarkdown, replaceAll } from '@milkdown/kit/utils'
|
|
6
|
+
import { codeBlockMetadataSchema } from '../vue/milkdown-code-block-metadata'
|
|
7
|
+
|
|
8
|
+
const editors: Editor[] = []
|
|
9
|
+
afterEach(async () => {
|
|
10
|
+
for (const editor of editors.splice(0)) await editor.destroy()
|
|
11
|
+
document.body.replaceChildren()
|
|
12
|
+
})
|
|
13
|
+
|
|
14
|
+
it.each([
|
|
15
|
+
['assigner runtime=client', 'runtime=client'],
|
|
16
|
+
['python title="original.py" linenos', 'title="original.py" linenos'],
|
|
17
|
+
['fig', ''],
|
|
18
|
+
['', ''],
|
|
19
|
+
])('preserves fence information %s through visual edits and DOM copies', async (info, meta) => {
|
|
20
|
+
const original = `\`\`\`${info}\nvalue = 1\n\`\`\``
|
|
21
|
+
const root = document.createElement('div')
|
|
22
|
+
document.body.append(root)
|
|
23
|
+
const editor = await Editor.make().config(ctx => {
|
|
24
|
+
ctx.set(rootCtx, root)
|
|
25
|
+
ctx.set(defaultValueCtx, original)
|
|
26
|
+
}).use(commonmark).use(codeBlockMetadataSchema).create()
|
|
27
|
+
editors.push(editor)
|
|
28
|
+
for (let i = 0; i < 3; i++) {
|
|
29
|
+
expect(editor.action(getMarkdown()).trim()).toBe(original)
|
|
30
|
+
editor.action(replaceAll(editor.action(getMarkdown())))
|
|
31
|
+
}
|
|
32
|
+
editor.action(ctx => {
|
|
33
|
+
const view = ctx.get(editorViewCtx)
|
|
34
|
+
const holder = document.createElement('div')
|
|
35
|
+
holder.append(DOMSerializer.fromSchema(view.state.schema).serializeFragment(view.state.doc.content))
|
|
36
|
+
const copied = DOMParser.fromSchema(view.state.schema).parse(holder)
|
|
37
|
+
expect(copied.firstChild?.attrs.meta).toBe(meta)
|
|
38
|
+
expect(copied.firstChild?.textContent).toBe('value = 1')
|
|
39
|
+
})
|
|
40
|
+
})
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
import { afterEach, describe, expect, it } from 'vitest'
|
|
2
|
+
import { flushPromises, mount, type VueWrapper } from '@vue/test-utils'
|
|
3
|
+
import { parseVarDefinition } from '@airalogy/aimd-core/parser'
|
|
4
|
+
import { collectAimdFieldIds, createAimdFieldId, updateAimdInputField } from '../authoring/fields'
|
|
5
|
+
import AimdInputFieldDialog from '../vue/AimdInputFieldDialog.vue'
|
|
6
|
+
import { createAimdEditorMessages } from '../vue/locales'
|
|
7
|
+
|
|
8
|
+
const messages = createAimdEditorMessages('en-US')
|
|
9
|
+
const wrappers: VueWrapper[] = []
|
|
10
|
+
afterEach(() => wrappers.splice(0).forEach(wrapper => wrapper.unmount()))
|
|
11
|
+
|
|
12
|
+
async function openDialog(content = '', fieldContent?: string) {
|
|
13
|
+
const wrapper = mount(AimdInputFieldDialog, {
|
|
14
|
+
props: { visible: false, content, fieldContent, messages },
|
|
15
|
+
global: { stubs: { teleport: true } },
|
|
16
|
+
})
|
|
17
|
+
wrappers.push(wrapper)
|
|
18
|
+
await wrapper.setProps({ visible: true })
|
|
19
|
+
await flushPromises()
|
|
20
|
+
return wrapper
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
describe('input authoring', () => {
|
|
24
|
+
it('does not silently replace a table definition with a scalar input', () => {
|
|
25
|
+
expect(() => updateAimdInputField('samples, subvars=[name: str, count: int]', {
|
|
26
|
+
id: 'samples', type: 'str', title: '', defaultRaw: '',
|
|
27
|
+
})).toThrow('Table definitions')
|
|
28
|
+
})
|
|
29
|
+
|
|
30
|
+
it('reserves detached Record IDs and does not assign old data to a new field', async () => {
|
|
31
|
+
const wrapper = await openDialog()
|
|
32
|
+
await wrapper.setProps({ visible: false, reservedIds: ['field_1', 'field_2'] })
|
|
33
|
+
await wrapper.setProps({ visible: true })
|
|
34
|
+
await wrapper.get('form').trigger('submit')
|
|
35
|
+
expect(wrapper.emitted('save')?.[0]).toEqual(['field_3: str'])
|
|
36
|
+
})
|
|
37
|
+
|
|
38
|
+
it('generates persistent IDs without renumbering existing fields and reserves references', () => {
|
|
39
|
+
const content = '{{var|field_1: str}} {{var|field_3: int}} {{ref_var|field_2}}'
|
|
40
|
+
const id = createAimdFieldId(collectAimdFieldIds(content))
|
|
41
|
+
expect(id).toBe('field_4')
|
|
42
|
+
const saved = `${content} {{var|${id}: str}}`
|
|
43
|
+
expect(collectAimdFieldIds(saved).has(id)).toBe(true)
|
|
44
|
+
expect(createAimdFieldId(collectAimdFieldIds(saved))).toBe('field_5')
|
|
45
|
+
})
|
|
46
|
+
|
|
47
|
+
it('preserves defaults and unrelated constraints while escaping a changed title', () => {
|
|
48
|
+
const result = updateAimdInputField('mass: float = 2, gt=0, description="measured", title="Old"', {
|
|
49
|
+
id: 'mass', type: 'float', title: 'Sample "mass"', defaultRaw: '2',
|
|
50
|
+
})
|
|
51
|
+
const parsed = parseVarDefinition(result)
|
|
52
|
+
expect(parsed.id).toBe('mass')
|
|
53
|
+
expect(parsed.default).toBe(2)
|
|
54
|
+
expect(parsed.kwargs).toEqual({ gt: 0, description: 'measured', title: 'Sample "mass"' })
|
|
55
|
+
})
|
|
56
|
+
|
|
57
|
+
it('inserts a text field without requiring a title or manual ID', async () => {
|
|
58
|
+
const wrapper = await openDialog('{{var|field_1: str}}')
|
|
59
|
+
expect(wrapper.get('details').attributes('open')).toBeUndefined()
|
|
60
|
+
await wrapper.get('form').trigger('submit')
|
|
61
|
+
expect(wrapper.emitted('save')?.[0]).toEqual(['field_2: str'])
|
|
62
|
+
})
|
|
63
|
+
|
|
64
|
+
it('blocks duplicate and invalid custom IDs and accepts a valid replacement', async () => {
|
|
65
|
+
const wrapper = await openDialog('{{var|occupied: str}}')
|
|
66
|
+
await wrapper.get('input[name="id"]').setValue('occupied')
|
|
67
|
+
await wrapper.get('form').trigger('submit')
|
|
68
|
+
expect(wrapper.get('[role="alert"]').text()).toBe(messages.inputField.duplicateId)
|
|
69
|
+
await wrapper.get('input[name="id"]').setValue('1 bad')
|
|
70
|
+
await wrapper.get('form').trigger('submit')
|
|
71
|
+
expect(wrapper.get('[role="alert"]').text()).toBe(messages.inputField.invalidId)
|
|
72
|
+
expect(wrapper.emitted('save')).toBeUndefined()
|
|
73
|
+
await wrapper.get('input[name="id"]').setValue('sample_name')
|
|
74
|
+
await wrapper.get('form').trigger('submit')
|
|
75
|
+
expect(wrapper.emitted('save')?.[0]).toEqual(['sample_name: str'])
|
|
76
|
+
})
|
|
77
|
+
|
|
78
|
+
it('creates and edits dropdown choices without requiring Literal syntax', async () => {
|
|
79
|
+
const wrapper = await openDialog()
|
|
80
|
+
await wrapper.get('select[name="preset"]').setValue('choice')
|
|
81
|
+
await wrapper.get('textarea[name="options"]').setValue('Ready\nWaiting')
|
|
82
|
+
await wrapper.get('form').trigger('submit')
|
|
83
|
+
const content = wrapper.emitted('save')?.[0]?.[0] as string
|
|
84
|
+
expect(parseVarDefinition(content).enum).toEqual(['Ready', 'Waiting'])
|
|
85
|
+
const editing = await openDialog(`{{var|${content}}}`, content)
|
|
86
|
+
expect((editing.get('select[name="preset"]').element as HTMLSelectElement).value).toBe('choice')
|
|
87
|
+
await editing.get('input[name="title"]').setValue('Status')
|
|
88
|
+
await editing.get('form').trigger('submit')
|
|
89
|
+
const updated = parseVarDefinition(editing.emitted('save')?.[0]?.[0] as string)
|
|
90
|
+
expect(updated.id).toBe('field_1')
|
|
91
|
+
expect(updated.enum).toEqual(['Ready', 'Waiting'])
|
|
92
|
+
})
|
|
93
|
+
})
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
/// <reference types="vite/client" />
|
|
2
|
+
import { afterEach, describe, expect, it } from 'vitest'
|
|
3
|
+
import { flushPromises, mount, type VueWrapper } from '@vue/test-utils'
|
|
4
|
+
import { parse } from 'vue/compiler-sfc'
|
|
5
|
+
import AimdInputFieldDialog from '../vue/AimdInputFieldDialog.vue'
|
|
6
|
+
import source from '../vue/AimdInputFieldDialog.vue?raw'
|
|
7
|
+
import { createAimdEditorMessages } from '../vue/locales'
|
|
8
|
+
|
|
9
|
+
const { descriptor } = parse(source)
|
|
10
|
+
const styles: HTMLStyleElement[] = []
|
|
11
|
+
const wrappers: VueWrapper[] = []
|
|
12
|
+
|
|
13
|
+
afterEach(() => {
|
|
14
|
+
wrappers.splice(0).forEach(wrapper => wrapper.unmount())
|
|
15
|
+
styles.splice(0).forEach(style => style.remove())
|
|
16
|
+
})
|
|
17
|
+
|
|
18
|
+
describe('input dialog layout', () => {
|
|
19
|
+
it.each(['before', 'after'])('preserves centering when host resets load %s the component styles', async (resetOrder) => {
|
|
20
|
+
const componentCss = descriptor.styles.map(style => style.content).join('\n')
|
|
21
|
+
const resetCss = '* { margin: 0; padding: 0; box-sizing: border-box; }'
|
|
22
|
+
for (const css of resetOrder === 'before' ? [resetCss, componentCss] : [componentCss, resetCss]) {
|
|
23
|
+
const style = document.createElement('style')
|
|
24
|
+
style.textContent = css
|
|
25
|
+
document.head.append(style)
|
|
26
|
+
styles.push(style)
|
|
27
|
+
}
|
|
28
|
+
const wrapper = mount(AimdInputFieldDialog, {
|
|
29
|
+
attachTo: document.body,
|
|
30
|
+
props: { visible: false, content: '', messages: createAimdEditorMessages('en-US') },
|
|
31
|
+
})
|
|
32
|
+
wrappers.push(wrapper)
|
|
33
|
+
await wrapper.setProps({ visible: true })
|
|
34
|
+
await flushPromises()
|
|
35
|
+
|
|
36
|
+
const dialog = document.querySelector<HTMLDialogElement>('dialog.aimd-input-dialog')!
|
|
37
|
+
const style = getComputedStyle(dialog)
|
|
38
|
+
expect(dialog.open).toBe(true)
|
|
39
|
+
expect(dialog.parentElement).toBe(document.body)
|
|
40
|
+
expect(style.position).toBe('fixed')
|
|
41
|
+
expect(style.getPropertyValue('inset')).toBe('0')
|
|
42
|
+
for (const side of ['marginTop', 'marginRight', 'marginBottom', 'marginLeft'] as const) {
|
|
43
|
+
expect(style[side]).toBe('auto')
|
|
44
|
+
}
|
|
45
|
+
expect(style.maxHeight).toBe('calc(100dvh - 32px)')
|
|
46
|
+
expect(style.overflow).toBe('auto')
|
|
47
|
+
expect(document.activeElement).toBe(dialog.querySelector('input[name="title"]'))
|
|
48
|
+
|
|
49
|
+
await wrapper.setProps({ visible: false })
|
|
50
|
+
expect(dialog.open).toBe(false)
|
|
51
|
+
})
|
|
52
|
+
})
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import { mount } from '@vue/test-utils'
|
|
2
|
+
import { describe, expect, it } from 'vitest'
|
|
3
|
+
import AimdEditorToolbar from '../vue/AimdEditorToolbar.vue'
|
|
4
|
+
import AimdInputFieldDialog from '../vue/AimdInputFieldDialog.vue'
|
|
5
|
+
import { createAimdEditorMessages } from '../vue/locales'
|
|
6
|
+
|
|
7
|
+
const messages = createAimdEditorMessages('zh-CN')
|
|
8
|
+
|
|
9
|
+
describe('common input toolbar', () => {
|
|
10
|
+
it('exposes six common inputs with distinct presets and compact labels', async () => {
|
|
11
|
+
const wrapper = mount(AimdEditorToolbar, { props: {
|
|
12
|
+
showTopBar: false, showMdToolbar: false, showAimdToolbar: true, editorMode: 'wysiwyg',
|
|
13
|
+
resolvedMessages: messages, localizedMdToolbarItems: [],
|
|
14
|
+
localizedFieldTypes: [{ type: 'var', label: 'Input', desc: 'Input', color: '#000', svgIcon: '', icon: '' }],
|
|
15
|
+
} })
|
|
16
|
+
const buttons = wrapper.findAll('.aimd-input-tools > button')
|
|
17
|
+
expect(buttons.map(button => button.text())).toEqual(['文本', '整数', '小数', '单选', '多选', '是/否'])
|
|
18
|
+
for (const button of buttons) await button.trigger('click')
|
|
19
|
+
expect(wrapper.emitted('insert-input')?.map(event => event[0])).toEqual(['str', 'int', 'float', 'choice', 'multiple-choice', 'bool | None'])
|
|
20
|
+
expect(buttons.every(button => button.attributes('title')?.startsWith('插入'))).toBe(true)
|
|
21
|
+
const more = wrapper.get('details')
|
|
22
|
+
;(more.element as HTMLDetailsElement).open = true
|
|
23
|
+
await wrapper.get('.aimd-input-tools__menu button').trigger('click')
|
|
24
|
+
expect((more.element as HTMLDetailsElement).open).toBe(false)
|
|
25
|
+
expect(wrapper.emitted('insert-input')?.slice(-1)[0]).toEqual(['date'])
|
|
26
|
+
wrapper.unmount()
|
|
27
|
+
})
|
|
28
|
+
|
|
29
|
+
it.each([
|
|
30
|
+
['int', 'int'], ['float', 'float'], ['bool | None', 'bool | None'],
|
|
31
|
+
['date', 'date'], ['time', 'time'], ['datetime', 'datetime'], ['file', 'FileIdPDF'],
|
|
32
|
+
['choice', 'Literal["A", "B"]'], ['multiple-choice', 'list[Literal["A", "B"]]'],
|
|
33
|
+
])('opens %s already selected without requiring a manual ID', async (preset, type) => {
|
|
34
|
+
const wrapper = mount(AimdInputFieldDialog, { props: { visible: false, content: '', messages, initialPreset: preset }, global: { stubs: { teleport: true } } })
|
|
35
|
+
await wrapper.setProps({ visible: true })
|
|
36
|
+
expect((wrapper.get('[name="preset"]').element as HTMLSelectElement).value).toBe(preset)
|
|
37
|
+
if (preset.includes('choice')) await wrapper.get('[name="options"]').setValue('A\nB')
|
|
38
|
+
await wrapper.get('form').trigger('submit')
|
|
39
|
+
expect(wrapper.emitted('save')?.[0]).toEqual([`field_1: ${type}`])
|
|
40
|
+
wrapper.unmount()
|
|
41
|
+
})
|
|
42
|
+
|
|
43
|
+
it('edits multi-choice options while preserving nullable state and custom metadata', async () => {
|
|
44
|
+
const field = 'samples: list[Literal["A", "B"]] | None, description="Keep"'
|
|
45
|
+
const wrapper = mount(AimdInputFieldDialog, { props: { visible: false, content: `{{var|${field}}}`, fieldContent: field, messages }, global: { stubs: { teleport: true } } })
|
|
46
|
+
await wrapper.setProps({ visible: true })
|
|
47
|
+
expect((wrapper.get('[name="preset"]').element as HTMLSelectElement).value).toBe('multiple-choice')
|
|
48
|
+
await wrapper.get('[name="options"]').setValue('A\nC')
|
|
49
|
+
await wrapper.get('form').trigger('submit')
|
|
50
|
+
expect(wrapper.emitted('save')?.[0]).toEqual(['samples: list[Literal["A", "C"]] | None, description = "Keep"'])
|
|
51
|
+
wrapper.unmount()
|
|
52
|
+
})
|
|
53
|
+
|
|
54
|
+
it('selects a registered attachment format instead of an unsupported generic file type', async () => {
|
|
55
|
+
const wrapper = mount(AimdInputFieldDialog, { props: { visible: false, content: '', messages, initialPreset: 'file' }, global: { stubs: { teleport: true } } })
|
|
56
|
+
await wrapper.setProps({ visible: true })
|
|
57
|
+
await wrapper.get('[name="fileType"]').setValue('FileIdPNG')
|
|
58
|
+
await wrapper.get('form').trigger('submit')
|
|
59
|
+
expect(wrapper.emitted('save')?.[0]).toEqual(['field_1: FileIdPNG'])
|
|
60
|
+
wrapper.unmount()
|
|
61
|
+
})
|
|
62
|
+
|
|
63
|
+
it('preserves named list enums rather than expanding their registered values', async () => {
|
|
64
|
+
const field = 'samples: list[BloodType] | None'
|
|
65
|
+
const wrapper = mount(AimdInputFieldDialog, { props: { visible: false, content: `{{var|${field}}}`, fieldContent: field, messages }, global: { stubs: { teleport: true } } })
|
|
66
|
+
await wrapper.setProps({ visible: true })
|
|
67
|
+
expect((wrapper.get('[name="preset"]').element as HTMLSelectElement).value).toBe('custom')
|
|
68
|
+
await wrapper.get('form').trigger('submit')
|
|
69
|
+
expect(wrapper.emitted('save')?.[0]).toEqual([field])
|
|
70
|
+
wrapper.unmount()
|
|
71
|
+
})
|
|
72
|
+
|
|
73
|
+
it.each([
|
|
74
|
+
['choice', 'Literal["A", "C"]'],
|
|
75
|
+
['multiple-choice', 'list[Literal["A", "C"]]'],
|
|
76
|
+
['bool | None', 'bool | None'],
|
|
77
|
+
])('replaces legacy enum metadata when changing to %s', async (preset, type) => {
|
|
78
|
+
const field = 'status: str, enum=["A", "B"], description="Keep"'
|
|
79
|
+
const wrapper = mount(AimdInputFieldDialog, { props: { visible: false, content: `{{var|${field}}}`, fieldContent: field, messages }, global: { stubs: { teleport: true } } })
|
|
80
|
+
await wrapper.setProps({ visible: true })
|
|
81
|
+
expect((wrapper.get('[name="preset"]').element as HTMLSelectElement).value).toBe('choice')
|
|
82
|
+
await wrapper.get('[name="preset"]').setValue(preset)
|
|
83
|
+
if (preset.includes('choice')) await wrapper.get('[name="options"]').setValue('A\nC')
|
|
84
|
+
await wrapper.get('form').trigger('submit')
|
|
85
|
+
expect(wrapper.emitted('save')?.[0]).toEqual([`status: ${type}, description = "Keep"`])
|
|
86
|
+
wrapper.unmount()
|
|
87
|
+
})
|
|
88
|
+
})
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import { readFileSync } from 'node:fs'
|
|
2
|
+
import { dirname, resolve } from 'node:path'
|
|
3
|
+
import { fileURLToPath } from 'node:url'
|
|
4
|
+
import { afterEach, describe, expect, it } from 'vitest'
|
|
5
|
+
import { Editor, defaultValueCtx, rootCtx } from '@milkdown/kit/core'
|
|
6
|
+
import { commonmark } from '@milkdown/kit/preset/commonmark'
|
|
7
|
+
import { gfm } from '@milkdown/kit/preset/gfm'
|
|
8
|
+
import { getMarkdown, replaceAll } from '@milkdown/kit/utils'
|
|
9
|
+
import { protectAimdInlineTemplates } from '@airalogy/aimd-core'
|
|
10
|
+
import { parseAndExtract } from '@airalogy/aimd-renderer'
|
|
11
|
+
import { aimdMilkdownPlugins } from '../vue/milkdown-aimd-plugin'
|
|
12
|
+
import { normalizeComparableAimdMarkdown } from '../vue/comparableAimdMarkdown'
|
|
13
|
+
|
|
14
|
+
const editors: Editor[] = []
|
|
15
|
+
afterEach(async () => {
|
|
16
|
+
for (const editor of editors.splice(0)) await editor.destroy()
|
|
17
|
+
document.body.replaceChildren()
|
|
18
|
+
})
|
|
19
|
+
|
|
20
|
+
async function createEditor(markdown: string) {
|
|
21
|
+
const root = document.createElement('div')
|
|
22
|
+
document.body.append(root)
|
|
23
|
+
const editor = await Editor.make().config(ctx => {
|
|
24
|
+
ctx.set(rootCtx, root)
|
|
25
|
+
ctx.set(defaultValueCtx, protectAimdInlineTemplates(markdown).content)
|
|
26
|
+
}).use(commonmark).use(gfm).use(aimdMilkdownPlugins).create()
|
|
27
|
+
editors.push(editor)
|
|
28
|
+
return editor
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
const table = `{{var_table|cups, subvars=[
|
|
32
|
+
var(cup_id: str, title="杯号"),
|
|
33
|
+
var(group: Literal["L", "W", "D"], title="组别"),
|
|
34
|
+
var(count: int, title="数量", ge=0, le=10)
|
|
35
|
+
]}}`
|
|
36
|
+
|
|
37
|
+
describe('visual AIMD field round trips', () => {
|
|
38
|
+
it('preserves multiline table columns across repeated serialization and reload', async () => {
|
|
39
|
+
const editor = await createEditor(table)
|
|
40
|
+
for (let iteration = 0; iteration < 3; iteration++) {
|
|
41
|
+
const markdown = editor.action(getMarkdown())
|
|
42
|
+
expect(markdown.trim()).toBe(table)
|
|
43
|
+
expect(markdown).not.toContain(' ')
|
|
44
|
+
expect(parseAndExtract(markdown).var_table).toEqual(parseAndExtract(table).var_table)
|
|
45
|
+
editor.action(replaceAll(protectAimdInlineTemplates(markdown).content))
|
|
46
|
+
}
|
|
47
|
+
})
|
|
48
|
+
|
|
49
|
+
it('repairs old escaped indentation without decoding quoted literal values or ordinary prose', async () => {
|
|
50
|
+
const oldDraft = `Outside  \n\n${table.replace(/\n /g, '\n  ')}`
|
|
51
|
+
const editor = await createEditor(oldDraft)
|
|
52
|
+
const markdown = editor.action(getMarkdown())
|
|
53
|
+
expect(markdown).toContain(table)
|
|
54
|
+
expect(parseAndExtract(markdown).var_table?.[0]?.subvars.map(field => field.id)).toEqual(['cup_id', 'group', 'count'])
|
|
55
|
+
|
|
56
|
+
const literal = String.raw`{{var|note: str, title="Read \"carefully\"", default="C:\\lab\\a_b  "}}`
|
|
57
|
+
expect(normalizeComparableAimdMarkdown(literal)).toBe(literal)
|
|
58
|
+
const literalEditor = await createEditor(literal)
|
|
59
|
+
expect(normalizeComparableAimdMarkdown(literalEditor.action(getMarkdown())).trim()).toBe(literal)
|
|
60
|
+
expect(normalizeComparableAimdMarkdown('Outside   and \\_text')).toBe('Outside   and \\_text')
|
|
61
|
+
})
|
|
62
|
+
|
|
63
|
+
it.each(['ai-glasses-vinegar-titration', 'ai-glasses-leaf-disk-photosynthesis'])('keeps every table definition in %s', async name => {
|
|
64
|
+
const original = readFileSync(resolve(dirname(fileURLToPath(import.meta.url)), `../../../../../examples/protocols/${name}/zh-CN/protocol.aimd`), 'utf8')
|
|
65
|
+
const editor = await createEditor(original)
|
|
66
|
+
const roundTripped = normalizeComparableAimdMarkdown(editor.action(getMarkdown()))
|
|
67
|
+
expect(roundTripped).not.toContain(' ')
|
|
68
|
+
expect(parseAndExtract(roundTripped).var_table).toEqual(parseAndExtract(original).var_table)
|
|
69
|
+
})
|
|
70
|
+
})
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import { readFileSync } from 'node:fs'
|
|
2
|
+
import { dirname, resolve } from 'node:path'
|
|
3
|
+
import { fileURLToPath } from 'node:url'
|
|
4
|
+
import { afterEach, describe, expect, it } from 'vitest'
|
|
5
|
+
import { Editor, defaultValueCtx, editorViewCtx, rootCtx } from '@milkdown/kit/core'
|
|
6
|
+
import { commonmark } from '@milkdown/kit/preset/commonmark'
|
|
7
|
+
import { getMarkdown, replaceAll } from '@milkdown/kit/utils'
|
|
8
|
+
import { protectAimdInlineTemplates } from '@airalogy/aimd-core'
|
|
9
|
+
import { findAimdInlineTemplates } from '@airalogy/aimd-core/parser'
|
|
10
|
+
import { aimdMilkdownPlugins } from '../vue/milkdown-aimd-plugin'
|
|
11
|
+
import { normalizeComparableAimdMarkdown } from '../vue/comparableAimdMarkdown'
|
|
12
|
+
|
|
13
|
+
const editors: Editor[] = []
|
|
14
|
+
afterEach(async () => {
|
|
15
|
+
for (const editor of editors.splice(0)) await editor.destroy()
|
|
16
|
+
document.body.replaceChildren()
|
|
17
|
+
})
|
|
18
|
+
|
|
19
|
+
async function createEditor(markdown: string) {
|
|
20
|
+
const root = document.createElement('div')
|
|
21
|
+
document.body.append(root)
|
|
22
|
+
const editor = await Editor.make().config(ctx => {
|
|
23
|
+
ctx.set(rootCtx, root)
|
|
24
|
+
ctx.set(defaultValueCtx, protectAimdInlineTemplates(markdown).content)
|
|
25
|
+
}).use(commonmark).use(aimdMilkdownPlugins).create()
|
|
26
|
+
editors.push(editor)
|
|
27
|
+
return editor
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
describe('quoted AIMD visual round trips', () => {
|
|
31
|
+
it.each([
|
|
32
|
+
String.raw`{{check|quoted_message_boundary, checked_message="这里的 AIMD 样式文本保持为普通文字:{{ref_var|stable_wait_s}}。"}}`,
|
|
33
|
+
String.raw`{{step|verify, title="Confirm {{ref_var|reading}}", checked_message='Keep {{ref_var|reading}} and don\'t stop at }}.', check=True}}`,
|
|
34
|
+
String.raw`{{var|note: str, title="Read \"{{ref_var|reading}}\"", default="Keep {{ref_var|first}} and {{ref_var|second_value}}"}}`,
|
|
35
|
+
])('keeps quoted templates inside a single field across visual round trips: %s', async field => {
|
|
36
|
+
const markdown = `${field} Outside {{ref_var|stable_wait_s}}.`
|
|
37
|
+
const editor = await createEditor(markdown)
|
|
38
|
+
for (let iteration = 0; iteration < 3; iteration++) {
|
|
39
|
+
const nodes: Array<{ fieldType: string; fieldContent: string }> = []
|
|
40
|
+
editor.action(ctx => ctx.get(editorViewCtx).state.doc.descendants(node => {
|
|
41
|
+
if (node.type.name === 'aimd_field') nodes.push(node.attrs as typeof nodes[number])
|
|
42
|
+
}))
|
|
43
|
+
expect(nodes).toHaveLength(2)
|
|
44
|
+
expect(`{{${nodes[0].fieldType}|${nodes[0].fieldContent}}}`).toBe(field)
|
|
45
|
+
expect(nodes[1]).toMatchObject({ fieldType: 'ref_var', fieldContent: 'stable_wait_s' })
|
|
46
|
+
const saved = editor.action(getMarkdown()).trim()
|
|
47
|
+
expect(saved).toBe(markdown)
|
|
48
|
+
editor.action(replaceAll(protectAimdInlineTemplates(saved).content))
|
|
49
|
+
}
|
|
50
|
+
})
|
|
51
|
+
|
|
52
|
+
it('preserves literal AIMD syntax in the shared quoted-template fixture', async () => {
|
|
53
|
+
const original = readFileSync(resolve(dirname(fileURLToPath(import.meta.url)), '../../../../../spec/fixtures/protocols/quoted-template-text/protocol/protocol.aimd'), 'utf8')
|
|
54
|
+
const editor = await createEditor(original)
|
|
55
|
+
const types: string[] = []
|
|
56
|
+
editor.action(ctx => ctx.get(editorViewCtx).state.doc.descendants(node => {
|
|
57
|
+
if (node.type.name === 'aimd_field') types.push(node.attrs.fieldType)
|
|
58
|
+
}))
|
|
59
|
+
expect(types).toEqual(['step', 'check'])
|
|
60
|
+
expect(findAimdInlineTemplates(editor.action(getMarkdown()))).toEqual(findAimdInlineTemplates(original))
|
|
61
|
+
})
|
|
62
|
+
|
|
63
|
+
it('normalizes escaped field syntax without rewriting quoted nested text', () => {
|
|
64
|
+
const original = String.raw`{{check|reading, checked_message="Keep {{ref_var|first}} and {{ref_var|second\_value}}", title="Literal  "}}`
|
|
65
|
+
expect(normalizeComparableAimdMarkdown(original)).toBe(original)
|
|
66
|
+
const escaped = String.raw`{{var\_table|cups, subvars=[cup\_id: str], title="Keep {{ref_var|first}} and {{ref_var|second\_value}}"}}`
|
|
67
|
+
expect(normalizeComparableAimdMarkdown(escaped)).toBe(escaped.replace('var\\_table', 'var_table').replace('cup\\_id', 'cup_id'))
|
|
68
|
+
expect(normalizeComparableAimdMarkdown('`{{ref_media|video}}`')).toBe('`{{ref_media|video}}`')
|
|
69
|
+
})
|
|
70
|
+
|
|
71
|
+
it('keeps inline and fenced code examples as code', async () => {
|
|
72
|
+
const field = '{{check|demo, checked_message="Keep {{ref_var|reading}}"}}'
|
|
73
|
+
const original = `\`${field}\`\n\n\`\`\`aimd\n${field}\n\`\`\``
|
|
74
|
+
const editor = await createEditor(original)
|
|
75
|
+
const types: string[] = []
|
|
76
|
+
editor.action(ctx => ctx.get(editorViewCtx).state.doc.descendants(node => { types.push(node.type.name) }))
|
|
77
|
+
expect(types).not.toContain('aimd_field')
|
|
78
|
+
expect(editor.action(getMarkdown()).trim()).toBe(original)
|
|
79
|
+
})
|
|
80
|
+
})
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import { afterEach, describe, expect, it } from 'vitest'
|
|
2
|
+
import { flushPromises, mount, type VueWrapper } from '@vue/test-utils'
|
|
3
|
+
import { parseStepContent } from '@airalogy/aimd-core/parser'
|
|
4
|
+
import { updateAimdStepField } from '../authoring/fields'
|
|
5
|
+
import AimdStepFieldDialog from '../vue/AimdStepFieldDialog.vue'
|
|
6
|
+
import { createAimdEditorMessages } from '../vue/locales'
|
|
7
|
+
|
|
8
|
+
const messages = createAimdEditorMessages('en-US')
|
|
9
|
+
const wrappers: VueWrapper[] = []
|
|
10
|
+
afterEach(() => wrappers.splice(0).forEach(wrapper => wrapper.unmount()))
|
|
11
|
+
|
|
12
|
+
async function openDialog(content = '', fieldContent?: string, reservedIds: string[] = []) {
|
|
13
|
+
const wrapper = mount(AimdStepFieldDialog, { props: { visible: false, content, fieldContent, reservedIds, messages }, global: { stubs: { teleport: true } } })
|
|
14
|
+
wrappers.push(wrapper)
|
|
15
|
+
await wrapper.setProps({ visible: true })
|
|
16
|
+
await flushPromises()
|
|
17
|
+
return wrapper
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
describe('step authoring', () => {
|
|
21
|
+
it('generates a unique ID and saves an optional title, without renumbering existing steps', async () => {
|
|
22
|
+
const wrapper = await openDialog('{{step|step_1}} {{ref_step|step_2}}', undefined, ['step_3'])
|
|
23
|
+
expect(wrapper.get('details').attributes('open')).toBeUndefined()
|
|
24
|
+
await wrapper.get('input[name="title"]').setValue('准备样品, mix "gently"')
|
|
25
|
+
await wrapper.get('form').trigger('submit')
|
|
26
|
+
const step = parseStepContent(wrapper.emitted('save')![0][0] as string)
|
|
27
|
+
expect(step).toMatchObject({ id: 'step_4', title: '准备样品, mix "gently"', check: true })
|
|
28
|
+
})
|
|
29
|
+
|
|
30
|
+
it('preserves the identity and unrelated options while changing or clearing a title', () => {
|
|
31
|
+
const original = 'prepare, 2, title="Old", check=True, duration="30s", timer="both", checked_message="Done", subtitle="Context", result=True'
|
|
32
|
+
const values = { id: 'must_not_rename', title: 'New', level: 2, check: true, duration: '30s', timer: 'both' }
|
|
33
|
+
const updated = parseStepContent(updateAimdStepField(original, values))
|
|
34
|
+
expect(updated).toMatchObject({ id: 'prepare', title: 'New', level: 2, check: true, estimated_duration_ms: 30000, timer_mode: 'both', subtitle: 'Context', checked_message: 'Done', result: true })
|
|
35
|
+
expect(parseStepContent(updateAimdStepField(original, { ...values, title: ' ' })).title).toBeUndefined()
|
|
36
|
+
})
|
|
37
|
+
|
|
38
|
+
it('edits existing titles without renaming record keys', async () => {
|
|
39
|
+
const wrapper = await openDialog('{{step|prepare, check=True}}', 'prepare, check=True')
|
|
40
|
+
expect(wrapper.get('input[name="id"]').attributes('readonly')).toBeDefined()
|
|
41
|
+
await wrapper.get('input[name="title"]').setValue('Prepare sample')
|
|
42
|
+
await wrapper.get('form').trigger('submit')
|
|
43
|
+
expect(parseStepContent(wrapper.emitted('save')![0][0] as string).id).toBe('prepare')
|
|
44
|
+
})
|
|
45
|
+
|
|
46
|
+
it('allows a title-free step and validates IDs and countdown duration', async () => {
|
|
47
|
+
const wrapper = await openDialog('{{var|taken: str}}')
|
|
48
|
+
await wrapper.get('input[name="id"]').setValue('taken')
|
|
49
|
+
await wrapper.get('form').trigger('submit')
|
|
50
|
+
expect(wrapper.get('[role="alert"]').text()).toBe(messages.inputField.duplicateId)
|
|
51
|
+
await wrapper.get('input[name="id"]').setValue('1 bad')
|
|
52
|
+
await wrapper.get('form').trigger('submit')
|
|
53
|
+
expect(wrapper.get('[role="alert"]').text()).toBe(messages.inputField.invalidId)
|
|
54
|
+
await wrapper.get('input[name="id"]').setValue('prepare')
|
|
55
|
+
await wrapper.get('select[name="timer"]').setValue('countdown')
|
|
56
|
+
await wrapper.get('form').trigger('submit')
|
|
57
|
+
expect(wrapper.get('[role="alert"]').text()).toBe(messages.stepField.invalidDuration)
|
|
58
|
+
await wrapper.get('input[name="duration"]').setValue('30s')
|
|
59
|
+
await wrapper.get('form').trigger('submit')
|
|
60
|
+
expect(parseStepContent(wrapper.emitted('save')![0][0] as string)).toMatchObject({ id: 'prepare', title: undefined, estimated_duration_ms: 30000 })
|
|
61
|
+
})
|
|
62
|
+
})
|