Skip to content

Commit

Permalink
fix(cdk/testing): allow use of plaintext-only for contenteditable (
Browse files Browse the repository at this point in the history
…#29999)

(cherry picked from commit b3c93c5)
  • Loading branch information
tatp22 authored and mmalerba committed Nov 13, 2024
1 parent aed9094 commit 3c7de84
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,11 @@ export class SeleniumWebDriverElement implements TestElement {
async setContenteditableValue(value: string): Promise<void> {
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.');
}

Expand Down
6 changes: 5 additions & 1 deletion src/cdk/testing/testbed/unit-test-element.ts
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,11 @@ export class UnitTestElement implements TestElement {
async setContenteditableValue(value: string): Promise<void> {
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.');
}

Expand Down

0 comments on commit 3c7de84

Please sign in to comment.