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

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

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