Skip to content

Commit

Permalink
Merge pull request #454 from Lemoncode/#436/QA/inline-edit-esc-key-ca…
Browse files Browse the repository at this point in the history
…ncel-edition

#436 case added - Esc cancel inline edit
  • Loading branch information
brauliodiez authored Oct 17, 2024
2 parents 987b732 + fd3d0f3 commit 9c3daa5
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions e2e/inline-edit/simple-inline-edit.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,3 +61,29 @@ test('can add and edit input, and delete last letter', async ({ page }) => {
);
expect(textShape).toBeDefined();
});

test('can edit input, press Esc key, and cancel edition', async ({ page }) => {
await page.goto('');
const component = page.getByAltText('Input', { exact: true });

const position = await getLocatorPosition(component);
const targetPosition = {
x: position.x + 500,
y: position.y - 240,
};
await dragAndDrop(page, position, targetPosition);
await page.mouse.dblclick(targetPosition.x, targetPosition.y);
const input = page.getByRole('textbox').first();
const inputValue = await input.getAttribute('value');
expect(inputValue).toEqual('Placeholder');

const textContent = 'User';
await input.fill(textContent);
await page.keyboard.press('Escape');
const inputShape = (await getByShapeType(page, 'input')) as Group;
expect(inputShape).toBeDefined();
const textShape = inputShape.children.find(
child => child.attrs.text === 'Placeholder'
);
expect(textShape).toBeDefined();
});

0 comments on commit 9c3daa5

Please sign in to comment.