Issue #3441920 by scott_euser, catch, smustgrave, quietone: Support #attached settings in ViewAjaxController
(cherry picked from commit 3e486f783a
)
merge-requests/7931/head
parent
6bca41b201
commit
12097985d8
|
@ -214,6 +214,10 @@ class ViewAjaxController implements ContainerInjectionInterface {
|
|||
$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 {
|
||||
|
|
|
@ -209,6 +209,14 @@ class ViewAjaxControllerTest extends UnitTestCase {
|
|||
$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());
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -389,7 +397,14 @@ class ViewAjaxControllerTest extends UnitTestCase {
|
|||
->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…
Reference in New Issue