From 3c7de8400b60558b1c39d13278d7a325ade2be1a Mon Sep 17 00:00:00 2001 From: Peter Date: Wed, 13 Nov 2024 18:00:11 +0100 Subject: [PATCH] fix(cdk/testing): allow use of `plaintext-only` for `contenteditable` (#29999) (cherry picked from commit b3c93c50e8392201691c2fc318fc218320a35730) --- .../selenium-webdriver/selenium-web-driver-element.ts | 6 +++++- src/cdk/testing/testbed/unit-test-element.ts | 6 +++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/src/cdk/testing/selenium-webdriver/selenium-web-driver-element.ts b/src/cdk/testing/selenium-webdriver/selenium-web-driver-element.ts index 6435279f1c46..997bc7e703a1 100644 --- a/src/cdk/testing/selenium-webdriver/selenium-web-driver-element.ts +++ b/src/cdk/testing/selenium-webdriver/selenium-web-driver-element.ts @@ -161,7 +161,11 @@ export class SeleniumWebDriverElement implements TestElement { async setContenteditableValue(value: string): Promise { const contenteditableAttr = await this.getAttribute('contenteditable'); - if (contenteditableAttr !== '' && contenteditableAttr !== 'true') { + if ( + contenteditableAttr !== '' && + contenteditableAttr !== 'true' && + contenteditableAttr !== 'plaintext-only' + ) { throw new Error('setContenteditableValue can only be called on a `contenteditable` element.'); } diff --git a/src/cdk/testing/testbed/unit-test-element.ts b/src/cdk/testing/testbed/unit-test-element.ts index f441fd43af6b..0e2a5b21806b 100644 --- a/src/cdk/testing/testbed/unit-test-element.ts +++ b/src/cdk/testing/testbed/unit-test-element.ts @@ -193,7 +193,11 @@ export class UnitTestElement implements TestElement { async setContenteditableValue(value: string): Promise { const contenteditableAttr = await this.getAttribute('contenteditable'); - if (contenteditableAttr !== '' && contenteditableAttr !== 'true') { + if ( + contenteditableAttr !== '' && + contenteditableAttr !== 'true' && + contenteditableAttr !== 'plaintext-only' + ) { throw new Error('setContenteditableValue can only be called on a `contenteditable` element.'); }