Skip to content
Snippets Groups Projects
Commit 0a96230d authored by Angie Byron's avatar Angie Byron
Browse files

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
No related branches found
No related tags found
No related merge requests found
......@@ -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.');
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment