@airalogy/aimd-recorder 1.14.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 +240 -0
- package/README.zh-CN.md +224 -0
- package/dist/AimdCodeField-DC3DPvgc.js +172 -0
- package/dist/AimdDnaSequenceField-__jdnFS9.js +59466 -0
- package/dist/AimdEditor.vue_vue_type_style_index_0_lang-Bq79rKNw.js +28370 -0
- package/dist/AimdMarkdownField-98ImHGbc.js +66 -0
- package/dist/AimdMarkdownNoteField-CuUJZkgT.js +185 -0
- package/dist/_.contribution-IP0cDNhs.js +38 -0
- package/dist/_commonjsHelpers-CZXJ37nu.js +40 -0
- package/dist/abap-Bs8kvjsq.js +1398 -0
- package/dist/aimd-recorder.css +1 -0
- package/dist/apex-Dspwrl5m.js +326 -0
- package/dist/assets/css.worker-Dmf38jDD.js +79 -0
- package/dist/assets/editor.worker-CpuX8TSY.js +12 -0
- package/dist/assets/html.worker-DotaEs7v.js +456 -0
- package/dist/assets/json.worker-B4VHhH6h.js +44 -0
- package/dist/assets/ts.worker-sl17zBDo.js +51316 -0
- package/dist/azcli-k1BiOau1.js +68 -0
- package/dist/bat-BIP72KWc.js +100 -0
- package/dist/bicep-VhQeYhS3.js +102 -0
- package/dist/cameligo-DnuAXtHg.js +174 -0
- package/dist/clojure-BAuDPsal.js +761 -0
- package/dist/coffee-BV06qSnj.js +232 -0
- package/dist/components.js +3595 -0
- package/dist/composables.js +72 -0
- package/dist/cpp-Cz8Jeyrf.js +389 -0
- package/dist/csharp-F6hhlXFb.js +326 -0
- package/dist/csp-KzlEHCyI.js +53 -0
- package/dist/css-e4FKntZ3.js +187 -0
- package/dist/cssMode-uz9U6SUU.js +1571 -0
- package/dist/cypher-CpvDGKRr.js +263 -0
- package/dist/dart-DdHeFWR0.js +281 -0
- package/dist/dockerfile-aoNXDcio.js +130 -0
- package/dist/ecl-C4Q0DYuA.js +456 -0
- package/dist/editor.api-CgD9w0gG.js +77091 -0
- package/dist/editor.main-Du02abDl.js +33783 -0
- package/dist/elixir-C9X42b0T.js +569 -0
- package/dist/flow9-Bff42pfB.js +142 -0
- package/dist/freemarker2-DFLX4iQ-.js +989 -0
- package/dist/fsharp-C6vPAsHG.js +217 -0
- package/dist/go-DEr8zx9f.js +218 -0
- package/dist/graphql-BiNBBRFh.js +151 -0
- package/dist/handlebars-aiZbIuWY.js +419 -0
- package/dist/hcl-2T9lKuFg.js +183 -0
- package/dist/html-phzTMObN.js +308 -0
- package/dist/htmlMode-BF7wMi3N.js +1581 -0
- package/dist/index.js +89 -0
- package/dist/ini-CZGtssYM.js +71 -0
- package/dist/ini.contribution-DyWtiacL.js +8 -0
- package/dist/java-B260NeH3.js +232 -0
- package/dist/javascript-BKKOItMi.js +70 -0
- package/dist/jsonMode-CDYK4B5l.js +1996 -0
- package/dist/julia-kuNLM9c5.js +511 -0
- package/dist/kotlin-Bz6kAefA.js +253 -0
- package/dist/less-AZUtS89I.js +162 -0
- package/dist/lexon-BcmgnyRb.js +157 -0
- package/dist/liquid-B2eRz5SA.js +240 -0
- package/dist/lua-Dz1RbATg.js +162 -0
- package/dist/m3-CIMooLFn.js +210 -0
- package/dist/markdown-C1BsCK9P.js +229 -0
- package/dist/markdown.contribution-DYYk6zUU.js +7 -0
- package/dist/mdx-BfV1HDRG.js +165 -0
- package/dist/mips-BovsnfLQ.js +198 -0
- package/dist/monaco.contribution-C-bQhUTI.js +114 -0
- package/dist/monaco.contribution-CCVvl3Jx.js +72 -0
- package/dist/monaco.contribution-Col-f0XR.js +164 -0
- package/dist/monaco.contribution-b5xkgQ-s.js +112 -0
- package/dist/msdax-CiRB2ZB-.js +375 -0
- package/dist/mysql-BwdpPE19.js +878 -0
- package/dist/objective-c-D4nfHfso.js +183 -0
- package/dist/pascal--j5-PYtz.js +251 -0
- package/dist/pascaligo-C7TcJxNL.js +164 -0
- package/dist/perl-BzEWqUb5.js +626 -0
- package/dist/pgsql-B_KZ0mGX.js +851 -0
- package/dist/php-A19QHzQV.js +500 -0
- package/dist/pla-COeKY1hA.js +137 -0
- package/dist/postiats-BfMp7zJL.js +907 -0
- package/dist/powerquery-B0TS_5Gb.js +890 -0
- package/dist/powershell-5jSbKdYB.js +239 -0
- package/dist/protobuf-YgnOutn3.js +420 -0
- package/dist/pug-DLej6kn5.js +402 -0
- package/dist/python-CQrZx9mR.js +301 -0
- package/dist/python.contribution-CcKs2Ktm.js +8 -0
- package/dist/qsharp-AhjqtSHB.js +301 -0
- package/dist/r-D-F4P80w.js +243 -0
- package/dist/razor-DWmpHMcx.js +550 -0
- package/dist/redis-hwwIlMnV.js +302 -0
- package/dist/redshift-Bcm_kjEG.js +809 -0
- package/dist/restructuredtext-CrdzfPP-.js +174 -0
- package/dist/ruby-QC2UNm1s.js +511 -0
- package/dist/rust-5aqiQ3L5.js +343 -0
- package/dist/sb-B1g1ZfLJ.js +115 -0
- package/dist/scala-C2U4R5Gb.js +370 -0
- package/dist/scheme-DeFRbslr.js +108 -0
- package/dist/scss-RSTCiCmI.js +262 -0
- package/dist/shell-BpF-iNu8.js +221 -0
- package/dist/shell.contribution-B80NZ3iO.js +7 -0
- package/dist/solidity-C00r2mbQ.js +1367 -0
- package/dist/sophia-DVW5ZKDB.js +199 -0
- package/dist/sparql-B0nmpxeX.js +201 -0
- package/dist/sql-CJwKPERn.js +853 -0
- package/dist/sql.contribution-DQy36aE5.js +7 -0
- package/dist/st-DPlKG5DT.js +416 -0
- package/dist/swift-YZBAbVHV.js +309 -0
- package/dist/systemverilog-CDQSaH63.js +576 -0
- package/dist/tcl-Dlu8sp6Q.js +232 -0
- package/dist/tsMode-Bh-v12OL.js +887 -0
- package/dist/twig-C5TO7-kw.js +392 -0
- package/dist/typescript-c7y6IZVP.js +343 -0
- package/dist/typespec-BsmjDEu7.js +117 -0
- package/dist/useFieldRendering-BIqeE3qo.js +6083 -0
- package/dist/vb-ChHvIDrk.js +372 -0
- package/dist/wgsl-XEp1ju8c.js +439 -0
- package/dist/xml-MAEprTnF.js +95 -0
- package/dist/xml.contribution-XMOaon8i.js +27 -0
- package/dist/yaml-C1p8rXG7.js +206 -0
- package/dist/yaml.contribution-DRRVhJmJ.js +8 -0
- package/package.json +88 -0
- package/src/__tests__/client-assigner.test.ts +341 -0
- package/src/__tests__/code-types.test.ts +30 -0
- package/src/__tests__/markdown-field.test.ts +34 -0
- package/src/__tests__/markdown-note-field.test.ts +135 -0
- package/src/__tests__/quiz-recorder.test.ts +195 -0
- package/src/__tests__/recorder-editor-content-sync.test.ts +172 -0
- package/src/__tests__/recorder-editor.test.ts +143 -0
- package/src/__tests__/recorder-render.test.ts +57 -0
- package/src/__tests__/recorder-wysiwyg-field-host.test.ts +33 -0
- package/src/__tests__/step-field.test.ts +270 -0
- package/src/__tests__/type-plugins.test.ts +59 -0
- package/src/__tests__/var-field-render.test.ts +26 -0
- package/src/client-assigner.ts +269 -0
- package/src/code-types.ts +94 -0
- package/src/components/AimdCodeField.vue +228 -0
- package/src/components/AimdDnaSequenceField.vue +983 -0
- package/src/components/AimdMarkdownField.vue +168 -0
- package/src/components/AimdMarkdownNoteField.vue +457 -0
- package/src/components/AimdQuizRecorder.vue +792 -0
- package/src/components/AimdRecorder.vue +1959 -0
- package/src/components/AimdRecorderEditor.vue +2281 -0
- package/src/components/AimdRecorderWysiwygFieldHost.vue +93 -0
- package/src/components/AimdRecorderWysiwygSurface.vue +487 -0
- package/src/components/AimdSeqVizViewer.vue +122 -0
- package/src/components/AimdStepCheckField.vue +453 -0
- package/src/components/AimdVarField.vue +213 -0
- package/src/components/AimdVarTableField.vue +516 -0
- package/src/components/DnaAnnotationEditor.vue +477 -0
- package/src/components/DnaSequenceEditor.vue +44 -0
- package/src/components/DnaSequenceToolbar.vue +98 -0
- package/src/components/DnaSequenceViewer.vue +162 -0
- package/src/components/index.ts +21 -0
- package/src/components/recorderMilkdownPlugin.ts +632 -0
- package/src/composables/__tests__/useDnaSequence.test.ts +467 -0
- package/src/composables/__tests__/useFieldAdapters.test.ts +115 -0
- package/src/composables/__tests__/useFocusManagement.test.ts +66 -0
- package/src/composables/__tests__/useRecordState.test.ts +586 -0
- package/src/composables/__tests__/useStepTimers.test.ts +64 -0
- package/src/composables/__tests__/useVarHelpers.test.ts +424 -0
- package/src/composables/__tests__/workbenchFieldEditing.test.ts +97 -0
- package/src/composables/index.ts +94 -0
- package/src/composables/useClientAssignerRunner.ts +74 -0
- package/src/composables/useDnaSequence.ts +400 -0
- package/src/composables/useDnaSequenceField.ts +316 -0
- package/src/composables/useFieldAdapters.ts +61 -0
- package/src/composables/useFieldRendering.ts +269 -0
- package/src/composables/useFocusManagement.ts +144 -0
- package/src/composables/useRecordState.ts +429 -0
- package/src/composables/useStepTimers.ts +243 -0
- package/src/composables/useVarHelpers.ts +545 -0
- package/src/composables/useVarTableDragDrop.ts +236 -0
- package/src/composables/workbenchFieldEditing.ts +705 -0
- package/src/css.d.ts +9 -0
- package/src/index.ts +65 -0
- package/src/locales.ts +559 -0
- package/src/monaco-code.ts +75 -0
- package/src/styles/aimd.css +994 -0
- package/src/type-plugins.ts +132 -0
- package/src/type-utils.ts +3 -0
- package/src/types.ts +191 -0
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { readFileSync } from 'node:fs'
|
|
2
|
+
import { dirname, resolve } from 'node:path'
|
|
3
|
+
import { fileURLToPath } from 'node:url'
|
|
4
|
+
import { describe, expect, it } from 'vitest'
|
|
5
|
+
|
|
6
|
+
const __filename = fileURLToPath(import.meta.url)
|
|
7
|
+
const __dirname = dirname(__filename)
|
|
8
|
+
const source = readFileSync(resolve(__dirname, '../components/AimdRecorder.vue'), 'utf8')
|
|
9
|
+
|
|
10
|
+
describe('AimdRecorder render stability', () => {
|
|
11
|
+
it('uses a stable outlet component instead of recreating an inline dynamic component on each render', () => {
|
|
12
|
+
expect(source).toMatch(/const InlineNodesOutlet = defineComponent\(/)
|
|
13
|
+
expect(source).toMatch(/<InlineNodesOutlet :nodes="inlineNodes" \/>/)
|
|
14
|
+
expect(source).not.toMatch(/<component :is="\(\) => inlineNodes" \/>/)
|
|
15
|
+
})
|
|
16
|
+
|
|
17
|
+
it('skips echo-style modelValue syncs when the incoming record signature matches local state', () => {
|
|
18
|
+
expect(source).toMatch(/if \(!shouldRebuild\) \{\s*return\s*\}/)
|
|
19
|
+
})
|
|
20
|
+
|
|
21
|
+
it('renders protocol timing summary pills when step estimates or recorded durations exist', () => {
|
|
22
|
+
expect(source).toMatch(/showProtocolTimingSummary/)
|
|
23
|
+
expect(source).toMatch(/aimd-protocol-recorder__timing-pill--estimate/)
|
|
24
|
+
expect(source).toMatch(/protocolEstimatedDurationLabel/)
|
|
25
|
+
expect(source).toMatch(/protocolRecordedDurationLabel/)
|
|
26
|
+
})
|
|
27
|
+
|
|
28
|
+
it('defaults step detail disclosure to auto and passes it through to the step field', () => {
|
|
29
|
+
expect(source).toMatch(/stepDetailDisplay\?: AimdStepDetailDisplay/)
|
|
30
|
+
expect(source).toMatch(/stepDetailDisplay: "auto"/)
|
|
31
|
+
expect(source).toMatch(/detailDisplay: props\.stepDetailDisplay/)
|
|
32
|
+
})
|
|
33
|
+
|
|
34
|
+
it('normalizes grouped step body nodes so grouped content does not re-render the step header inside its own body', () => {
|
|
35
|
+
expect(source).toMatch(/function normalizeStepBodyNodes\(bodyNodes: VNodeChild\[] = \[]\): VNodeChild\[]/)
|
|
36
|
+
expect(source).toMatch(/const groupedBody = bodyNodes\.find\(\(child\) => isGroupedStepBodyNode\(child\)\)/)
|
|
37
|
+
expect(source).toMatch(/bodyNodes: normalizedBodyNodes/)
|
|
38
|
+
})
|
|
39
|
+
|
|
40
|
+
it('rebuilds inline quiz nodes when quizGrades change so grading feedback can update reactively', () => {
|
|
41
|
+
expect(source).toMatch(/watch\(\s*\(\) => props\.quizGrades,\s*\(\) => \{\s*scheduleInlineRebuild\(\)\s*\},\s*\{ deep: true \},\s*\)/)
|
|
42
|
+
})
|
|
43
|
+
|
|
44
|
+
it('passes choice option explanation display mode through to quiz widgets', () => {
|
|
45
|
+
expect(source).toMatch(/choiceOptionExplanationMode\?: AimdChoiceOptionExplanationMode/)
|
|
46
|
+
expect(source).toMatch(/choiceOptionExplanationMode: "hidden"/)
|
|
47
|
+
expect(source).toMatch(/choiceOptionExplanationMode: props\.choiceOptionExplanationMode/)
|
|
48
|
+
expect(source).toMatch(/watch\(\s*\(\) => props\.choiceOptionExplanationMode,\s*\(\) => \{\s*scheduleInlineRebuild\(\)\s*\},\s*\)/)
|
|
49
|
+
})
|
|
50
|
+
|
|
51
|
+
it('passes submission state through to quiz widgets so explanation visibility can switch after submit', () => {
|
|
52
|
+
expect(source).toMatch(/submitted\?: boolean/)
|
|
53
|
+
expect(source).toMatch(/submitted: false/)
|
|
54
|
+
expect(source).toMatch(/submitted: props\.submitted/)
|
|
55
|
+
expect(source).toMatch(/watch\(\s*\(\) => props\.submitted,\s*\(\) => \{\s*scheduleInlineRebuild\(\)\s*\},\s*\)/)
|
|
56
|
+
})
|
|
57
|
+
})
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { mount } from '@vue/test-utils'
|
|
2
|
+
import { describe, expect, it, vi } from 'vitest'
|
|
3
|
+
import AimdRecorderWysiwygFieldHost from '../components/AimdRecorderWysiwygFieldHost.vue'
|
|
4
|
+
import { createEmptyProtocolRecordData } from '../types'
|
|
5
|
+
import type { RecorderMilkdownSurfaceState } from '../components/recorderMilkdownPlugin'
|
|
6
|
+
|
|
7
|
+
function createSurfaceState(): RecorderMilkdownSurfaceState {
|
|
8
|
+
return {
|
|
9
|
+
record: createEmptyProtocolRecordData(),
|
|
10
|
+
readonly: false,
|
|
11
|
+
stepDetailDisplay: 'auto',
|
|
12
|
+
onUpdateRecord: () => {},
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
describe('AimdRecorderWysiwygFieldHost', () => {
|
|
17
|
+
it('renders inline var fields with the real recorder input UI instead of AIMD chips', async () => {
|
|
18
|
+
const wrapper = mount(AimdRecorderWysiwygFieldHost, {
|
|
19
|
+
props: {
|
|
20
|
+
surfaceState: createSurfaceState(),
|
|
21
|
+
rawContent: '{{var|sample_name: str}}',
|
|
22
|
+
displayMode: 'inline',
|
|
23
|
+
},
|
|
24
|
+
})
|
|
25
|
+
await vi.waitFor(() => {
|
|
26
|
+
expect(wrapper.find('.aimd-rec-inline--var-stacked').exists()).toBe(true)
|
|
27
|
+
})
|
|
28
|
+
|
|
29
|
+
expect(wrapper.html()).toContain('aimd-rec-inline--var-stacked')
|
|
30
|
+
expect(wrapper.html()).toContain('data-rec-focus-key="var:sample_name"')
|
|
31
|
+
expect(wrapper.html()).not.toContain('aimd-field-chip')
|
|
32
|
+
})
|
|
33
|
+
})
|
|
@@ -0,0 +1,270 @@
|
|
|
1
|
+
import { mount } from '@vue/test-utils'
|
|
2
|
+
import { h, nextTick, reactive } from 'vue'
|
|
3
|
+
import { afterEach, describe, expect, it, vi } from 'vitest'
|
|
4
|
+
import type { AimdCheckNode, AimdStepNode } from '@airalogy/aimd-core/types'
|
|
5
|
+
|
|
6
|
+
import { createAimdRecorderMessages } from '../locales'
|
|
7
|
+
import { AimdCheckField, AimdStepField } from '../components/AimdStepCheckField.vue'
|
|
8
|
+
import { createEmptyStepRecordItem, startStepTimer } from '../composables/useStepTimers'
|
|
9
|
+
|
|
10
|
+
describe('AimdStepField', () => {
|
|
11
|
+
afterEach(() => {
|
|
12
|
+
vi.useRealTimers()
|
|
13
|
+
})
|
|
14
|
+
|
|
15
|
+
function createBaseProps(nodeOverrides: Partial<AimdStepNode> = {}) {
|
|
16
|
+
const node: AimdStepNode = {
|
|
17
|
+
id: 'prepare',
|
|
18
|
+
fieldType: 'step',
|
|
19
|
+
scope: 'step',
|
|
20
|
+
type: 'aimd',
|
|
21
|
+
raw: '{{step|prepare}}',
|
|
22
|
+
level: 1,
|
|
23
|
+
sequence: 0,
|
|
24
|
+
step: '1',
|
|
25
|
+
check: false,
|
|
26
|
+
estimated_duration_ms: 90_000,
|
|
27
|
+
...nodeOverrides,
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
return {
|
|
31
|
+
locale: 'en-US',
|
|
32
|
+
node,
|
|
33
|
+
disabled: false,
|
|
34
|
+
extraClasses: [] as string[],
|
|
35
|
+
messages: createAimdRecorderMessages('en-US'),
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
it('keeps timer controls and annotation input collapsed by default in auto mode', () => {
|
|
40
|
+
const state = reactive(createEmptyStepRecordItem())
|
|
41
|
+
const wrapper = mount(AimdStepField, {
|
|
42
|
+
props: {
|
|
43
|
+
...createBaseProps(),
|
|
44
|
+
state,
|
|
45
|
+
},
|
|
46
|
+
})
|
|
47
|
+
|
|
48
|
+
expect(wrapper.text()).toContain('ETA 1m 30s')
|
|
49
|
+
expect(wrapper.text()).not.toContain('Timer 0s')
|
|
50
|
+
expect(wrapper.text()).toContain('Notes')
|
|
51
|
+
expect(wrapper.text()).toContain('Timer')
|
|
52
|
+
expect(wrapper.find('input[type="checkbox"]').exists()).toBe(false)
|
|
53
|
+
expect(wrapper.find('.aimd-step-field__details').exists()).toBe(false)
|
|
54
|
+
expect(wrapper.find('.aimd-step-field__detail--annotation').exists()).toBe(false)
|
|
55
|
+
})
|
|
56
|
+
|
|
57
|
+
it('renders a checkbox only when step check is enabled', () => {
|
|
58
|
+
const state = reactive(createEmptyStepRecordItem())
|
|
59
|
+
const wrapper = mount(AimdStepField, {
|
|
60
|
+
props: {
|
|
61
|
+
...createBaseProps({
|
|
62
|
+
check: true,
|
|
63
|
+
}),
|
|
64
|
+
state,
|
|
65
|
+
},
|
|
66
|
+
})
|
|
67
|
+
|
|
68
|
+
expect(wrapper.find('input[type="checkbox"]').exists()).toBe(true)
|
|
69
|
+
})
|
|
70
|
+
|
|
71
|
+
it('shows the annotation detail when a note already exists in auto mode', () => {
|
|
72
|
+
const state = reactive({
|
|
73
|
+
...createEmptyStepRecordItem(),
|
|
74
|
+
annotation: 'Keep on ice',
|
|
75
|
+
})
|
|
76
|
+
const wrapper = mount(AimdStepField, {
|
|
77
|
+
props: {
|
|
78
|
+
...createBaseProps(),
|
|
79
|
+
state,
|
|
80
|
+
},
|
|
81
|
+
})
|
|
82
|
+
|
|
83
|
+
expect(wrapper.find('.aimd-step-field__details').exists()).toBe(true)
|
|
84
|
+
expect(wrapper.find('.aimd-step-field__detail--annotation').exists()).toBe(true)
|
|
85
|
+
expect(wrapper.text()).toContain('Timer')
|
|
86
|
+
})
|
|
87
|
+
|
|
88
|
+
it('opens the annotation detail when clicking the notes toggle', async () => {
|
|
89
|
+
const state = reactive(createEmptyStepRecordItem())
|
|
90
|
+
const wrapper = mount(AimdStepField, {
|
|
91
|
+
props: {
|
|
92
|
+
...createBaseProps(),
|
|
93
|
+
state,
|
|
94
|
+
},
|
|
95
|
+
attachTo: document.body,
|
|
96
|
+
})
|
|
97
|
+
|
|
98
|
+
await wrapper.find('.aimd-step-field__toggle--annotation').trigger('click')
|
|
99
|
+
await nextTick()
|
|
100
|
+
|
|
101
|
+
expect(wrapper.find('.aimd-step-field__details').exists()).toBe(true)
|
|
102
|
+
expect(wrapper.find('.aimd-step-field__detail--annotation').exists()).toBe(true)
|
|
103
|
+
expect(wrapper.emitted('timer-start')).toBeFalsy()
|
|
104
|
+
|
|
105
|
+
wrapper.unmount()
|
|
106
|
+
})
|
|
107
|
+
|
|
108
|
+
it('opens timer controls on demand in auto mode', async () => {
|
|
109
|
+
const state = reactive(createEmptyStepRecordItem())
|
|
110
|
+
const wrapper = mount(AimdStepField, {
|
|
111
|
+
props: {
|
|
112
|
+
...createBaseProps(),
|
|
113
|
+
state,
|
|
114
|
+
},
|
|
115
|
+
})
|
|
116
|
+
|
|
117
|
+
await wrapper.find('.aimd-step-field__toggle--timer').trigger('click')
|
|
118
|
+
|
|
119
|
+
expect(wrapper.find('.aimd-step-field__details').exists()).toBe(true)
|
|
120
|
+
expect(wrapper.text()).toContain('Timer 0s')
|
|
121
|
+
expect(wrapper.text()).toContain('Start')
|
|
122
|
+
expect(wrapper.emitted('timer-start')).toBeTruthy()
|
|
123
|
+
})
|
|
124
|
+
|
|
125
|
+
it('renders estimated and recorded timing UI and updates while running in always mode', async () => {
|
|
126
|
+
vi.useFakeTimers()
|
|
127
|
+
vi.setSystemTime(new Date(0))
|
|
128
|
+
|
|
129
|
+
const state = reactive(createEmptyStepRecordItem())
|
|
130
|
+
const wrapper = mount(AimdStepField, {
|
|
131
|
+
props: {
|
|
132
|
+
...createBaseProps(),
|
|
133
|
+
detailDisplay: 'always',
|
|
134
|
+
state,
|
|
135
|
+
},
|
|
136
|
+
})
|
|
137
|
+
|
|
138
|
+
expect(wrapper.text()).toContain('ETA 1m 30s')
|
|
139
|
+
expect(wrapper.text()).toContain('Timer 0s')
|
|
140
|
+
expect(wrapper.find('.aimd-step-timer__controls .aimd-step-timer__btn').text()).toBe('Start')
|
|
141
|
+
|
|
142
|
+
await wrapper.find('.aimd-step-timer__controls .aimd-step-timer__btn').trigger('click')
|
|
143
|
+
expect(wrapper.emitted('timer-start')).toBeTruthy()
|
|
144
|
+
|
|
145
|
+
startStepTimer(state, Date.now())
|
|
146
|
+
await nextTick()
|
|
147
|
+
|
|
148
|
+
await vi.advanceTimersByTimeAsync(2_000)
|
|
149
|
+
await nextTick()
|
|
150
|
+
|
|
151
|
+
expect(wrapper.text()).toContain('Timer 2s')
|
|
152
|
+
expect(wrapper.find('.aimd-step-timer__controls .aimd-step-timer__btn').text()).toBe('Pause')
|
|
153
|
+
})
|
|
154
|
+
|
|
155
|
+
it('auto-expands countdown mode and switches to warning and overtime states', async () => {
|
|
156
|
+
vi.useFakeTimers()
|
|
157
|
+
vi.setSystemTime(new Date(0))
|
|
158
|
+
|
|
159
|
+
const state = reactive(createEmptyStepRecordItem())
|
|
160
|
+
const wrapper = mount(AimdStepField, {
|
|
161
|
+
props: {
|
|
162
|
+
...createBaseProps({
|
|
163
|
+
estimated_duration_ms: 30_000,
|
|
164
|
+
timer_mode: 'countdown',
|
|
165
|
+
}),
|
|
166
|
+
state,
|
|
167
|
+
},
|
|
168
|
+
})
|
|
169
|
+
|
|
170
|
+
expect(wrapper.find('.aimd-step-field__details').exists()).toBe(true)
|
|
171
|
+
expect(wrapper.text()).toContain('Remain 30s')
|
|
172
|
+
expect(wrapper.find('.aimd-step-timer__hero--countdown').exists()).toBe(true)
|
|
173
|
+
|
|
174
|
+
await wrapper.find('.aimd-step-timer__controls .aimd-step-timer__btn').trigger('click')
|
|
175
|
+
expect(wrapper.emitted('timer-start')).toBeTruthy()
|
|
176
|
+
|
|
177
|
+
startStepTimer(state, Date.now())
|
|
178
|
+
await nextTick()
|
|
179
|
+
|
|
180
|
+
await vi.advanceTimersByTimeAsync(25_000)
|
|
181
|
+
await nextTick()
|
|
182
|
+
|
|
183
|
+
expect(wrapper.text()).toContain('Remain 5s')
|
|
184
|
+
expect(wrapper.find('.aimd-step-timer__hero--warning').exists()).toBe(true)
|
|
185
|
+
|
|
186
|
+
await vi.advanceTimersByTimeAsync(10_000)
|
|
187
|
+
await nextTick()
|
|
188
|
+
|
|
189
|
+
expect(wrapper.text()).toContain('Overtime 5s')
|
|
190
|
+
expect(wrapper.find('.aimd-step-timer__hero--overtime').exists()).toBe(true)
|
|
191
|
+
})
|
|
192
|
+
|
|
193
|
+
it('shows countdown and elapsed time together in both mode', () => {
|
|
194
|
+
const state = reactive(createEmptyStepRecordItem())
|
|
195
|
+
const wrapper = mount(AimdStepField, {
|
|
196
|
+
props: {
|
|
197
|
+
...createBaseProps({
|
|
198
|
+
estimated_duration_ms: 60_000,
|
|
199
|
+
timer_mode: 'both',
|
|
200
|
+
}),
|
|
201
|
+
state,
|
|
202
|
+
},
|
|
203
|
+
})
|
|
204
|
+
|
|
205
|
+
expect(wrapper.find('.aimd-step-field__details').exists()).toBe(true)
|
|
206
|
+
expect(wrapper.text()).toContain('Remain 1m')
|
|
207
|
+
expect(wrapper.text()).toContain('Timer 0s')
|
|
208
|
+
})
|
|
209
|
+
|
|
210
|
+
it('renders check cards as lightweight cards that absorb body text and checked state messaging', () => {
|
|
211
|
+
const node: AimdCheckNode = {
|
|
212
|
+
id: 'verify_tube_label',
|
|
213
|
+
label: 'Verify that the tube label matches the sample name and the processing batch identifier before continuing',
|
|
214
|
+
fieldType: 'check',
|
|
215
|
+
scope: 'check',
|
|
216
|
+
type: 'aimd',
|
|
217
|
+
raw: '{{check|verify_tube_label}}',
|
|
218
|
+
checked_message: 'Tube label verified',
|
|
219
|
+
}
|
|
220
|
+
const wrapper = mount(AimdCheckField, {
|
|
221
|
+
props: {
|
|
222
|
+
node,
|
|
223
|
+
state: reactive({
|
|
224
|
+
checked: true,
|
|
225
|
+
annotation: 'Resolved from assigner context',
|
|
226
|
+
}),
|
|
227
|
+
bodyNodes: [
|
|
228
|
+
h('p', 'Verify that the tube label matches the sample name before continuing.'),
|
|
229
|
+
],
|
|
230
|
+
disabled: false,
|
|
231
|
+
extraClasses: [],
|
|
232
|
+
messages: createAimdRecorderMessages('en-US'),
|
|
233
|
+
},
|
|
234
|
+
})
|
|
235
|
+
|
|
236
|
+
expect(wrapper.element.tagName).toBe('DIV')
|
|
237
|
+
expect(wrapper.find('.aimd-check-field__body').text()).toContain('Verify that the tube label matches the sample name before continuing.')
|
|
238
|
+
expect(wrapper.find('.aimd-check-field__body--checked').exists()).toBe(true)
|
|
239
|
+
expect(wrapper.find('.aimd-check-field__banner').text()).toContain('Tube label verified')
|
|
240
|
+
expect(wrapper.find('.aimd-rec-inline__input--annotation').exists()).toBe(true)
|
|
241
|
+
expect((wrapper.find('.aimd-rec-inline__input--annotation').element as HTMLInputElement).value).toBe('Resolved from assigner context')
|
|
242
|
+
expect(wrapper.find('.aimd-check-field__key').exists()).toBe(false)
|
|
243
|
+
})
|
|
244
|
+
|
|
245
|
+
it('falls back to the check id when no body text is available', () => {
|
|
246
|
+
const node: AimdCheckNode = {
|
|
247
|
+
id: 'verify_tube_label',
|
|
248
|
+
label: 'verify_tube_label',
|
|
249
|
+
fieldType: 'check',
|
|
250
|
+
scope: 'check',
|
|
251
|
+
type: 'aimd',
|
|
252
|
+
raw: '{{check|verify_tube_label}}',
|
|
253
|
+
}
|
|
254
|
+
const wrapper = mount(AimdCheckField, {
|
|
255
|
+
props: {
|
|
256
|
+
node,
|
|
257
|
+
state: reactive({
|
|
258
|
+
checked: false,
|
|
259
|
+
annotation: '',
|
|
260
|
+
}),
|
|
261
|
+
bodyNodes: [],
|
|
262
|
+
disabled: false,
|
|
263
|
+
extraClasses: [],
|
|
264
|
+
messages: createAimdRecorderMessages('en-US'),
|
|
265
|
+
},
|
|
266
|
+
})
|
|
267
|
+
|
|
268
|
+
expect(wrapper.find('.aimd-check-field__key').text()).toBe('verify_tube_label')
|
|
269
|
+
})
|
|
270
|
+
})
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { describe, expect, it } from 'vitest'
|
|
2
|
+
|
|
3
|
+
import { BUILT_IN_AIMD_TYPE_PLUGINS, createAimdTypePlugins, resolveAimdTypePlugin } from '../type-plugins'
|
|
4
|
+
import { getVarInputDisplayValue, getVarInputKind, parseVarInputValue } from '../composables/useVarHelpers'
|
|
5
|
+
import type { AimdTypePlugin } from '../types'
|
|
6
|
+
|
|
7
|
+
describe('type-plugins', () => {
|
|
8
|
+
it('includes built-in recorder plugins for official interactive types', () => {
|
|
9
|
+
const dnaPlugin = resolveAimdTypePlugin('DNASequence', BUILT_IN_AIMD_TYPE_PLUGINS)
|
|
10
|
+
expect(dnaPlugin?.type).toBe('DNASequence')
|
|
11
|
+
expect(dnaPlugin?.inputKind).toBe('dna')
|
|
12
|
+
|
|
13
|
+
const markdownPlugin = resolveAimdTypePlugin('AiralogyMarkdown', BUILT_IN_AIMD_TYPE_PLUGINS)
|
|
14
|
+
expect(markdownPlugin?.type).toBe('AiralogyMarkdown')
|
|
15
|
+
expect(markdownPlugin?.inputKind).toBe('textarea')
|
|
16
|
+
|
|
17
|
+
const pythonCodePlugin = resolveAimdTypePlugin('PyStr', BUILT_IN_AIMD_TYPE_PLUGINS)
|
|
18
|
+
expect(pythonCodePlugin?.type).toBe('PyStr')
|
|
19
|
+
expect(pythonCodePlugin?.inputKind).toBe('code')
|
|
20
|
+
|
|
21
|
+
const genericCodePlugin = resolveAimdTypePlugin('CodeStr', BUILT_IN_AIMD_TYPE_PLUGINS)
|
|
22
|
+
expect(genericCodePlugin?.type).toBe('CodeStr')
|
|
23
|
+
expect(genericCodePlugin?.inputKind).toBe('code')
|
|
24
|
+
})
|
|
25
|
+
|
|
26
|
+
it('uses a dedicated recorder widget for AiralogyMarkdown', () => {
|
|
27
|
+
const plugin = resolveAimdTypePlugin('AiralogyMarkdown', BUILT_IN_AIMD_TYPE_PLUGINS)
|
|
28
|
+
expect(plugin?.type).toBe('AiralogyMarkdown')
|
|
29
|
+
expect(typeof plugin?.renderField).toBe('function')
|
|
30
|
+
})
|
|
31
|
+
|
|
32
|
+
it('lets host plugins override built-in type behavior', () => {
|
|
33
|
+
const customPlugin: AimdTypePlugin = {
|
|
34
|
+
type: 'DNASequence',
|
|
35
|
+
inputKind: 'textarea',
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
const resolved = resolveAimdTypePlugin('DNASequence', createAimdTypePlugins([customPlugin]))
|
|
39
|
+
expect(resolved).toBe(customPlugin)
|
|
40
|
+
expect(getVarInputKind('DNASequence', { typePlugin: resolved })).toBe('textarea')
|
|
41
|
+
})
|
|
42
|
+
|
|
43
|
+
it('uses custom plugin parse and display hooks when provided', () => {
|
|
44
|
+
const customPlugin: AimdTypePlugin = {
|
|
45
|
+
type: 'MicroscopeCapture',
|
|
46
|
+
inputKind: 'text',
|
|
47
|
+
parseInputValue: ({ rawValue }) => ({ raw: rawValue, parsed: true }),
|
|
48
|
+
getDisplayValue: ({ value }) => JSON.stringify(value),
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
expect(
|
|
52
|
+
parseVarInputValue('capture-001', 'MicroscopeCapture', 'text', { typePlugin: customPlugin }),
|
|
53
|
+
).toEqual({ raw: 'capture-001', parsed: true })
|
|
54
|
+
|
|
55
|
+
expect(
|
|
56
|
+
getVarInputDisplayValue({ capture: 1 }, 'text', { type: 'MicroscopeCapture', typePlugin: customPlugin }),
|
|
57
|
+
).toBe(JSON.stringify({ capture: 1 }))
|
|
58
|
+
})
|
|
59
|
+
})
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { readFileSync } from 'node:fs'
|
|
2
|
+
import { dirname, resolve } from 'node:path'
|
|
3
|
+
import { fileURLToPath } from 'node:url'
|
|
4
|
+
import { describe, expect, it } from 'vitest'
|
|
5
|
+
|
|
6
|
+
const __filename = fileURLToPath(import.meta.url)
|
|
7
|
+
const __dirname = dirname(__filename)
|
|
8
|
+
const source = readFileSync(resolve(__dirname, '../components/AimdVarField.vue'), 'utf8')
|
|
9
|
+
|
|
10
|
+
describe('AimdVarField render behavior', () => {
|
|
11
|
+
it('shares compact layout syncing between textareas and single-line inputs', () => {
|
|
12
|
+
expect(source).toMatch(/function syncCompactControlLayout\(control: HTMLInputElement \| HTMLTextAreaElement\)/)
|
|
13
|
+
expect(source).toMatch(/if \(typeof HTMLTextAreaElement !== "undefined" && control instanceof HTMLTextAreaElement\) \{\s*syncAutoWrapTextareaHeight\(control\)\s*\}/)
|
|
14
|
+
})
|
|
15
|
+
|
|
16
|
+
it('resizes single-line inputs while the user types', () => {
|
|
17
|
+
expect(source).toMatch(/onInput: \(event: Event\) => \{\s*const el = event\.target as HTMLInputElement\s*syncCompactControlLayout\(el\)\s*onVarChange\(el\.value\)\s*\}/)
|
|
18
|
+
})
|
|
19
|
+
|
|
20
|
+
it('renders code-like vars with the dedicated code editor field', () => {
|
|
21
|
+
expect(source).toMatch(/const AimdCodeField = defineAsyncComponent\(\(\) => import\("\.\/AimdCodeField\.vue"\)\)/)
|
|
22
|
+
expect(source).toMatch(/if \(inputKind === "code"\)/)
|
|
23
|
+
expect(source).toMatch(/language: codeLanguage/)
|
|
24
|
+
expect(source).toMatch(/"aimd-rec-inline--var-stacked--code"/)
|
|
25
|
+
})
|
|
26
|
+
})
|