check the test with main branch
This commit is contained in:
parent
6de2994860
commit
b971c0fb49
3 changed files with 10 additions and 26 deletions
|
|
@ -148,14 +148,6 @@ export class GUISelectors {
|
|||
}
|
||||
|
||||
public static getThreadMessageByText(view: WebView, text: string) {
|
||||
void view.findElement(By.xpath(`//*[@class="thread-message"]`)).then(e=>{
|
||||
console.log('debug1 thread element: ', e);
|
||||
});
|
||||
|
||||
void view.findElement(By.xpath(`//*[@class="thread-message"]`)).getText().then(e=>{
|
||||
console.log('debug1 thread message: ', e);
|
||||
});
|
||||
|
||||
return view.findWebElement(
|
||||
By.xpath(`//*[@class="thread-message"]//*[contains(text(), "${text}")]`),
|
||||
);
|
||||
|
|
|
|||
|
|
@ -389,7 +389,7 @@ describe("GUI Test", () => {
|
|||
await messageInput.sendKeys("Hello");
|
||||
await messageInput.sendKeys(Key.ENTER);
|
||||
await TestUtils.waitForSuccess(() =>
|
||||
GUISelectors.getThreadMessageByText(view, "TEST_SYS_MSG"),
|
||||
GUISelectors.getThreadMessageByText(view, "TEST_SYS_MSG2"),
|
||||
);
|
||||
});
|
||||
});
|
||||
|
|
|
|||
|
|
@ -22,11 +22,8 @@ import { visit } from "unist-util-visit";
|
|||
*/
|
||||
export function remarkTables() {
|
||||
return (tree: any) => {
|
||||
visit(tree, "paragraph", (paragraphNode, index, parentOfParagraphNode) => {
|
||||
let buffer = "";
|
||||
visit(paragraphNode, "text", (textNode) => {
|
||||
buffer += textNode.value;
|
||||
});
|
||||
visit(tree, "text", (node, index, parent) => {
|
||||
const { value } = node;
|
||||
|
||||
const tableRegex =
|
||||
/((?:\| *[^|\r\n]+ *)+\|)(?:\r?\n)((?:\|[ :]?-+[ :]?)+\|)((?:(?:\r?\n)(?:\| *[^|\r\n]+ *)+\|)+)/g;
|
||||
|
|
@ -36,8 +33,7 @@ export function remarkTables() {
|
|||
let lastIndex = 0;
|
||||
const newNodes = [];
|
||||
let failed = false;
|
||||
|
||||
while ((match = tableRegex.exec(buffer)) !== null) {
|
||||
while ((match = tableRegex.exec(value)) !== null) {
|
||||
const fullTableString = match[0];
|
||||
const headerGroup = match[1];
|
||||
const separatorGroup = match[2];
|
||||
|
|
@ -66,11 +62,6 @@ export function remarkTables() {
|
|||
const tableNode = {
|
||||
type: "table",
|
||||
align: alignments,
|
||||
data: {
|
||||
hProperties: {
|
||||
class: "markdown-table",
|
||||
},
|
||||
},
|
||||
children: [
|
||||
{
|
||||
type: "tableRow",
|
||||
|
|
@ -86,6 +77,7 @@ export function remarkTables() {
|
|||
type: "tableRow",
|
||||
data: {
|
||||
hProperties: {
|
||||
class: "markdown-table",
|
||||
key: i,
|
||||
},
|
||||
},
|
||||
|
|
@ -103,7 +95,7 @@ export function remarkTables() {
|
|||
if (match.index > lastIndex) {
|
||||
newNodes.push({
|
||||
type: "text",
|
||||
value: buffer.slice(lastIndex, match.index),
|
||||
value: value.slice(lastIndex, match.index),
|
||||
});
|
||||
}
|
||||
|
||||
|
|
@ -125,16 +117,16 @@ export function remarkTables() {
|
|||
}
|
||||
|
||||
// Add any remaining text after the last table
|
||||
if (lastIndex < buffer.length) {
|
||||
if (lastIndex < value.length) {
|
||||
newNodes.push({
|
||||
type: "text",
|
||||
value: buffer.slice(lastIndex),
|
||||
value: value.slice(lastIndex),
|
||||
});
|
||||
}
|
||||
|
||||
// Replace the original paragraph node with the new nodes
|
||||
// Replace the original text node with the new nodes
|
||||
if (newNodes.length > 0) {
|
||||
parentOfParagraphNode.children.splice(index, 1, ...newNodes);
|
||||
parent.children.splice(index, 1, ...newNodes);
|
||||
}
|
||||
});
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue