1
0
Fork 0
mirror of https://github.com/wallabag/wallabag.git synced 2025-09-15 18:57:05 +00:00

Preselect currently active section in the filter menu

Fixes #2533

Signed-off-by: Kevin Decherf <kevin@kdecherf.com>
This commit is contained in:
Kevin Decherf 2021-01-23 21:34:45 +01:00
parent 07e249ee57
commit 8e89b3ad76
3 changed files with 41 additions and 5 deletions

View file

@ -857,7 +857,7 @@ class EntryControllerTest extends WallabagCoreTestCase
$crawler = $client->submit($form, $data);
$this->assertCount(5, $crawler->filter('li.entry'));
$this->assertCount(4, $crawler->filter('li.entry'));
$data = [
'entry_filter[createdAt][left_date]' => $today->format('Y-m-d'),
@ -866,7 +866,7 @@ class EntryControllerTest extends WallabagCoreTestCase
$crawler = $client->submit($form, $data);
$this->assertCount(5, $crawler->filter('li.entry'));
$this->assertCount(4, $crawler->filter('li.entry'));
$data = [
'entry_filter[createdAt][left_date]' => '1970-01-01',
@ -919,7 +919,7 @@ class EntryControllerTest extends WallabagCoreTestCase
];
$crawler = $client->submit($form, $data);
$this->assertCount(5, $crawler->filter('li.entry'));
$this->assertCount(4, $crawler->filter('li.entry'));
$crawler = $client->request('GET', '/unread/list');
$form = $crawler->filter('button[id=submit-filter]')->form();
@ -928,7 +928,7 @@ class EntryControllerTest extends WallabagCoreTestCase
];
$crawler = $client->submit($form, $data);
$this->assertCount(5, $crawler->filter('li.entry'));
$this->assertCount(4, $crawler->filter('li.entry'));
$form = $crawler->filter('button[id=submit-filter]')->form();
$data = [
@ -948,6 +948,7 @@ class EntryControllerTest extends WallabagCoreTestCase
$form = $crawler->filter('button[id=submit-filter]')->form();
$form['entry_filter[isArchived]']->tick();
$form['entry_filter[isStarred]']->untick();
$form['entry_filter[isUnread]']->untick();
$crawler = $client->submit($form);
$this->assertCount(1, $crawler->filter('li.entry'));
@ -960,6 +961,30 @@ class EntryControllerTest extends WallabagCoreTestCase
$this->assertCount(1, $crawler->filter('li.entry'));
}
public function testFilterPreselectedStatus()
{
$this->logInAs('admin');
$client = $this->getClient();
$crawler = $client->request('GET', '/unread/list');
$form = $crawler->filter('button[id=submit-filter]')->form();
$this->assertTrue($form['entry_filter[isUnread]']->hasValue());
$this->assertFalse($form['entry_filter[isArchived]']->hasValue());
$this->assertFalse($form['entry_filter[isStarred]']->hasValue());
$crawler = $client->request('GET', '/starred/list');
$form = $crawler->filter('button[id=submit-filter]')->form();
$this->assertFalse($form['entry_filter[isUnread]']->hasValue());
$this->assertFalse($form['entry_filter[isArchived]']->hasValue());
$this->assertTrue($form['entry_filter[isStarred]']->hasValue());
$crawler = $client->request('GET', '/all/list');
$form = $crawler->filter('button[id=submit-filter]')->form();
$this->assertFalse($form['entry_filter[isUnread]']->hasValue());
$this->assertFalse($form['entry_filter[isArchived]']->hasValue());
$this->assertFalse($form['entry_filter[isStarred]']->hasValue());
}
public function testFilterOnIsPublic()
{
$this->logInAs('admin');