Skip to content

Commit

Permalink
test: add test to delete last character using Backspace in input comp…
Browse files Browse the repository at this point in the history
…onent
  • Loading branch information
Franlop7 committed Oct 11, 2024
1 parent 9f10ad5 commit cfe86be
Showing 1 changed file with 34 additions and 0 deletions.
34 changes: 34 additions & 0 deletions e2e/inline-edit/simple-inline-edit.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,3 +27,37 @@ test('can add input component to canvas and edit', async ({ page }) => {
);
expect(textShape).toBeDefined();
});

test('can add and edit input, and delete last letter', 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('Backspace');

const updatedInputValue = await input.inputValue();
expect(updatedInputValue).toEqual('use');

await page.keyboard.press('Enter');

const inputShape = (await getByShapeType(page, 'input')) as Group;
expect(inputShape).toBeDefined();
const textShape = inputShape.children.find(
child => child.attrs.text === 'use'
);
expect(textShape).toBeDefined();
});

0 comments on commit cfe86be

Please sign in to comment.