Skip to content
Snippets Groups Projects
Commit c57a3306 authored by catch's avatar catch Committed by Lap Pham
Browse files

Applied patch, added view page and test function

parent 0e5604ab
No related branches found
No related tags found
1 merge request!7485Resolve #3323574 "Page index isnt"
......@@ -79,7 +79,7 @@
// Remove the question mark and Drupal path component if any.
queryString = queryString
.slice(1)
.replace(/q=[^&]+&?|&?render=[^&]+/, '');
.replace(/q=[^&]+&?|page=[^&]+&?|&?render=[^&]+/, '');
if (queryString !== '') {
// If there is a '?' in ajaxPath, clean URL are on and & should be
// used to add parameters.
......
......@@ -622,3 +622,47 @@ display:
- user.permissions
max-age: 0
tags: { }
page_2:
id: page_2
display_title: 'test pagination with filter'
display_plugin: page
position: 2
display_options:
pager:
type: full
options:
offset: 0
pagination_heading_level: h4
items_per_page: 2
total_pages: null
id: 0
tags:
next: 'Next ›'
previous: ' Previous'
first: '« First'
last: 'Last »'
expose:
items_per_page: true
items_per_page_label: 'Items per page'
items_per_page_options: '2, 5, 10, 25, 50'
items_per_page_options_all: false
items_per_page_options_all_label: '- All -'
offset: false
offset_label: Offset
quantity: 9
defaults:
pager: false
display_description: ''
display_extenders: { }
path: test-content-ajax-filter
cache_metadata:
max-age: 0
contexts:
- 'languages:language_content'
- 'languages:language_interface'
- url
- url.query_args
- user
- 'user.node_grants:view'
- user.permissions
tags: { }
......@@ -254,4 +254,22 @@ protected function assertNoDuplicateAssetsOnPage(): void {
}
}
/**
* Tests when a user navigates directly using a page number parameter.
*/
public function testPaginationAjaxWithTitleFilter() {
// Visit the page url /test-content-ajax-filter?page=3.
$this->drupalGet('test-content-ajax-filter', ['query' => ['page' => 3]]);
$session_assert = $this->assertSession();
$page = $this->getSession()->getPage();
// Filter by title using the exposed form.
$session_assert->elementExists('css', 'input[name="title"]')->setValue('Node 11 content');
$session_assert->elementExists('css', 'input[value="Filter"]')->click();
$session_assert->assertWaitOnAjaxRequest();
$rows = $page->findAll('css', 'tbody tr');
$this->assertStringContainsString('Node 11 content', $rows[0]->getHtml());
}
}
......@@ -41,7 +41,7 @@ public function testFrontAndRecipesPagesAuthenticated() {
$this->assertSame(4, $performance_data->getStylesheetCount());
$this->assertSame(94355, $performance_data->getStylesheetBytes());
$this->assertSame(2, $performance_data->getScriptCount());
$this->assertSame(264076, $performance_data->getScriptBytes());
$this->assertSame(264166, $performance_data->getScriptBytes());
}
/**
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment