Skip to content

Commit

Permalink
update: test added
Browse files Browse the repository at this point in the history
  • Loading branch information
Bayheck committed Nov 25, 2024
1 parent 739a3dd commit 974ed2e
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 0 deletions.
23 changes: 23 additions & 0 deletions test/functional/fixtures/regression/gh-8321/pages/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
</head>
<body>
<div contenteditable="true">
<div id="myText">example</div>
</div>
</body>
<script>
const element = document.getElementById("myText");
element.addEventListener("click", () => {
const selection = document.getSelection();
const range = document.createRange();

range.selectNodeContents(element);
range.collapse(false);
selection.removeAllRanges();
selection.addRange(range);
});
</script>
</html>
5 changes: 5 additions & 0 deletions test/functional/fixtures/regression/gh-8321/test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
describe('[Regression](GH-8321)', function () {
it('Test should not fail with Uncaught object error on typeText', function () {
return runTests('testcafe-fixtures/index.js', 'Callsite Issue', { only: 'chrome' });
});
});
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import { Selector } from 'testcafe';

fixture('GH-8321 - Callsite Issue')
.page`http://localhost:3000/fixtures/regression/gh-8321/pages/index.html`;

test('Callsite Issue', async t => {
const editor = Selector('[contenteditable=true]');

await t.click(editor);
await t.typeText(editor, 'text1');
});

0 comments on commit 974ed2e

Please sign in to comment.