editor: fix task-list tests

This commit is contained in:
Abdullah Atta
2023-03-20 18:03:36 +05:00
committed by Abdullah Atta
parent 9ea675ded1
commit 03803dbc23
4 changed files with 330 additions and 151 deletions

View File

@@ -63,6 +63,8 @@
"happy-dom": "^8.9.0",
"isomorphic-fetch": "^3.0.0",
"prosemirror-test-builder": "^1.1.0",
"react": "17.0.2",
"react-dom": "17.0.2",
"typescript": "^4.8.2",
"vitest": "^0.29.2",
"web-vitals": "^2.1.4",
@@ -3475,6 +3477,19 @@
"react-dom": "^16.13.1 || ^17.0.0 || ^18.0.0"
}
},
"node_modules/react": {
"version": "17.0.2",
"resolved": "https://registry.npmjs.org/react/-/react-17.0.2.tgz",
"integrity": "sha512-gnhPt75i/dq/z3/6q/0asP78D0u592D5L1pd7M8P+dck6Fu/jJeL6iVVK23fptSUZj8Vjf++7wXA8UNclGQcbA==",
"dev": true,
"dependencies": {
"loose-envify": "^1.1.0",
"object-assign": "^4.1.1"
},
"engines": {
"node": ">=0.10.0"
}
},
"node_modules/react-colorful": {
"version": "5.6.1",
"resolved": "https://registry.npmjs.org/react-colorful/-/react-colorful-5.6.1.tgz",
@@ -3484,6 +3499,20 @@
"react-dom": ">=16.8.0"
}
},
"node_modules/react-dom": {
"version": "17.0.2",
"resolved": "https://registry.npmjs.org/react-dom/-/react-dom-17.0.2.tgz",
"integrity": "sha512-s4h96KtLDUQlsENhMn1ar8t2bEa+q/YAtj8pPPdIjPDGBDIVNsrD9aXNWqspUe6AzKCIG0C1HZZLqLV7qpOBGA==",
"dev": true,
"dependencies": {
"loose-envify": "^1.1.0",
"object-assign": "^4.1.1",
"scheduler": "^0.20.2"
},
"peerDependencies": {
"react": "17.0.2"
}
},
"node_modules/react-is": {
"version": "16.13.1",
"resolved": "https://registry.npmjs.org/react-is/-/react-is-16.13.1.tgz",
@@ -3662,6 +3691,16 @@
"resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz",
"integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg=="
},
"node_modules/scheduler": {
"version": "0.20.2",
"resolved": "https://registry.npmjs.org/scheduler/-/scheduler-0.20.2.tgz",
"integrity": "sha512-2eWfGgAqqWFGqtdMmcL5zCMK1U8KlXv8SQFGglL3CEtd0aDVDWgeF/YoCmvln55m5zSk3J/20hTaSBeSObsQDQ==",
"dev": true,
"dependencies": {
"loose-envify": "^1.1.0",
"object-assign": "^4.1.1"
}
},
"node_modules/siginfo": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/siginfo/-/siginfo-2.0.0.tgz",
@@ -6883,11 +6922,32 @@
"resolved": "https://registry.npmjs.org/re-resizable/-/re-resizable-6.9.9.tgz",
"integrity": "sha512-l+MBlKZffv/SicxDySKEEh42hR6m5bAHfNu3Tvxks2c4Ah+ldnWjfnVRwxo/nxF27SsUsxDS0raAzFuJNKABXA=="
},
"react": {
"version": "17.0.2",
"resolved": "https://registry.npmjs.org/react/-/react-17.0.2.tgz",
"integrity": "sha512-gnhPt75i/dq/z3/6q/0asP78D0u592D5L1pd7M8P+dck6Fu/jJeL6iVVK23fptSUZj8Vjf++7wXA8UNclGQcbA==",
"dev": true,
"requires": {
"loose-envify": "^1.1.0",
"object-assign": "^4.1.1"
}
},
"react-colorful": {
"version": "5.6.1",
"resolved": "https://registry.npmjs.org/react-colorful/-/react-colorful-5.6.1.tgz",
"integrity": "sha512-1exovf0uGTGyq5mXQT0zgQ80uvj2PCwvF8zY1RN9/vbJVSjSo3fsB/4L3ObbF7u70NduSiK4xu4Y6q1MHoUGEw=="
},
"react-dom": {
"version": "17.0.2",
"resolved": "https://registry.npmjs.org/react-dom/-/react-dom-17.0.2.tgz",
"integrity": "sha512-s4h96KtLDUQlsENhMn1ar8t2bEa+q/YAtj8pPPdIjPDGBDIVNsrD9aXNWqspUe6AzKCIG0C1HZZLqLV7qpOBGA==",
"dev": true,
"requires": {
"loose-envify": "^1.1.0",
"object-assign": "^4.1.1",
"scheduler": "^0.20.2"
}
},
"react-is": {
"version": "16.13.1",
"resolved": "https://registry.npmjs.org/react-is/-/react-is-16.13.1.tgz",
@@ -6998,6 +7058,16 @@
"resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz",
"integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg=="
},
"scheduler": {
"version": "0.20.2",
"resolved": "https://registry.npmjs.org/scheduler/-/scheduler-0.20.2.tgz",
"integrity": "sha512-2eWfGgAqqWFGqtdMmcL5zCMK1U8KlXv8SQFGglL3CEtd0aDVDWgeF/YoCmvln55m5zSk3J/20hTaSBeSObsQDQ==",
"dev": true,
"requires": {
"loose-envify": "^1.1.0",
"object-assign": "^4.1.1"
}
},
"siginfo": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/siginfo/-/siginfo-2.0.0.tgz",

