Skip to content
Snippets Groups Projects
Commit 89a71846 authored by catch's avatar catch
Browse files

Issue #2851504 by alexpott, vomiand, Vj, BalajiDS, cilefen, tamasd: "Illegal...

Issue #2851504 by alexpott, vomiand, Vj, BalajiDS, cilefen, tamasd: "Illegal choice 0 in Book element" when switching the book outline field from anything to "- None - "

(cherry picked from commit 4397d8d5)
parent 05083ea0
No related branches found
No related tags found
9 merge requests!1445Issue #2920039: Views' User Name exposed group filter validation,!1298Issue #3240993: Let layout builder render inline block translations,!774Issue #3174569: Example node template file name is incorrect,!497Issue #2463967: Use .user.ini file for PHP settings,!433Resolve #3163663 "Too many open files",!233Resolve #2693787 "Taxonomy term name",!133Resolve #2666286 "Clean up menuui",!112Resolve #3187004 "Drupaldatetime serialization issue",!53Resolve #3181870: Correct typo "the the" in "core/classList" deprecation message.
...@@ -227,7 +227,7 @@ public function addFormElements(array $form, FormStateInterface $form_state, Nod ...@@ -227,7 +227,7 @@ public function addFormElements(array $form, FormStateInterface $form_state, Nod
// The node can become a new book, if it is not one already. // The node can become a new book, if it is not one already.
$options = [$nid => $this->t('- Create a new book -')] + $options; $options = [$nid => $this->t('- Create a new book -')] + $options;
} }
if (!$node->book['bid']) { if (!$node->book['bid'] || $nid === 'new' || $node->book['original_bid'] === 0) {
// The node is not currently in the hierarchy. // The node is not currently in the hierarchy.
$options = [0 => $this->t('- None -')] + $options; $options = [0 => $this->t('- None -')] + $options;
} }
......
...@@ -162,4 +162,26 @@ protected function assertOrderInPage(array $items) { ...@@ -162,4 +162,26 @@ protected function assertOrderInPage(array $items) {
$this->assertSame($items, array_values($strings), "Found strings, ordered as: $ordered."); $this->assertSame($items, array_values($strings), "Found strings, ordered as: $ordered.");
} }
/**
* Tests book outline AJAX request.
*/
public function testBookAddOutline() {
$this->drupalLogin($this->drupalCreateUser(['create book content', 'create new books', 'add content to books']));
$this->drupalGet('node/add/book');
$assert_session = $this->assertSession();
$session = $this->getSession();
$page = $session->getPage();
$page->find('css', '#edit-book')->click();
$book_select = $page->findField("book[bid]");
$book_select->setValue('new');
$assert_session->waitForText('This will be the top-level page in this book.');
$assert_session->pageTextContains('This will be the top-level page in this book.');
$assert_session->pageTextNotContains('No book selected.');
$book_select->setValue(0);
$assert_session->waitForText('No book selected.');
$assert_session->pageTextContains('No book selected.');
$assert_session->pageTextNotContains('This will be the top-level page in this book.');
}
} }
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment