diff --git a/core/modules/views/src/Tests/Plugin/PagerTest.php b/core/modules/views/src/Tests/Plugin/PagerTest.php index f922748..64dbeb7 100644 --- a/core/modules/views/src/Tests/Plugin/PagerTest.php +++ b/core/modules/views/src/Tests/Plugin/PagerTest.php @@ -53,9 +53,31 @@ public function testStorePagerSettings() { $this->drupalGet('admin/structure/views/view/test_view/edit'); $edit = array( + 'pager[type]' => 'some', + ); + $this->drupalPostForm('admin/structure/views/nojs/display/test_view/default/pager', $edit, t('Apply')); + + $this->assertFieldByXPath('//input[@name="pager_options[items_per_page]" and @type="number" and @min="0"]', 10, '"Items per page" field was found.'); + $this->assertFieldByXPath('//input[@name="pager_options[offset]" and @type="number" and @min="0"]', 0, '"Offset" field was found.'); + + $edit = array( + 'pager[type]' => 'none', + ); + $this->drupalPostForm('admin/structure/views/nojs/display/test_view/default/pager', $edit, t('Apply')); + + $this->assertFieldByXPath('//input[@name="pager_options[offset]" and @type="number" and @min="0"]', 0, '"Offset" field was found.'); + + $edit = array( 'pager[type]' => 'full', ); $this->drupalPostForm('admin/structure/views/nojs/display/test_view/default/pager', $edit, t('Apply')); + + $this->assertFieldByXPath('//input[@name="pager_options[items_per_page]" and @type="number" and @min="0"]', 10, '"Items to display" field was found.'); + $this->assertFieldByXPath('//input[@name="pager_options[offset]" and @type="number" and @min="0"]', 0, '"Offset" field was found.'); + $this->assertFieldByXPath('//input[@name="pager_options[id]" and @type="number" and @min="0"]', 0, '"Pager ID" field was found.'); + $this->assertFieldByXPath('//input[@name="pager_options[total_pages]" and @type="number" and @min="0"]', '', '"Number of pages" field was found.'); + $this->assertFieldByXPath('//input[@name="pager_options[quantity]" and @type="number" and @min="0"]', 9, '"Number of pager links" field was found.'); + $edit = array( 'pager_options[items_per_page]' => 20, ); @@ -120,6 +142,11 @@ public function testStorePagerSettings() { $this->assertFieldByName('override[dropdown]', 'page_1', 'The override element is displayed on plugin selection form.'); $this->drupalGet('admin/structure/views/nojs/display/test_store_pager_settings/page_1/pager_options'); $this->assertNoFieldByName('override[dropdown]', NULL, 'The override element is not displayed on plugin settings form.'); + + $this->assertFieldByXPath('//input[@name="pager_options[items_per_page]" and @type="number" and @min="0"]', 20, '"Items per page" field was found.'); + $this->assertFieldByXPath('//input[@name="pager_options[offset]" and @type="number" and @min="0"]', 0, '"Offset" field was found.'); + $this->assertFieldByXPath('//input[@name="pager_options[id]" and @type="number" and @min="0"]', 0, '"Pager ID" field was found.'); + $this->assertFieldByXPath('//input[@name="pager_options[total_pages]" and @type="number" and @min="0"]', '', '"Number of pages" field was found.'); } /**