Loading core/modules/views/src/Controller/ViewAjaxController.php +4 −0 Original line number Diff line number Diff line Loading @@ -214,6 +214,10 @@ public function ajaxView(Request $request) { $response->addCommand(new PrependCommand(".js-view-dom-id-$dom_id", ['#type' => 'status_messages'])); $request->query->set('ajax_page_state', $existing_page_state); if (!empty($preview['#attached'])) { $response->setAttachments($preview['#attached']); } return $response; } else { Loading core/modules/views/tests/src/Unit/Controller/ViewAjaxControllerTest.php +16 −1 Original line number Diff line number Diff line Loading @@ -209,6 +209,14 @@ public function testAjaxView() { $this->assertSame($response->getView(), $executable); $this->assertViewResultCommand($response); // Test that the ajax controller for Views contains the // Drupal Settings. $this->assertEquals([ 'drupalSettings' => [ 'testSetting' => ['Setting'], ], ], $response->getAttachments()); } /** Loading Loading @@ -389,7 +397,14 @@ protected function setupValidMocks($use_ajax = self::USE_AJAX) { ->willReturn(TRUE); $executable->expects($this->atMost(1)) ->method('preview') ->willReturn(['#markup' => 'View result']); ->willReturn([ '#markup' => 'View result', '#attached' => [ 'drupalSettings' => [ 'testSetting' => ['Setting'], ], ], ]); $this->executableFactory->expects($this->once()) ->method('get') Loading Loading
core/modules/views/src/Controller/ViewAjaxController.php +4 −0 Original line number Diff line number Diff line Loading @@ -214,6 +214,10 @@ public function ajaxView(Request $request) { $response->addCommand(new PrependCommand(".js-view-dom-id-$dom_id", ['#type' => 'status_messages'])); $request->query->set('ajax_page_state', $existing_page_state); if (!empty($preview['#attached'])) { $response->setAttachments($preview['#attached']); } return $response; } else { Loading
core/modules/views/tests/src/Unit/Controller/ViewAjaxControllerTest.php +16 −1 Original line number Diff line number Diff line Loading @@ -209,6 +209,14 @@ public function testAjaxView() { $this->assertSame($response->getView(), $executable); $this->assertViewResultCommand($response); // Test that the ajax controller for Views contains the // Drupal Settings. $this->assertEquals([ 'drupalSettings' => [ 'testSetting' => ['Setting'], ], ], $response->getAttachments()); } /** Loading Loading @@ -389,7 +397,14 @@ protected function setupValidMocks($use_ajax = self::USE_AJAX) { ->willReturn(TRUE); $executable->expects($this->atMost(1)) ->method('preview') ->willReturn(['#markup' => 'View result']); ->willReturn([ '#markup' => 'View result', '#attached' => [ 'drupalSettings' => [ 'testSetting' => ['Setting'], ], ], ]); $this->executableFactory->expects($this->once()) ->method('get') Loading