提交 7e111c4c 编写于 作者: DCloud-WZF's avatar DCloud-WZF :speech_balloon:

refactor(uts): 自动化测试优化 TextElement 判断

上级 c0236808
......@@ -102,7 +102,8 @@ export const getDOMProperties = (
if (dom != null) {
const properties = params.names.map((name: string): any | null => {
if (name == 'innerText') {
if (dom.tagName == 'TEXT' || dom.tagName == 'UNI-BUTTON-ELEMENT') {
// @ts-expect-error
if (isTextElement(dom)) {
return dom.getAttribute('value')
} else {
return getChildrenText(dom)
......
......@@ -193,6 +193,7 @@ export function getValidComponentsOrNodes(
})
} else {
list.push({
// @ts-expect-error
elementId: (vnode.el as UniElementImpl).id,
tagName: vnode.el!.tagName,
})
......@@ -292,7 +293,8 @@ export function getChildrenText(node: UniElement): string {
let result = ''
// @ts-ignore
node.childNodes.forEach((child: UniElement) => {
if (child.tagName == 'TEXT' || child.tagName == 'UNI-BUTTON-ELEMENT') {
// @ts-expect-error
if (isTextElement(child)) {
result += child.getAttribute('value')
} else {
result += getChildrenText(child)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册
新手
引导
客服 返回
顶部