Skip to content

Commit

Permalink
Uncomment undo test
Browse files Browse the repository at this point in the history
  • Loading branch information
Skalakid committed Jul 5, 2024
1 parent 862e74a commit 0580f45
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 20 deletions.
34 changes: 15 additions & 19 deletions WebExample/__tests__/textManipulation.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,29 +46,25 @@ test.describe('paste content', () => {
expect(await getElementValue(inputLocator)).toBe(newText);
});

// test('paste undo', async ({page, browserName}) => {
// test.skip(!!process.env.CI && browserName === 'firefox', 'Excluded from Firefox CI tests');
test('paste undo', async ({page, browserName}) => {
test.skip(!!process.env.CI && browserName === 'firefox', 'Excluded from Firefox CI tests');

// const PASTE_TEXT_FIRST = '*bold*';
// const PASTE_TEXT_SECOND = '@here';

// const inputLocator = await setupInput(page, 'clear');
const PASTE_TEXT_FIRST = '*bold*';
const PASTE_TEXT_SECOND = '@here';

// await page.evaluate(async (pasteText) => navigator.clipboard.writeText(pasteText), PASTE_TEXT_FIRST);
const inputLocator = await setupInput(page, 'clear');

// await pressCmd({inputLocator, command: 'v'});
// await page.waitForTimeout(TEST_CONST.INPUT_HISTORY_DEBOUNCE_TIME_MS);
// await page.evaluate(async (pasteText) => navigator.clipboard.writeText(pasteText), PASTE_TEXT_SECOND);
// await pressCmd({inputLocator, command: 'v'});
// await page.waitForTimeout(TEST_CONST.INPUT_HISTORY_DEBOUNCE_TIME_MS);
// console.log(await getElementValue(inputLocator));
// await pressCmd({inputLocator, command: 'z'});
// await page.waitForTimeout(TEST_CONST.INPUT_HISTORY_DEBOUNCE_TIME_MS);
// console.log(await getElementValue(inputLocator), await inputLocator.innerText());
// await page.waitForTimeout(TEST_CONST.INPUT_HISTORY_DEBOUNCE_TIME_MS);
await page.evaluate(async (pasteText) => navigator.clipboard.writeText(pasteText), PASTE_TEXT_FIRST);

// expect(await getElementValue(inputLocator)).toBe(PASTE_TEXT_FIRST);
// });
await pressCmd({inputLocator, command: 'v'});
await page.waitForTimeout(TEST_CONST.INPUT_HISTORY_DEBOUNCE_TIME_MS);
await page.evaluate(async (pasteText) => navigator.clipboard.writeText(pasteText), PASTE_TEXT_SECOND);
await pressCmd({inputLocator, command: 'v'});
await page.waitForTimeout(TEST_CONST.INPUT_HISTORY_DEBOUNCE_TIME_MS);
await pressCmd({inputLocator, command: 'z'});
await page.waitForTimeout(TEST_CONST.INPUT_HISTORY_DEBOUNCE_TIME_MS);
expect(await getElementValue(inputLocator)).toBe(PASTE_TEXT_FIRST);
});

test('paste redo', async ({page}) => {
const PASTE_TEXT_FIRST = '*bold*';
Expand Down
2 changes: 1 addition & 1 deletion src/MarkdownTextInput.web.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -335,7 +335,7 @@ const MarkdownTextInput = React.forwardRef<TextInput, MarkdownTextInputProps>(
const hostNode = e.target;
e.stopPropagation();

if (e.key === 'z' && e.metaKey) {
if (e.key === 'z' && (e.ctrlKey || e.metaKey)) {
e.preventDefault();
const nativeEvent = e.nativeEvent as unknown as MarkdownNativeEvent;
if (e.shiftKey) {
Expand Down

0 comments on commit 0580f45

Please sign in to comment.