View File

@@ -62,7 +62,9 @@
"typescript": "^4.8.2",
"vitest": "^0.29.2",
"web-vitals": "^2.1.4",
"zx": "^7.0.8"
"zx": "^7.0.8",
"react": "17.0.2",
"react-dom": "17.0.2"
},
"peerDependencies": {
"@mdi/js": ">=6.9.96",

View File

@@ -39,85 +39,96 @@ exports[`delete checked items in a nested task list 1`] = `
"type": "paragraph",
},
{
"attrs": {
"title": null,
},
"content": [
{
"text": "Task item 4",
"type": "text",
"attrs": {
"checked": false,
},
"content": [
{
"content": [
{
"text": "Task item 5",
"type": "text",
},
],
"type": "paragraph",
},
],
"type": "taskItem",
},
],
"type": "paragraph",
},
{
"content": [
{
"text": "Task item 5",
"type": "text",
"attrs": {
"checked": false,
},
"content": [
{
"content": [
{
"text": "Task item 6",
"type": "text",
},
],
"type": "paragraph",
},
{
"attrs": {
"title": null,
},
"content": [
{
"attrs": {
"checked": false,
},
"content": [
{
"content": [
{
"text": "Task item 9",
"type": "text",
},
],
"type": "paragraph",
},
{
"attrs": {
"title": null,
},
"content": [
{
"attrs": {
"checked": false,
},
"content": [
{
"content": [
{
"text": "Task item 12",
"type": "text",
},
],
"type": "paragraph",
},
],
"type": "taskItem",
},
],
"type": "taskList",
},
],
"type": "taskItem",
},
],
"type": "taskList",
},
],
"type": "taskItem",
},
],
"type": "paragraph",
},
{
"content": [
{
"text": "Task item 6",
"type": "text",
},
],
"type": "paragraph",
},
{
"content": [
{
"text": "Task item 7",
"type": "text",
},
],
"type": "paragraph",
},
{
"content": [
{
"text": "Task item 8",
"type": "text",
},
],
"type": "paragraph",
},
{
"content": [
{
"text": "Task item 9",
"type": "text",
},
],
"type": "paragraph",
},
{
"content": [
{
"text": "Task item 10",
"type": "text",
},
],
"type": "paragraph",
},
{
"content": [
{
"text": "Task item 11",
"type": "text",
},
],
"type": "paragraph",
},
{
"content": [
{
"text": "Task item 12",
"type": "text",
},
],
"type": "paragraph",
"type": "taskList",
},
],
"type": "taskItem",
@@ -197,85 +208,181 @@ exports[`sort checked items to the bottom of the task list 1`] = `
"type": "paragraph",
},
{
"attrs": {
"title": null,
},
"content": [
{
"text": "Task item 4",
"type": "text",
"attrs": {
"checked": false,
},
"content": [
{
"content": [
{
"text": "Task item 5",
"type": "text",
},
],
"type": "paragraph",
},
],
"type": "taskItem",
},
],
"type": "paragraph",
},
{
"content": [
{
"text": "Task item 5",
"type": "text",
"attrs": {
"checked": false,
},
"content": [
{
"content": [
{
"text": "Task item 6",
"type": "text",
},
],
"type": "paragraph",
},
{
"attrs": {
"title": null,
},
"content": [
{
"attrs": {
"checked": false,
},
"content": [
{
"content": [
{
"text": "Task item 9",
"type": "text",
},
],
"type": "paragraph",
},
{
"attrs": {
"title": null,
},
"content": [
{
"attrs": {
"checked": false,
},
"content": [
{
"content": [
{
"text": "Task item 12",
"type": "text",
},
],
"type": "paragraph",
},
],
"type": "taskItem",
},
{
"attrs": {
"checked": true,
},
"content": [
{
"content": [
{
"text": "Task item 10",
"type": "text",
},
],
"type": "paragraph",
},
],
"type": "taskItem",
},
{
"attrs": {
"checked": true,
},
"content": [
{
"content": [
{
"text": "Task item 11",
"type": "text",
},
],
"type": "paragraph",
},
],
"type": "taskItem",
},
],
"type": "taskList",
},
],
"type": "taskItem",
},
{
"attrs": {
"checked": true,
},
"content": [
{
"content": [
{
"text": "Task item 7",
"type": "text",
},
],
"type": "paragraph",
},
],
"type": "taskItem",
},
{
"attrs": {
"checked": true,
},
"content": [
{
"content": [
{
"text": "Task item 8",
"type": "text",
},
],
"type": "paragraph",
},
],
"type": "taskItem",
},
],
"type": "taskList",
},
],
"type": "taskItem",
},
],
"type": "paragraph",
},
{
"content": [
{
"text": "Task item 6",
"type": "text",
"attrs": {
"checked": true,
},
"content": [
{
"content": [
{
"text": "Task item 4",
"type": "text",
},
],
"type": "paragraph",
},
],
"type": "taskItem",
},
],
"type": "paragraph",
},
{
"content": [
{
"text": "Task item 7",
"type": "text",
},
],
"type": "paragraph",
},
{
"content": [
{
"text": "Task item 8",
"type": "text",
},
],
"type": "paragraph",
},
{
"content": [
{
"text": "Task item 9",
"type": "text",
},
],
"type": "paragraph",
},
{
"content": [
{
"text": "Task item 10",
"type": "text",
},
],
"type": "paragraph",
},
{
"content": [
{
"text": "Task item 11",
"type": "text",
},
],
"type": "paragraph",
},
{
"content": [
{
"text": "Task item 12",
"type": "text",
},
],
"type": "paragraph",
"type": "taskList",
},
],
"type": "taskItem",

