$preview =
$form_dialog->
findButton('Preview'
);
$this->
assertNotNull($preview, 'The dialog contains a "Preview" button.'
);
// When a form with submit inputs is in a dialog, the form's submit inputs
// are copied to the dialog buttonpane as buttons. The originals should have
// their styles set to display: none.
$hidden_buttons =
$this->
getSession()->
getPage()->
findAll('css', '.ajax-test-form [type="submit"]'
);
$this->
assertCount(2,
$hidden_buttons);
$hidden_button_text =
[];
foreach ($hidden_buttons as $button) { $styles =
$button->
getAttribute('style'
);
$this->
assertStringContainsStringIgnoringCase('display: none;',
$styles);
$hidden_button_text[] =
$button->
getAttribute('value'
);
} // The copied buttons should have the same text as the submit inputs they
// were copied from.
$moved_to_buttonpane_buttons =
$this->
getSession()->
getPage()->
findAll('css', '.ui-dialog-buttonpane button'
);
$this->
assertCount(2,
$moved_to_buttonpane_buttons);
foreach ($moved_to_buttonpane_buttons as $key =>
$button) { $this->
assertEquals($hidden_button_text[$key],
$button->
getText());
}