Skip to content
Snippets Groups Projects

Converting to MR

Open Hardik Patel requested to merge issue/drupal-3152281:3152281-extra-field-blocks into 11.x
3 unresolved threads

Closes #3152281

Merge request reports

Loading
Loading

Activity

Filter activity
  • Approvals
  • Assignees & reviewers
  • Comments (from bots)
  • Comments (from users)
  • Commits & branches
  • Edits
  • Labels
  • Lock status
  • Mentions
  • Merge request status
  • Tracking
  • 191 */
    192 public static function preRenderBlock(array $block_build): array {
    193 $content = $block_build['content'] ?? NULL;
    194 if ($content === NULL || Element::isEmpty($content)) {
    195 // Block content is empty, abort rendering the whole block and preserve
    196 // cache metadata.
    197 // @see \Drupal\Core\Render\Renderer::doRender
    198 $block_build['#printed'] = TRUE;
    199 }
    200 return $block_build;
    201 }
    202
    203 /**
    204 * {@inheritdoc}
    205 */
    206 public static function trustedCallbacks() {
  • 494 494 // Confirm that the newly added extra field is visible.
    495 495 $this->drupalGet('node/1');
    496 496 $assert_session->pageTextContains('Extra Field 2 is hidden by default.');
    497
    498 // Ensure empty extra field and its container are not rendered.
    499 /** @see \Drupal\layout_builder\Plugin\Block\ExtraFieldBlock::preRenderBlock */
    500 $assert_session->elementNotExists('css', '.block-extra-field-blocknodebundle-with-section-fieldlayout-builder-test-empty');
    • Is it possible to also get a positive assertion? Maybe place a block and check this exists.

    • Positive assertion in this case would mean that extra field is not empty. And that's already covered by other assertions above. This issue is about empty extra field being rendered and I believe this negative assertion sufficiently proves that is not the case anymore. Let me know if I'm missing something.

    • Please register or sign in to reply
  • Vojislav Jovanovic added 803 commits

    added 803 commits

    Compare with previous version

  • shalini jha added 887 commits

    added 887 commits

    Compare with previous version

  • shalini jha added 1 commit

    added 1 commit

    Compare with previous version

  • Alex Pott added 1 commit

    added 1 commit

    Compare with previous version

  • 24 24 '#markup' => 'Extra Field 2 is hidden by default.',
    25 25 ];
    26 26 }
    27 if ($display->getComponent('layout_builder_test_empty')) {
    28 $build['layout_builder_test_empty'] = [
    29 '#cache' => [],
    30 ];
    31 }
    • Comment on lines +27 to +31

      I think we should be able to make it not empty and then test that it appears. Maybe use a value check a value in a key value storage (don't use state there are issues in tests) and add a cache key to make it easy to invalidate.

    • Please register or sign in to reply
  • shalini jha added 260 commits

    added 260 commits

    Compare with previous version

  • Please register or sign in to reply
    Loading