fix: rich text link element not validating on create (#3014)

This commit is contained in:
Jarrod Flesch
2023-07-18 08:54:22 -04:00
committed by GitHub
parent 733fc0b2d0
commit 60fca40780
2 changed files with 22 additions and 3 deletions

View File

@@ -477,6 +477,27 @@ describe('fields', () => {
}
describe('toolbar', () => {
test('should run url validation', async () => {
await navigateToRichTextFields();
// Open link drawer
await page.locator('.rich-text__toolbar button:not([disabled]) .link').first().click();
// find the drawer
const editLinkModal = await page.locator('[id^=drawer_1_rich-text-link-]');
await expect(editLinkModal).toBeVisible();
// Fill values and click Confirm
await editLinkModal.locator('#field-text').fill('link text');
await editLinkModal.locator('label[for="field-linkType-custom"]').click();
await editLinkModal.locator('#field-url').fill('');
await wait(200);
await editLinkModal.locator('button[type="submit"]').click();
const errorField = await page.locator('[id^=drawer_1_rich-text-link-] .render-fields > :nth-child(3)');
const hasErrorClass = await errorField.evaluate(el => el.classList.contains('error'));
expect(hasErrorClass).toBe(true);
});
test('should create new url custom link', async () => {
await navigateToRichTextFields();