8000 allow the TextAreaFormField to be used with valid/invalid HTML by dawehner · Pull Request #10140 · symfony/symfony · GitHub
[go: up one dir, main page]

Skip to content

allow the TextAreaFormField to be used with valid/invalid HTML #10140

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ protected function initialize()

$this->value = null;
foreach ($this->node->childNodes as $node) {
$this->value .= $this->document->saveXML($node);
$this->value .= $node->wholeText;
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -29,5 +29,19 @@ public function testInitialize()
} catch (\LogicException $e) {
$this->assertTrue(true, '->initialize() throws a \LogicException if the node is not a textarea');
}

// Ensure that valid HTML can be used on a textarea.
$node = $this->createNode('textarea', 'foo bar <h1>Baz</h1>');
$field = new TextareaFormField($node);

$this->assertEquals('foo bar <h1>Baz</h1>', $field->getValue(), '->initialize() sets the value of the field to the textarea node value');

// Ensure that we don't do any DOM manipulation/validation by passing in
// "invalid" HTML.
$node = $this->createNode('textarea', 'foo bar <h1>Baz</h2>');
$field = new TextareaFormField($node);

$this->assertEquals('foo bar <h1>Baz</h2>', $field->getValue(), '->initialize() sets the value of the field to the textarea node value');
}

}
0