-
Notifications
You must be signed in to change notification settings - Fork 323
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixes #9314 The node deletion does not remove AST node from the module, only unpin it from its parent; so undoing does not add this node, just modify it, and thus we weren't informed about metadata change.
- Loading branch information
Showing
8 changed files
with
95 additions
and
34 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
import test, { type Locator, type Page } from 'playwright/test' | ||
import * as actions from './actions' | ||
import { expect } from './customExpect' | ||
import { mockMethodCallInfo } from './expressionUpdates' | ||
import * as locate from './locate' | ||
|
||
test('Adding new node', async ({ page }) => { | ||
await actions.goToGraph(page) | ||
|
||
const nodesCount = await locate.graphNode(page).count() | ||
await locate.addNewNodeButton(page).click() | ||
await expect(locate.componentBrowserInput(page)).toBeVisible() | ||
await page.keyboard.insertText('foo') | ||
await page.keyboard.press('Control+Enter') | ||
await expect(locate.graphNode(page)).toHaveCount(nodesCount + 1) | ||
await expect(locate.graphNode(page).last().locator('.WidgetToken')).toHaveText(['foo']) | ||
const newNodeBBox = await locate.graphNode(page).last().boundingBox() | ||
|
||
await page.keyboard.press('Control+Z') | ||
await expect(locate.graphNode(page)).toHaveCount(nodesCount) | ||
await expect( | ||
locate.graphNode(page).locator('.WidgetToken').filter({ hasText: 'foo' }), | ||
).toHaveCount(0) | ||
|
||
await page.keyboard.press('Control+Shift+Z') | ||
await expect(locate.graphNode(page)).toHaveCount(nodesCount + 1) | ||
await expect(locate.graphNode(page).last().locator('.WidgetToken')).toHaveText(['foo']) | ||
const restoredBox = await locate.graphNode(page).last().boundingBox() | ||
await expect(restoredBox).toEqual(newNodeBBox) | ||
}) | ||
|
||
test('Removing node', async ({ page }) => { | ||
await actions.goToGraph(page) | ||
|
||
const nodesCount = await locate.graphNode(page).count() | ||
const deletedNode = locate.graphNodeByBinding(page, 'final') | ||
const deletedNodeBBox = await deletedNode.boundingBox() | ||
await deletedNode.click() | ||
await page.keyboard.press('Delete') | ||
await expect(locate.graphNode(page)).toHaveCount(nodesCount - 1) | ||
|
||
await page.keyboard.press('Control+Z') | ||
await expect(locate.graphNode(page)).toHaveCount(nodesCount) | ||
await expect(deletedNode.locator('.WidgetToken')).toHaveText(['Main', '.', 'func1', 'prod']) | ||
await expect(deletedNode.locator('.GraphNodeComment')).toHaveText('This node can be entered') | ||
const restoredBBox = await deletedNode.boundingBox() | ||
await expect(restoredBBox).toEqual(deletedNodeBBox) | ||
|
||
await page.keyboard.press('Control+Shift+Z') | ||
await expect(locate.graphNode(page)).toHaveCount(nodesCount - 1) | ||
await expect(deletedNode).not.toBeVisible() | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters