From b3c93c50e8392201691c2fc318fc218320a35730 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) --- .../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 93698d5d3aa2..72b10d1e3db8 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 235ca43c5e07..c2a23104bd86 100644 --- a/src/cdk/testing/testbed/unit-test-element.ts +++ b/src/cdk/testing/testbed/unit-test-element.ts @@ -196,7 +196,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.'); }