diff --git a/sveltejs/public/build/bundle.js b/sveltejs/public/build/bundle.js index 160f27de502e289191f40e7cd61e99db92b50977..2c4efd15b88d1f41ab74193a32214586b5be2589 100644 Binary files a/sveltejs/public/build/bundle.js and b/sveltejs/public/build/bundle.js differ diff --git a/sveltejs/public/build/bundle.js.map b/sveltejs/public/build/bundle.js.map index 7c67f58f86bf45883c4e6fdbe977f56ce67d2ac3..d8a99df334c3b0e1fe872e79b2ac25eb3d60946a 100644 Binary files a/sveltejs/public/build/bundle.js.map and b/sveltejs/public/build/bundle.js.map differ diff --git a/sveltejs/src/ProjectBrowser.svelte b/sveltejs/src/ProjectBrowser.svelte index f5e5d75104b87f1b41a5ecbea1db36c7a7351756..0a21e017f7c1652c7f47fe019ab37df9a64cedbb 100644 --- a/sveltejs/src/ProjectBrowser.svelte +++ b/sveltejs/src/ProjectBrowser.svelte @@ -261,8 +261,6 @@ .forEach((t) => t.setAttribute('aria-selected', false)); // Set this tab as selected target.setAttribute('aria-selected', true); - // @TODO this needs to get ported into Search somehow: - // filterComponent.setModuleCategoryVocabulary(); $categoryCheckedTrack[$activeTab] = $moduleCategoryFilter; $moduleCategoryFilter = []; $activeTab = event.detail.pluginId; diff --git a/sveltejs/src/Search/Search.svelte b/sveltejs/src/Search/Search.svelte index c8b7e491230f600487a890ee1f2eb5115fa56adc..406daebfbbdc8baf68998cbae207909753ae1f96 100644 --- a/sveltejs/src/Search/Search.svelte +++ b/sveltejs/src/Search/Search.svelte @@ -78,7 +78,7 @@ rows: state.filteredRows, }; dispatch('search', detail); - + filterComponent.setModuleCategoryVocabulary(); if (detail.preventDefault !== true) { if (detail.searchText.length === 0) { stateContext.setRows(state.rows); diff --git a/tests/src/FunctionalJavascript/ProjectBrowserUiTest.php b/tests/src/FunctionalJavascript/ProjectBrowserUiTest.php index a1516a0b5c6c0fe9eb8dffa6e38b41f3a26faee3..bf6c9cc9dc53a442b4b53a0e012cdc8cfb829beb 100644 --- a/tests/src/FunctionalJavascript/ProjectBrowserUiTest.php +++ b/tests/src/FunctionalJavascript/ProjectBrowserUiTest.php @@ -735,6 +735,7 @@ class ProjectBrowserUiTest extends WebDriverTestBase { // Use blur event to close drop-down so Clear is visible. $this->assertSession()->elementExists('css', '.pb-filter__multi-dropdown')->blur(); + $this->assertSame('E-commerce, Media', $page->find('css', '.pb-filter__multi-dropdown__label')->getText()); // Filter by search text. $this->inputSearchField('Number'); @@ -758,9 +759,13 @@ class ProjectBrowserUiTest extends WebDriverTestBase { $this->assertSession()->elementExists('css', '.pb-filter__multi-dropdown')->keyDown(' '); // Apply the second module category filter. - $second_category_filter_selector = '.pb-filter__multi-dropdown__items > .pb-filter__checkbox-label:nth-child(3) input'; + $second_category_filter_selector = '.pb-filter__multi-dropdown__items > .pb-filter__checkbox-label:nth-child(2) input'; $this->clickWithWait("$second_category_filter_selector"); - + // Assert that the filters persist. + $dropdown_items = $page->find('css', '.pb-filter__multi-dropdown__items'); + $labels = $dropdown_items->findAll('css', '.pb-filter__checkbox-label-txt'); + $second_label_text = $labels[1]->getText(); + $this->assertSame($second_label_text, $page->find('css', '.pb-filter__multi-dropdown__label')->getText()); // Save the filter applied in second tab. $applied_filter = $this->getElementText('p.filter-applied:nth-child(1) .filter-applied__label'); // Save the number of results. @@ -770,6 +775,7 @@ class ProjectBrowserUiTest extends WebDriverTestBase { $this->pressWithWait('project_browser_test_mock'); // Assert that the filters persist. $this->assertTrue($assert_session->waitForText('2 Results')); + $this->assertSame('E-commerce, Media', $page->find('css', '.pb-filter__multi-dropdown__label')->getText()); $first_filter_element = $page->find('css', 'p.filter-applied:nth-child(1)'); $this->assertEquals('E-commerce', $first_filter_element->find('css', '.filter-applied__label')->getText()); $second_filter_element = $page->find('css', 'p.filter-applied:nth-child(2)'); @@ -783,6 +789,7 @@ class ProjectBrowserUiTest extends WebDriverTestBase { $this->pressWithWait('random_data'); // Assert that the filters persist. $this->assertEquals($applied_filter, $this->getElementText('p.filter-applied:nth-child(1) .filter-applied__label')); + $this->assertSame($second_label_text, $page->find('css', '.pb-filter__multi-dropdown__label')->getText()); // Assert that the number of results is the same. $results_after = count($page->findAll('css', '#project-browser .pb-project.list')); diff --git a/tests/src/FunctionalJavascript/ProjectBrowserUiTestJsonApi.php b/tests/src/FunctionalJavascript/ProjectBrowserUiTestJsonApi.php index eeda4c21fa4a573b0f28cd53e5d149f55677ef51..a3bb9edf25113176960f472245899c585fcddee4 100644 --- a/tests/src/FunctionalJavascript/ProjectBrowserUiTestJsonApi.php +++ b/tests/src/FunctionalJavascript/ProjectBrowserUiTestJsonApi.php @@ -386,6 +386,7 @@ class ProjectBrowserUiTestJsonApi extends WebDriverTestBase { // Use blur event to close drop-down so Clear is visible. $this->assertSession()->elementExists('css', '.pb-filter__multi-dropdown')->blur(); + $this->assertSame('Commerce/Advertising, E-commerce', $page->find('css', '.pb-filter__multi-dropdown__label')->getText()); // Filter by search text. $this->inputSearchField('th'); @@ -408,6 +409,12 @@ class ProjectBrowserUiTestJsonApi extends WebDriverTestBase { $second_category_filter_selector = '.pb-filter__multi-dropdown .pb-filter__checkbox-label:nth-child(2) input[type="checkbox"]'; $this->clickWithWait("$second_category_filter_selector"); + // Assert that the filters persist. + $dropdown_items = $page->find('css', '.pb-filter__multi-dropdown__items'); + $labels = $dropdown_items->findAll('css', '.pb-filter__checkbox-label-txt'); + $second_label_text = $labels[1]->getText(); + $this->assertSame($second_label_text, $page->find('css', '.pb-filter__multi-dropdown__label')->getText()); + // Save the filter applied in second tab. $applied_filter = $this->getElementText('p.filter-applied:nth-child(1) .filter-applied__label'); // Save the number of results. @@ -421,6 +428,7 @@ class ProjectBrowserUiTestJsonApi extends WebDriverTestBase { $this->assertEquals('Commerce/Advertising', $first_filter_element->find('css', '.filter-applied__label')->getText()); $second_filter_element = $page->find('css', 'p.filter-applied:nth-child(2)'); $this->assertEquals('E-commerce', $second_filter_element->find('css', '.filter-applied__label')->getText()); + $this->assertSame('Commerce/Advertising, E-commerce', $page->find('css', '.pb-filter__multi-dropdown__label')->getText()); $this->assertProjectsVisible([ 'GDPR OneTrust', 'Commerce GoCardless Client', ]); @@ -429,6 +437,7 @@ class ProjectBrowserUiTestJsonApi extends WebDriverTestBase { $page->pressButton('random_data'); // Assert that the filters persist. $this->assertEquals($applied_filter, $this->getElementText('p.filter-applied:nth-child(1) .filter-applied__label')); + $this->assertSame($second_label_text, $page->find('css', '.pb-filter__multi-dropdown__label')->getText()); // Assert that the number of results is the same. $results_after = count($page->findAll('css', '#project-browser .pb-project.pb-project--list'));