Verified Commit c9af197e authored by Lee Rowlands's avatar Lee Rowlands
Browse files

Issue #3366287 by lauriii, catch, dmurphy1: [regression] Inserting media via...

Issue #3366287 by lauriii, catch, dmurphy1: [regression] Inserting media via the media library modal when paged redirects to the wrong destination

(cherry picked from commit d5740e4b)
parent 049fb020
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -45,7 +45,7 @@ public function __construct(AttachmentsResponseProcessorInterface $ajax_response
   */
  public function onRequest(RequestEvent $event) {
    // Pass to the Html class that the current request is an Ajax request.
    if ($event->getRequest()->request->get(static::AJAX_REQUEST_PARAMETER)) {
    if ($event->getRequest()->get(static::AJAX_REQUEST_PARAMETER)) {
      Html::setIsAjax(TRUE);
    }
  }
+10 −3
Original line number Diff line number Diff line
@@ -98,6 +98,13 @@ public function testWidgetViews() {
    $this->waitForElementTextContains('.js-media-library-view .js-pager__items > li:nth-of-type(1)', 'Page 1');
    $this->assertCount(24, $this->getCheckboxes());

    $page->checkField('Select Bear');
    $this->pressInsertSelected('Added one media item.');
    $assert_session->pageTextContains('Bear');
    $assert_session->pageTextNotContains('Cat');
    $assert_session->pageTextNotContains('Turtle');

    $this->openMediaLibraryForField('field_unlimited_media');
    $this->switchToMediaLibraryTable();

    // Assert the 'Apply filter' button is not moved to the button pane.
@@ -111,7 +118,7 @@ public function testWidgetViews() {
    $page->fillField('Name', 'Dog');
    $page->pressButton('Apply filters');
    $this->waitForText('Dog');
    $this->waitForNoText('Bear');
    $this->waitForNoText('Crocodile');
    $assert_session->pageTextNotContains('Turtle');
    $page->checkField('Select Dog');
    $assert_session->linkExists('Table');
@@ -120,7 +127,7 @@ public function testWidgetViews() {
    // Assert the exposed filters are persisted when changing display.
    $this->assertSame('Dog', $page->findField('Name')->getValue());
    $assert_session->pageTextContains('Dog');
    $assert_session->pageTextNotContains('Bear');
    $assert_session->pageTextNotContains('Crocodile');
    $assert_session->pageTextNotContains('Turtle');
    $assert_session->linkExists('Grid');
    $this->switchToMediaLibraryTable();
@@ -129,7 +136,7 @@ public function testWidgetViews() {
    $this->pressInsertSelected('Added one media item.');
    // Ensure that the selection completed successfully.
    $assert_session->pageTextContains('Dog');
    $assert_session->pageTextNotContains('Bear');
    $assert_session->pageTextContains('Bear');
    $assert_session->pageTextNotContains('Turtle');
  }