else { $this->
pressSaveButton();
} $this->
waitForElementTextContains('.messages--warning', 'There are currently 5 items selected. The maximum number of items for the field is 2. Please remove 3 items from the selection.'
);
// If the user tries to insert the selected items anyway, they should get
// an error.
$this->
pressInsertSelected(NULL, FALSE
);
$this->
waitForElementTextContains('.messages--error', 'There are currently 5 items selected. The maximum number of items for the field is 2. Please remove 3 items from the selection.'
);
$assert_session->
elementNotExists('css', '.messages--warning'
);
// Once the extra items are deselected, all should be well.
$this->
deselectMediaItem(2
);
$this->
deselectMediaItem(3
);
$this->
deselectMediaItem(4
);
$this->
pressInsertSelected('Added 2 media items.'
);
} /**
* Tests that unlimited fields' selection count is not constrained.
*
* @param string|null $selected_operation
* The operation of the button to click. For example, if this is "insert",
* the "Save and insert" button will be pressed. If NULL, the "Save" button
* will be pressed.
*
* @dataProvider providerWidgetOverflow
*/