fix: locator.fill should work for textareas (#10737)
Co-authored-by: Nikolay Vitkov <34244704+Lightning00Blade@users.noreply.github.com>
This commit is contained in:
parent
0a686fbf24
commit
fc08a7dd54
@ -476,6 +476,9 @@ export abstract class Locator<T> extends EventEmitter {
|
|||||||
if (el instanceof HTMLSelectElement) {
|
if (el instanceof HTMLSelectElement) {
|
||||||
return 'select';
|
return 'select';
|
||||||
}
|
}
|
||||||
|
if (el instanceof HTMLTextAreaElement) {
|
||||||
|
return 'typeable-input';
|
||||||
|
}
|
||||||
if (el instanceof HTMLInputElement) {
|
if (el instanceof HTMLInputElement) {
|
||||||
if (
|
if (
|
||||||
new Set([
|
new Set([
|
||||||
|
@ -370,7 +370,28 @@ describe('Locator', function () {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('Locator.change', function () {
|
describe('Locator.fill', function () {
|
||||||
|
it('should work for textarea', async () => {
|
||||||
|
const {page} = await getTestState();
|
||||||
|
|
||||||
|
await page.setContent(`
|
||||||
|
<textarea></textarea>
|
||||||
|
`);
|
||||||
|
let filled = false;
|
||||||
|
await page
|
||||||
|
.locator('textarea')
|
||||||
|
.on(LocatorEmittedEvents.Action, () => {
|
||||||
|
filled = true;
|
||||||
|
})
|
||||||
|
.fill('test');
|
||||||
|
expect(
|
||||||
|
await page.evaluate(() => {
|
||||||
|
return document.querySelector('textarea')?.value === 'test';
|
||||||
|
})
|
||||||
|
).toBe(true);
|
||||||
|
expect(filled).toBe(true);
|
||||||
|
});
|
||||||
|
|
||||||
it('should work for selects', async () => {
|
it('should work for selects', async () => {
|
||||||
const {page} = await getTestState();
|
const {page} = await getTestState();
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user