Commit 40e34c8b authored by catch's avatar catch

Issue #3012704 by raman.b, quicksketch, drclaw, keesje, alexpott, Lendude:...

Issue #3012704 by raman.b, quicksketch, drclaw, keesje, alexpott, Lendude: "Items per page" checkbox does not stay checked in Views UI when creating a block display
parent e4e0d0b4
......@@ -239,7 +239,7 @@ public function buildOptionsForm(&$form, FormStateInterface $form_state) {
'items_per_page' => $this->t('Items per page'),
];
$allow = array_filter($this->getOption('allow'));
$allow = array_keys(array_filter($this->getOption('allow')));
$form['allow'] = [
'#type' => 'checkboxes',
'#default_value' => $allow,
......
......@@ -55,6 +55,26 @@ public function testItemsPerPage() {
$view['block[title]'] = $this->randomMachineName(16);
$view['block[items_per_page]'] = 3;
$this->drupalPostForm('admin/structure/views/add', $view, 'Save and edit');
// Uncheck items per page in block settings.
$this->drupalGet($this->getSession()->getCurrentUrl() . '/edit/block_1');
$this->clickLink('Items per page');
$this->assertSession()->checkboxChecked('allow[items_per_page]');
$this->getSession()->getPage()->uncheckField('allow[items_per_page]');
$this->getSession()->getPage()->pressButton('Apply');
$this->getSession()->getPage()->pressButton('Save');
// Check items per page in block settings.
$this->drupalGet('admin/structure/views/nojs/display/' . $view['id'] . '/block_1/allow');
$this->assertSession()->checkboxNotChecked('allow[items_per_page]');
$this->getSession()->getPage()->checkField('allow[items_per_page]');
$this->getSession()->getPage()->pressButton('Apply');
$this->getSession()->getPage()->pressButton('Save');
// Ensure that items per page checkbox remains checked.
$this->clickLink('Items per page');
$this->assertSession()->checkboxChecked('allow[items_per_page]');
$this->drupalGet($view['page[path]']);
$this->assertSession()->statusCodeEquals(200);
......
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