Commit 193c4846 authored by catch's avatar catch

Issue #2872322 by lcontreras, Jo Fitzgerald, Manuel Garcia, Lendude, rroose,...

Issue #2872322 by lcontreras, Jo Fitzgerald, Manuel Garcia, Lendude, rroose, catch: Views preview title is double escaped
parent ed6bdc9a
......@@ -114,6 +114,12 @@ public function testPreviewUI() {
$settings->set('ui.show.sql_query.where', 'below')->save();
$this->drupalPostForm(NULL, $edit = ['view_args' => '100'], t('Update preview'));
$this->assertTrue(strpos($this->getRawContent(), 'view-test-preview') < strpos($this->getRawContent(), 'views-query-info'), 'Statistics shown below the preview.');
// Test that the preview title isn't double escaped.
$this->drupalPostForm("admin/structure/views/nojs/display/test_preview/default/title", $edit = ['title' => 'Double & escaped'], t('Apply'));
$this->drupalPostForm(NULL, [], t('Update preview'));
$elements = $this->xpath('//div[@id="views-live-preview"]/div[contains(@class, views-query-info)]//td[text()=:text]', [':text' => t('Double & escaped')]);
$this->assertEqual(1, count($elements));
}
/**
......
......@@ -4,7 +4,6 @@
use Drupal\Component\Utility\Html;
use Drupal\Component\Utility\Timer;
use Drupal\Component\Utility\Xss;
use Drupal\Core\EventSubscriber\AjaxResponseSubscriber;
use Drupal\Core\Form\FormStateInterface;
use Drupal\views\Views;
......@@ -688,7 +687,11 @@ public function renderPreview($display_id, $args = []) {
'#template' => "<strong>{% trans 'Title' %}</strong>",
],
],
Xss::filterAdmin($executable->getTitle()),
[
'data' => [
'#markup' => $executable->getTitle(),
],
],
];
if (isset($path)) {
// @todo Views should expect and store a leading /. See:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment