feat: 语音的问题修复
This commit is contained in:
39
scripts/regression-chat-input-area-voice.mjs
Normal file
39
scripts/regression-chat-input-area-voice.mjs
Normal file
@@ -0,0 +1,39 @@
|
||||
import assert from "node:assert/strict";
|
||||
import { readFileSync } from "node:fs";
|
||||
import { dirname, resolve } from "node:path";
|
||||
import { fileURLToPath } from "node:url";
|
||||
|
||||
const scriptDir = dirname(fileURLToPath(import.meta.url));
|
||||
const componentPath = resolve(
|
||||
scriptDir,
|
||||
"../src/pages/ChatMain/ChatInputArea/index.vue"
|
||||
);
|
||||
const source = readFileSync(componentPath, "utf8");
|
||||
|
||||
const handlerMatch = source.match(
|
||||
/const\s+handleVoiceTouchEndFromContainer\s*=\s*\(\)\s*=>\s*{([\s\S]*?)\n};/
|
||||
);
|
||||
|
||||
assert.ok(
|
||||
handlerMatch,
|
||||
"ChatInputArea should define handleVoiceTouchEndFromContainer"
|
||||
);
|
||||
|
||||
const handlerBody = handlerMatch[1];
|
||||
|
||||
assert.ok(
|
||||
!/speechProvider\s*!==\s*["']app["']/.test(handlerBody),
|
||||
"container touchend must not ignore WeChat recordings because the pressed button can unmount while RecordingWaveBtn is shown"
|
||||
);
|
||||
|
||||
assert.ok(
|
||||
/hasActiveVoiceRecognition\(\)/.test(handlerBody),
|
||||
"container touchend should only stop when a voice recognition session is active"
|
||||
);
|
||||
|
||||
assert.ok(
|
||||
/stopActiveVoiceRecognition\(\{\s*shouldSend:\s*true\s*\}\)/s.test(
|
||||
handlerBody
|
||||
),
|
||||
"container touchend should stop the active recognition and send recognized text"
|
||||
);
|
||||
Reference in New Issue
Block a user