Skip to content
Snippets Groups Projects
Verified Commit 79304e95 authored by Théodore Biadala's avatar Théodore Biadala
Browse files

Issue #3491044 by plopesc, lauriii, smustgrave: Navigation top bar is not rendered consistently

parent 5e89fa50
No related branches found
No related tags found
9 merge requests!11197Issue #3506427 by eduardo morales alberti: Remove responsive_image.ajax from hook,!11131[10.4.x-only-DO-NOT-MERGE]: Issue ##2842525 Ajax attached to Views exposed filter form does not trigger callbacks,!10786Issue #3490579 by shalini_jha, mstrelan: Add void return to all views...,!3878Removed unused condition head title for views,!3818Issue #2140179: $entity->original gets stale between updates,!2964Issue #2865710 : Dependencies from only one instance of a widget are used in display modes,!2062Issue #3246454: Add weekly granularity to views date sort,!10223132456: Fix issue where views instances are emptied before an ajax request is complete,!617Issue #3043725: Provide a Entity Handler for user cancelation
Pipeline #373835 passed with warnings
Pipeline: drupal

#373856

    Pipeline: drupal

    #373843

      Pipeline: drupal

      #373837

        ......@@ -40,11 +40,15 @@ public static function create(ContainerInterface $container, array $configuratio
        * {@inheritdoc}
        */
        public function build(): array {
        $build = [];
        $build = [
        '#cache' => [
        'contexts' => ['route'],
        ],
        ];
        // Local tasks for content entities.
        if ($this->navigationRenderer->hasLocalTasks()) {
        $local_tasks = $this->navigationRenderer->getLocalTasks();
        $build = [
        $build += [
        '#theme' => 'top_bar_local_tasks',
        '#local_tasks' => $local_tasks['tasks'],
        ];
        ......
        ......@@ -4,15 +4,16 @@
        namespace Drupal\Tests\navigation\Functional;
        use Drupal\Core\Url;
        use Drupal\layout_builder\Entity\LayoutBuilderEntityViewDisplay;
        use Drupal\Tests\BrowserTestBase;
        use Drupal\Tests\system\Functional\Cache\PageCacheTagsTestBase;
        /**
        * Tests the top bar functionality.
        *
        * @group navigation
        */
        class NavigationTopBarTest extends BrowserTestBase {
        class NavigationTopBarTest extends PageCacheTagsTestBase {
        /**
        * {@inheritdoc}
        ......@@ -23,6 +24,7 @@ class NavigationTopBarTest extends BrowserTestBase {
        'layout_builder',
        'field_ui',
        'file',
        'test_page_test',
        ];
        /**
        ......@@ -76,16 +78,29 @@ protected function setUp(): void {
        * Tests the top bar visibility.
        */
        public function testTopBarVisibility(): void {
        $this->drupalGet($this->node->toUrl());
        // Test page does not include the Top Bar.
        $test_page_url = Url::fromRoute('test_page_test.test_page');
        $this->verifyDynamicPageCache($test_page_url, 'MISS');
        $this->verifyDynamicPageCache($test_page_url, 'HIT');
        $this->assertSession()->elementNotExists('xpath', "//div[contains(@class, 'top-bar__content')]/div[contains(@class, 'top-bar__actions')]/button/span");
        $this->verifyDynamicPageCache($this->node->toUrl(), 'MISS');
        $this->verifyDynamicPageCache($this->node->toUrl(), 'HIT');
        // Top Bar is not visible if the feature flag module is disabled.
        $this->assertSession()->elementNotExists('xpath', "//div[contains(@class, 'top-bar__content')]/div[contains(@class, 'top-bar__actions')]/button/span");
        $this->assertSession()->elementExists('xpath', '//div[@id="block-tabs"]');
        \Drupal::service('module_installer')->install(['navigation_top_bar']);
        // Test page does not include the Top Bar.
        $test_page_url = Url::fromRoute('test_page_test.test_page');
        $this->verifyDynamicPageCache($test_page_url, 'MISS');
        $this->verifyDynamicPageCache($test_page_url, 'HIT');
        $this->assertSession()->elementNotExists('xpath', "//div[contains(@class, 'top-bar__content')]/div[contains(@class, 'top-bar__actions')]/button/span");
        // Top Bar is visible once the feature flag module is enabled.
        $this->drupalGet($this->node->toUrl());
        $this->verifyDynamicPageCache($this->node->toUrl(), 'MISS');
        $this->verifyDynamicPageCache($this->node->toUrl(), 'HIT');
        $this->assertSession()->elementExists('xpath', "//div[contains(@class, 'top-bar__content')]/div[contains(@class, 'top-bar__actions')]/button/span");
        $this->assertSession()->elementTextEquals('xpath', "//div[contains(@class, 'top-bar__content')]/div[contains(@class, 'top-bar__actions')]/button/span", 'More actions');
        $this->assertSession()->elementNotExists('xpath', '//div[@id="block-tabs"]');
        ......
        0% Loading or .
        You are about to add 0 people to the discussion. Proceed with caution.
        Please register or to comment