function WorkspacesLayoutBuilderIntegrationTest::testBlockDeletionInWorkspaces

Same name in other branches
  1. 10 core/modules/workspaces/tests/src/FunctionalJavascript/WorkspacesLayoutBuilderIntegrationTest.php \Drupal\Tests\workspaces\FunctionalJavascript\WorkspacesLayoutBuilderIntegrationTest::testBlockDeletionInWorkspaces()

Tests that blocks can be deleted inside workspaces.

File

core/modules/workspaces/tests/src/FunctionalJavascript/WorkspacesLayoutBuilderIntegrationTest.php, line 140

Class

WorkspacesLayoutBuilderIntegrationTest
Tests for layout editing in workspaces.

Namespace

Drupal\Tests\workspaces\FunctionalJavascript

Code

public function testBlockDeletionInWorkspaces() : void {
    $assert_session = $this->assertSession();
    $stage = Workspace::load('stage');
    $this->switchToWorkspace($stage);
    $this->drupalGet('node/1/layout');
    $workspace_block_content = 'The WORKSPACE block body';
    $this->addInlineBlockToLayout('Workspace block title', $workspace_block_content);
    $this->assertSaveLayout();
    $this->drupalGet('node/1');
    $assert_session->pageTextContains('The DEFAULT block body');
    $assert_session->pageTextContains($workspace_block_content);
    $this->switchToLive();
    $assert_session->pageTextNotContains($workspace_block_content);
    $this->switchToWorkspace($stage);
    $this->drupalGet('node/1/layout');
    $this->removeInlineBlockFromLayout(static::INLINE_BLOCK_LOCATOR . ' ~ ' . static::INLINE_BLOCK_LOCATOR);
    $this->assertSaveLayout();
    $this->drupalGet('node/1');
    $assert_session->pageTextContains('The DEFAULT block body');
    $assert_session->pageTextNotContains($workspace_block_content);
    $this->drupalGet('node/1/layout');
    $this->removeInlineBlockFromLayout();
    $this->assertSaveLayout();
    $this->drupalGet('node/1');
    $assert_session->pageTextNotContains('The DEFAULT block body');
    $assert_session->pageTextNotContains($workspace_block_content);
    $this->switchToLive();
    $this->drupalGet('node/1');
    $assert_session->pageTextContains('The DEFAULT block body');
    $stage->publish();
    $this->drupalGet('node/1');
    $assert_session->pageTextNotContains('The DEFAULT block body');
    $assert_session->pageTextNotContains($workspace_block_content);
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.