Commit 8d6581fa authored by webchick's avatar webchick

Issue #2100959 by damiankloip, mr.baileys, jibran: Views secondary action links escapes html twice.

parent 71d2e5ac
......@@ -336,4 +336,27 @@ public function testViewStatus() {
$this->assertTrue($elements, 'The disabled class was found on the form wrapper.');
}
/**
* Tests the action links on the edit display UI.
*/
public function testActionLinks() {
// Change the display title of a display so it contains characters that will
// be escaped when rendered.
$display_title = "'<test>'";
$this->drupalGet('admin/structure/views/view/test_display');
$display_title_path = 'admin/structure/views/nojs/display/test_display/block_1/display_title';
$this->drupalPostForm($display_title_path, array('display_title' => $display_title), t('Apply'));
$placeholder = array('!display_title' => $display_title);
// Ensure that the dropdown buttons are displayed correctly.
$this->assertFieldByXpath('//input[@type="submit"]', t('Clone !display_title', $placeholder));
$this->assertFieldByXpath('//input[@type="submit"]', t('Delete !display_title', $placeholder));
$this->assertFieldByXpath('//input[@type="submit"]', t('Disable !display_title', $placeholder));
$this->assertNoFieldByXpath('//input[@type="submit"]', t('Enable !display_title', $placeholder));
// Disable the display so we can test the rendering of the "Enable" button.
$this->drupalPostForm(NULL, NULL, t('Disable !display_title', $placeholder));
$this->assertFieldByXpath('//input[@type="submit"]', t('Enable !display_title', $placeholder));
$this->assertNoFieldByXpath('//input[@type="submit"]', t('Disable !display_title', $placeholder));
}
}
......@@ -386,7 +386,7 @@ public function getDisplayDetails($view, $display) {
if (!$is_enabled) {
$build['top']['actions']['enable'] = array(
'#type' => 'submit',
'#value' => $this->t('Enable @display_title', array('@display_title' => $display_title)),
'#value' => $this->t('Enable !display_title', array('!display_title' => $display_title)),
'#limit_validation_errors' => array(),
'#submit' => array(array($this, 'submitDisplayEnable'), array($this, 'submitDelayDestination')),
'#prefix' => '<li class="enable">',
......@@ -400,7 +400,7 @@ public function getDisplayDetails($view, $display) {
if ($path && (strpos($path, '%') === FALSE)) {
$build['top']['actions']['path'] = array(
'#type' => 'link',
'#title' => $this->t('View @display', array('@display' => $display['display_title'])),
'#title' => $this->t('View !display_title', array('!display_title' => $display_title)),
'#options' => array('alt' => array($this->t("Go to the real page for this display"))),
'#href' => $path,
'#prefix' => '<li class="view">',
......@@ -411,7 +411,7 @@ public function getDisplayDetails($view, $display) {
if (!$is_default) {
$build['top']['actions']['duplicate'] = array(
'#type' => 'submit',
'#value' => $this->t('Clone @display_title', array('@display_title' => $display_title)),
'#value' => $this->t('Clone !display_title', array('!display_title' => $display_title)),
'#limit_validation_errors' => array(),
'#submit' => array(array($this, 'submitDisplayDuplicate'), array($this, 'submitDelayDestination')),
'#prefix' => '<li class="duplicate">',
......@@ -421,7 +421,7 @@ public function getDisplayDetails($view, $display) {
// Always allow a display to be deleted.
$build['top']['actions']['delete'] = array(
'#type' => 'submit',
'#value' => $this->t('Delete @display_title', array('@display_title' => $display_title)),
'#value' => $this->t('Delete !display_title', array('!display_title' => $display_title)),
'#limit_validation_errors' => array(),
'#submit' => array(array($this, 'submitDisplayDelete'), array($this, 'submitDelayDestination')),
'#prefix' => '<li class="delete">',
......@@ -435,7 +435,7 @@ public function getDisplayDetails($view, $display) {
$build['top']['actions']['clone_as'][$type] = array(
'#type' => 'submit',
'#value' => $this->t('Clone as @type', array('@type' => $label)),
'#value' => $this->t('Clone as !type', array('!type' => $label)),
'#limit_validation_errors' => array(),
'#submit' => array(array($this, 'submitCloneDisplayAsType'), array($this, 'submitDelayDestination')),
'#prefix' => '<li class="duplicate">',
......@@ -446,7 +446,7 @@ public function getDisplayDetails($view, $display) {
else {
$build['top']['actions']['undo_delete'] = array(
'#type' => 'submit',
'#value' => $this->t('Undo delete of @display_title', array('@display_title' => $display_title)),
'#value' => $this->t('Undo delete of !display_title', array('!display_title' => $display_title)),
'#limit_validation_errors' => array(),
'#submit' => array(array($this, 'submitDisplayUndoDelete'), array($this, 'submitDelayDestination')),
'#prefix' => '<li class="undo-delete">',
......@@ -456,7 +456,7 @@ public function getDisplayDetails($view, $display) {
if ($is_enabled) {
$build['top']['actions']['disable'] = array(
'#type' => 'submit',
'#value' => $this->t('Disable @display_title', array('@display_title' => $display_title)),
'#value' => $this->t('Disable !display_title', array('!display_title' => $display_title)),
'#limit_validation_errors' => array(),
'#submit' => array(array($this, 'submitDisplayDisable'), array($this, 'submitDelayDestination')),
'#prefix' => '<li class="disable">',
......
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