'paragraph',
'params' => [
'content' => 'Paragraph',
'align' => 'left',
'font_size' => '',
],
],
[
'type' => 'column',
'body' => [
[
'type' => 'heading',
'params' => [
'content' => 'Heading',
'align' => 'right',
'font_size' => '',
],
],
[
'type' => 'checkbox',
'params' => [
'label' => 'Label',
'values' => [
['value' => 'Checkbox'],
],
],
],
],
],
];
public function _before() {
parent::_before();
$this->sanitizer = $this->diContainer->get(ApiDataSanitizer::class);
}
public function testItSanitizesBody() {
$result = $this->sanitizer->sanitizeBody($this->body);
$paragraph = $result[0];
$nestedHeading = $result[1]['body'][0];
$nestedCheckbox = $result[1]['body'][1];
expect($paragraph['params']['content'])->equals('alert(1);Paragraph');
expect($paragraph['params']['align'])->equals('left');
expect($nestedHeading['params']['content'])->equals('alert(2);Heading');
expect($nestedHeading['params']['align'])->equals('right');
expect($nestedCheckbox['params']['values'][0]['value'])->equals('alert(3);Checkbox');
expect($nestedCheckbox['params']['label'])->equals('Label');
}
}