Asserts that a paragraph is in a particular mode.
It does this indirectly by checking checking what buttons are available.
string $button_prefix: An initial part of the button name; namely "<paragraphs_field>_<delta>".
string $mode: Assert that the paragraphs is in this widget item mode. Supported modes are "edit", "closed" and "removed". A paragraph in the "removed" mode cannot be distinguished from one that has never been added.
public function checkParagraphInMode($button_prefix, $mode) {
switch ($mode) {
case 'edit':
$this
->assertSession()
->buttonNotExists($button_prefix . '_edit');
$this
->assertSession()
->buttonExists($button_prefix . '_collapse');
break;
case 'closed':
$this
->assertSession()
->buttonExists($button_prefix . '_edit');
$this
->assertSession()
->buttonNotExists($button_prefix . '_collapse');
break;
case 'removed':
$this
->assertSession()
->buttonNotExists($button_prefix . '_edit');
$this
->assertSession()
->buttonNotExists($button_prefix . '_collapse');
break;
default:
throw new \InvalidArgumentException('This function does not support "' . $mode . '" as an argument for "$mode" parameter');
}
}