File tree Expand file tree Collapse file tree 2 files changed +22
-3
lines changed
src/admin/components/forms/field-types/RichText/elements/link/LinkDrawer Expand file tree Collapse file tree 2 files changed +22
-3
lines changed Original file line number Diff line number Diff line change @@ -46,9 +46,7 @@ export const getBaseFields = (config: Config): Field[] => [
4646 type : 'text' ,
4747 required : true ,
4848 admin : {
49- condition : ( { linkType, url } ) => {
50- return ( typeof linkType === 'undefined' && url ) || linkType === 'custom' ;
51- } ,
49+ condition : ( { linkType } ) => linkType !== 'internal' ,
5250 } ,
5351 } ,
5452 {
Original file line number Diff line number Diff line change @@ -477,6 +477,27 @@ describe('fields', () => {
477477 }
478478
479479 describe ( 'toolbar' , ( ) => {
480+ test ( 'should run url validation' , async ( ) => {
481+ await navigateToRichTextFields ( ) ;
482+
483+ // Open link drawer
484+ await page . locator ( '.rich-text__toolbar button:not([disabled]) .link' ) . first ( ) . click ( ) ;
485+
486+ // find the drawer
487+ const editLinkModal = await page . locator ( '[id^=drawer_1_rich-text-link-]' ) ;
488+ await expect ( editLinkModal ) . toBeVisible ( ) ;
489+
490+ // Fill values and click Confirm
491+ await editLinkModal . locator ( '#field-text' ) . fill ( 'link text' ) ;
492+ await editLinkModal . locator ( 'label[for="field-linkType-custom"]' ) . click ( ) ;
493+ await editLinkModal . locator ( '#field-url' ) . fill ( '' ) ;
494+ await wait ( 200 ) ;
495+ await editLinkModal . locator ( 'button[type="submit"]' ) . click ( ) ;
496+ const errorField = await page . locator ( '[id^=drawer_1_rich-text-link-] .render-fields > :nth-child(3)' ) ;
497+ const hasErrorClass = await errorField . evaluate ( el => el . classList . contains ( 'error' ) ) ;
498+ expect ( hasErrorClass ) . toBe ( true ) ;
499+ } ) ;
500+
480501 test ( 'should create new url custom link' , async ( ) => {
481502 await navigateToRichTextFields ( ) ;
482503
You can’t perform that action at this time.
0 commit comments