fix: allow email type in input for fill action (#353)
This commit is contained in:
parent
347123e6cc
commit
682e2be15f
|
|
@ -339,7 +339,7 @@ export const fillFunction = (node: Node) => {
|
||||||
if (element.nodeName.toLowerCase() === 'input') {
|
if (element.nodeName.toLowerCase() === 'input') {
|
||||||
const input = element as HTMLInputElement;
|
const input = element as HTMLInputElement;
|
||||||
const type = input.getAttribute('type') || '';
|
const type = input.getAttribute('type') || '';
|
||||||
const kTextInputTypes = new Set(['', 'password', 'search', 'tel', 'text', 'url']);
|
const kTextInputTypes = new Set(['', 'email', 'password', 'search', 'tel', 'text', 'url']);
|
||||||
if (!kTextInputTypes.has(type.toLowerCase()))
|
if (!kTextInputTypes.has(type.toLowerCase()))
|
||||||
return 'Cannot fill input of type "' + type + '".';
|
return 'Cannot fill input of type "' + type + '".';
|
||||||
if (input.disabled)
|
if (input.disabled)
|
||||||
|
|
|
||||||
|
|
@ -977,7 +977,7 @@ module.exports.describe = function({testRunner, expect, headless, playwright, FF
|
||||||
});
|
});
|
||||||
it('should throw on non-text inputs', async({page, server}) => {
|
it('should throw on non-text inputs', async({page, server}) => {
|
||||||
await page.goto(server.PREFIX + '/input/textarea.html');
|
await page.goto(server.PREFIX + '/input/textarea.html');
|
||||||
for (const type of ['email', 'number', 'date']) {
|
for (const type of ['color', 'number', 'date']) {
|
||||||
await page.$eval('input', (input, type) => input.setAttribute('type', type), type);
|
await page.$eval('input', (input, type) => input.setAttribute('type', type), type);
|
||||||
let error = null;
|
let error = null;
|
||||||
await page.fill('input', '').catch(e => error = e);
|
await page.fill('input', '').catch(e => error = e);
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue