Commit 0a96230d authored by webchick's avatar webchick

Issue #2001308 by marthinal, helmo, David_Rothstein, micahw156: Tests for:...

Issue #2001308 by marthinal, helmo, David_Rothstein, micahw156: Tests for: Node preview removes file values from node edit form for non-displayed items.
parent 2d929553
......@@ -7,6 +7,8 @@
namespace Drupal\file\Tests;
use Drupal\Core\Field\FieldDefinitionInterface;
/**
* Tests that formatters are working properly.
*/
......@@ -29,6 +31,7 @@ function testNodeDisplay() {
$field_settings = array(
'display_field' => '1',
'display_default' => '1',
'cardinality' => FieldDefinitionInterface::CARDINALITY_UNLIMITED,
);
$instance_settings = array(
'description_field' => '1',
......@@ -80,5 +83,17 @@ function testNodeDisplay() {
);
$this->drupalPostForm('node/' . $nid . '/edit', $edit, t('Save and keep published'));
$this->assertText($description);
// Test that fields appear as expected after during the preview.
// Add a second file.
$name = 'files[' . $field_name . '_1][]';
$edit[$name] = drupal_realpath($test_file->getFileUri());
// Uncheck the display checkboxes and go to the preview.
$edit[$field_name . '[0][display]'] = FALSE;
$edit[$field_name . '[1][display]'] = FALSE;
$this->drupalPostForm("node/$nid/edit", $edit, t('Preview'));
$this->assertRaw($field_name . '[0][display]', 'First file appears as expected.');
$this->assertRaw($field_name . '[1][display]', 'Second file appears as expected.');
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment