Commit 0edf8153 authored by alexpott's avatar alexpott

Issue #2671182 by lokapujya: Views validates displays on Cancel

parent d83a7742
......@@ -93,6 +93,19 @@ public function testOtherOptions() {
// Test that the display ID has not been changed.
$this->drupalGet('admin/structure/views/view/test_view/edit/test_1');
$this->assertLink(t('test_1'));
// Test that validation does not run on cancel.
$this->drupalGet('admin/structure/views/view/test_view');
// Delete the field to cause an error on save.
$fields = [];
$fields['fields[age][removed]'] = 1;
$fields['fields[id][removed]'] = 1;
$fields['fields[name][removed]'] = 1;
$this->drupalPostForm('admin/structure/views/nojs/rearrange/test_view/default/field', $fields, t('Apply'));
$this->drupalPostForm(NULL, array(), 'Save');
$this->drupalPostForm(NULL, array(), t('Cancel'));
$this->assertNoFieldByXpath('//div[contains(@class, "error")]', FALSE, 'No error message is displayed.');
$this->assertUrl('admin/structure/views', array(), 'Redirected back to the view listing page..');
}
/**
......
......@@ -227,6 +227,7 @@ protected function actions(array $form, FormStateInterface $form_state) {
'#type' => 'submit',
'#value' => $this->t('Cancel'),
'#submit' => array('::cancel'),
'#limit_validation_errors' => array(),
);
if ($this->entity->isLocked()) {
$actions['submit']['#access'] = FALSE;
......
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