updated core to 8.6.3
This commit is contained in:
@@ -12,7 +12,6 @@ use Drupal\Core\Render\Element;
|
||||
use Drupal\Core\Entity\Entity\EntityFormDisplay;
|
||||
use Drupal\Core\TempStore\PrivateTempStoreFactory;
|
||||
use Symfony\Component\DependencyInjection\ContainerInterface;
|
||||
use Symfony\Component\Validator\Validator\ValidatorInterface;
|
||||
|
||||
/**
|
||||
* Builds and process a form for editing a single entity field.
|
||||
@@ -42,13 +41,6 @@ class QuickEditFieldForm extends FormBase {
|
||||
*/
|
||||
protected $nodeTypeStorage;
|
||||
|
||||
/**
|
||||
* The typed data validator.
|
||||
*
|
||||
* @var \Symfony\Component\Validator\Validator\ValidatorInterface
|
||||
*/
|
||||
protected $validator;
|
||||
|
||||
/**
|
||||
* Constructs a new EditFieldForm.
|
||||
*
|
||||
@@ -58,14 +50,11 @@ class QuickEditFieldForm extends FormBase {
|
||||
* The module handler.
|
||||
* @param \Drupal\Core\Entity\EntityStorageInterface $node_type_storage
|
||||
* The node type storage.
|
||||
* @param \Symfony\Component\Validator\Validator\ValidatorInterface $validator
|
||||
* The typed data validator service.
|
||||
*/
|
||||
public function __construct(PrivateTempStoreFactory $temp_store_factory, ModuleHandlerInterface $module_handler, EntityStorageInterface $node_type_storage, ValidatorInterface $validator) {
|
||||
public function __construct(PrivateTempStoreFactory $temp_store_factory, ModuleHandlerInterface $module_handler, EntityStorageInterface $node_type_storage) {
|
||||
$this->moduleHandler = $module_handler;
|
||||
$this->nodeTypeStorage = $node_type_storage;
|
||||
$this->tempStoreFactory = $temp_store_factory;
|
||||
$this->validator = $validator;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -75,8 +64,7 @@ class QuickEditFieldForm extends FormBase {
|
||||
return new static(
|
||||
$container->get('tempstore.private'),
|
||||
$container->get('module_handler'),
|
||||
$container->get('entity.manager')->getStorage('node_type'),
|
||||
$container->get('typed_data_manager')->getValidator()
|
||||
$container->get('entity.manager')->getStorage('node_type')
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -6,10 +6,10 @@ use Drupal\Component\Serialization\Json;
|
||||
use Drupal\Core\EventSubscriber\MainContentViewSubscriber;
|
||||
use Drupal\Core\Field\FieldStorageDefinitionInterface;
|
||||
use Drupal\Core\Language\LanguageInterface;
|
||||
use Drupal\field\Tests\EntityReference\EntityReferenceTestTrait;
|
||||
use Drupal\simpletest\WebTestBase;
|
||||
use Drupal\taxonomy\Entity\Vocabulary;
|
||||
use Drupal\taxonomy\Entity\Term;
|
||||
use Drupal\Tests\field\Traits\EntityReferenceTestTrait;
|
||||
|
||||
/**
|
||||
* Tests in-place editing of autocomplete tags.
|
||||
|
||||
@@ -0,0 +1,100 @@
|
||||
<?php
|
||||
|
||||
namespace Drupal\Tests\quickedit\FunctionalJavascript;
|
||||
|
||||
use Drupal\file\Entity\File;
|
||||
use Drupal\node\Entity\Node;
|
||||
use Drupal\Tests\file\Functional\FileFieldCreationTrait;
|
||||
use Drupal\Tests\TestFileCreationTrait;
|
||||
|
||||
/**
|
||||
* @group quickedit
|
||||
*/
|
||||
class QuickEditFileTest extends QuickEditJavascriptTestBase {
|
||||
|
||||
use FileFieldCreationTrait;
|
||||
use TestFileCreationTrait;
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public static $modules = [
|
||||
'node',
|
||||
'file',
|
||||
];
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function setUp() {
|
||||
parent::setUp();
|
||||
|
||||
// Create the Article node type.
|
||||
$this->drupalCreateContentType(['type' => 'article', 'name' => 'Article']);
|
||||
|
||||
// Add file field to Article node type.
|
||||
$this->createFileField('field_file', 'node', 'article', ['file_extensions' => 'txt']);
|
||||
|
||||
// Log in as a content author who can use Quick Edit and edit Articles.
|
||||
$user = $this->drupalCreateUser([
|
||||
'access contextual links',
|
||||
'access toolbar',
|
||||
'access in-place editing',
|
||||
'access content',
|
||||
'create article content',
|
||||
'edit any article content',
|
||||
]);
|
||||
$this->drupalLogin($user);
|
||||
}
|
||||
|
||||
/**
|
||||
* Tests if a file can be in-place removed with Quick Edit.
|
||||
*/
|
||||
public function testRemove() {
|
||||
$assert_session = $this->assertSession();
|
||||
|
||||
// Create test file.
|
||||
$this->generateFile('test', 64, 10, 'text');
|
||||
$file = File::create([
|
||||
'uri' => 'public://test.txt',
|
||||
'filename' => 'test.txt',
|
||||
]);
|
||||
$file->setPermanent();
|
||||
$file->save();
|
||||
|
||||
// Create test node.
|
||||
$node = $this->drupalCreateNode([
|
||||
'type' => 'article',
|
||||
'title' => t('My Test Node'),
|
||||
'field_file' => [
|
||||
'target_id' => $file->id(),
|
||||
],
|
||||
]);
|
||||
|
||||
$this->drupalGet($node->toUrl()->toString());
|
||||
|
||||
// Start Quick Edit.
|
||||
$this->awaitQuickEditForEntity('node', 1);
|
||||
$this->startQuickEditViaToolbar('node', 1, 0);
|
||||
|
||||
// Click the file field.
|
||||
$assert_session->waitForElementVisible('css', '[data-quickedit-field-id="node/1/field_file/en/full"]');
|
||||
$this->click('[data-quickedit-field-id="node/1/field_file/en/full"]');
|
||||
$assert_session->waitForElement('css', '.quickedit-toolbar-field div[id*="file"]');
|
||||
|
||||
// Remove the file.
|
||||
$remove = $assert_session->waitForButton('Remove');
|
||||
$remove->click();
|
||||
// Wait for remove.
|
||||
$assert_session->waitForElement('css', 'input[name="files[field_file_0]"]');
|
||||
$this->saveQuickEdit();
|
||||
// Wait for save.
|
||||
$this->assertJsCondition("Drupal.quickedit.collections.entities.get('node/1[0]').get('state') === 'closed'");
|
||||
|
||||
// Assert file is removed from node.
|
||||
$assert_session->pageTextNotContains('test.txt');
|
||||
$node = Node::load($node->id());
|
||||
$this->assertEmpty($node->get('field_file')->getValue());
|
||||
}
|
||||
|
||||
}
|
||||
@@ -6,10 +6,10 @@ use Drupal\block_content\Entity\BlockContent;
|
||||
use Drupal\block_content\Entity\BlockContentType;
|
||||
use Drupal\Core\Field\FieldStorageDefinitionInterface;
|
||||
use Drupal\editor\Entity\Editor;
|
||||
use Drupal\field\Tests\EntityReference\EntityReferenceTestTrait;
|
||||
use Drupal\filter\Entity\FilterFormat;
|
||||
use Drupal\taxonomy\Entity\Term;
|
||||
use Drupal\taxonomy\Entity\Vocabulary;
|
||||
use Drupal\Tests\field\Traits\EntityReferenceTestTrait;
|
||||
|
||||
/**
|
||||
* @group quickedit
|
||||
|
||||
Reference in New Issue
Block a user