X-Git-Url: https://yaffs.net/gitweb/?a=blobdiff_plain;f=web%2Fcore%2Fmodules%2Fviews_ui%2Ftests%2Fsrc%2FFunctionalJavascript%2FViewsListingTest.php;h=fc696c03a866ff0097613063b1fe7280f33ddf0d;hb=1c1cb0980bfa6caf0c24cce671b6bb541dc87583;hp=03325ce05c0bb4d93fa8f93071d2d07dabfd90a6;hpb=a2bd1bf0c2c1f1a17d188f4dc0726a45494cefae;p=yaffs-website diff --git a/web/core/modules/views_ui/tests/src/FunctionalJavascript/ViewsListingTest.php b/web/core/modules/views_ui/tests/src/FunctionalJavascript/ViewsListingTest.php index 03325ce05..fc696c03a 100644 --- a/web/core/modules/views_ui/tests/src/FunctionalJavascript/ViewsListingTest.php +++ b/web/core/modules/views_ui/tests/src/FunctionalJavascript/ViewsListingTest.php @@ -2,7 +2,7 @@ namespace Drupal\Tests\views_ui\FunctionalJavascript; -use Drupal\FunctionalJavascriptTests\JavascriptTestBase; +use Drupal\FunctionalJavascriptTests\WebDriverTestBase; /** * Tests the JavaScript filtering on the Views listing page. @@ -10,7 +10,7 @@ use Drupal\FunctionalJavascriptTests\JavascriptTestBase; * @see core/modules/views_ui/js/views_ui.listing.js * @group views_ui */ -class ViewsListingTest extends JavascriptTestBase { +class ViewsListingTest extends WebDriverTestBase { /** * {@inheritdoc} @@ -92,6 +92,7 @@ class ViewsListingTest extends JavascriptTestBase { // Disable a View and see if it moves to the disabled listing. $enabled_view = $page->find('css', 'tr.views-ui-list-enabled'); + $view_description = $enabled_view->find('css', '.views-ui-view-name h3')->getText(); // Open the dropdown with additional actions. $enabled_view->find('css', 'li.dropbutton-toggle button')->click(); $disable_button = $enabled_view->find('css', 'li.disable.dropbutton-action a'); @@ -109,6 +110,18 @@ class ViewsListingTest extends JavascriptTestBase { // Test that one enabled View has been moved to the disabled list. $this->assertCount($enabled_views_count - 1, $enabled_rows); $this->assertCount($disabled_views_count + 1, $disabled_rows); + + // Test that the keyboard focus is on the dropdown button of the View we + // just disabled. + $this->assertTrue($this->getSession()->evaluateScript("jQuery(document.activeElement).parent().is('li.enable.dropbutton-action')")); + $this->assertEquals($view_description, $this->getSession()->evaluateScript("jQuery(document.activeElement).parents('tr').find('h3').text()")); + + // Enable the view again and ensure we have the focus on the edit button. + $this->getSession()->evaluateScript('jQuery(document.activeElement).click()'); + $session->assertWaitOnAjaxRequest(); + + $this->assertTrue($this->getSession()->evaluateScript("jQuery(document.activeElement).parent().is('li.edit.dropbutton-action')")); + $this->assertEquals($view_description, $this->getSession()->evaluateScript("jQuery(document.activeElement).parents('tr').find('h3').text()")); } /** @@ -118,7 +131,7 @@ class ViewsListingTest extends JavascriptTestBase { * @return array */ protected function filterVisibleElements($elements) { - $elements = array_filter($elements, function($element) { + $elements = array_filter($elements, function ($element) { return $element->isVisible(); }); return $elements;