View File

@@ -76,7 +76,7 @@ test(`count items in a task list`, async () => {
builder: { taskItem, taskList }
} = createEditor({
extensions: {
taskItem: TaskItemNode,
taskItem: TaskItemNode.configure({ nested: true }),
taskList: TaskListNode
}
});
@@ -103,7 +103,7 @@ test(`delete checked items in a task list`, async () => {
taskItem("Task item 2")
).outerHTML,
extensions: {
taskItem: TaskItemNode,
taskItem: TaskItemNode.configure({ nested: true }),
taskList: TaskListNode
}
});
@@ -117,7 +117,7 @@ test(`delete checked items in a nested task list`, async () => {
const { editor } = createEditor({
initialContent: NESTED_TASK_LIST,
extensions: {
taskItem: TaskItemNode,
taskItem: TaskItemNode.configure({ nested: true }),
taskList: TaskListNode
}
});
@@ -145,7 +145,7 @@ test(`delete checked items in a task list with no checked items should do nothin
)
).outerHTML,
extensions: {
taskItem: TaskItemNode,
taskItem: TaskItemNode.configure({ nested: true }),
taskList: TaskListNode
}
});
@@ -160,7 +160,7 @@ test(`sort checked items to the bottom of the task list`, async () => {
const { editor } = createEditor({
initialContent: NESTED_TASK_LIST,
extensions: {
taskItem: TaskItemNode,
taskItem: TaskItemNode.configure({ nested: true }),
taskList: TaskListNode
}
});
@@ -175,7 +175,7 @@ test(`sorting a task list with no checked items should do nothing`, async () =>
initialContent: taskList(taskItem("Task item 1"), taskItem("Task item 2"))
.outerHTML,
extensions: {
taskItem: TaskItemNode,
taskItem: TaskItemNode.configure({ nested: true }),
taskList: TaskListNode
}
});