diff --git a/composer.json b/composer.json index e08fb7c4bd..4d9b0b3228 100644 --- a/composer.json +++ b/composer.json @@ -10,6 +10,7 @@ "composer/installers": "^1.7", "continuousphp/aws-sdk-phing": "~0.5", "cweagans/composer-patches": "^1.6.4", + "dkarv/mdl-chip-input": "dev-master", "drupal/allowed_formats": "^1.2", "drupal/antibot": "^1.3", "drupal/cached_computed_field": "^1.0-beta5", @@ -361,6 +362,19 @@ } } }, + { + "type": "package", + "package": { + "name": "dkarv/mdl-chip-input", + "version": "dev-master", + "type": "drupal-theme-library", + "source": { + "url": "git@github.com:dkarv/mdl-chip-input.git", + "type": "git", + "reference": "master" + } + } + }, { "type": "package", "package": { diff --git a/composer.lock b/composer.lock index 79968c31ad..2588b16ee4 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "913b88d2d4956cc9661e5145e8308c97", + "content-hash": "6d3281939fd4f08272fed99614527068", "packages": [ { "name": "SEMICeu/adms-ap_validator", @@ -71,16 +71,16 @@ }, { "name": "aws/aws-sdk-php", - "version": "3.133.15", + "version": "3.133.21", "source": { "type": "git", "url": "https://github.com/aws/aws-sdk-php.git", - "reference": "18289bf4a3fe68e9a0853f29d82b6cd4b1de2f9e" + "reference": "3501468a7ef894703141d1c4d68caa3b914cbd96" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/aws/aws-sdk-php/zipball/18289bf4a3fe68e9a0853f29d82b6cd4b1de2f9e", - "reference": "18289bf4a3fe68e9a0853f29d82b6cd4b1de2f9e", + "url": "https://api.github.com/repos/aws/aws-sdk-php/zipball/3501468a7ef894703141d1c4d68caa3b914cbd96", + "reference": "3501468a7ef894703141d1c4d68caa3b914cbd96", "shasum": "" }, "require": { @@ -151,7 +151,7 @@ "s3", "sdk" ], - "time": "2020-02-14T19:09:24+00:00" + "time": "2020-02-24T19:15:07+00:00" }, { "name": "caxy/php-htmldiff", @@ -1168,26 +1168,26 @@ }, { "name": "consolidation/robo", - "version": "1.4.11", + "version": "1.4.12", "source": { "type": "git", "url": "https://github.com/consolidation/Robo.git", - "reference": "5fa1d901776a628167a325baa9db95d8edf13a80" + "reference": "eb45606f498b3426b9a98b7c85e300666a968e51" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/consolidation/Robo/zipball/5fa1d901776a628167a325baa9db95d8edf13a80", - "reference": "5fa1d901776a628167a325baa9db95d8edf13a80", + "url": "https://api.github.com/repos/consolidation/Robo/zipball/eb45606f498b3426b9a98b7c85e300666a968e51", + "reference": "eb45606f498b3426b9a98b7c85e300666a968e51", "shasum": "" }, "require": { - "consolidation/annotated-command": "^2.11.0", - "consolidation/config": "^1.2", - "consolidation/log": "~1", - "consolidation/output-formatters": "^3.1.13", - "consolidation/self-update": "^1", - "grasmash/yaml-expander": "^1.3", - "league/container": "^2.2", + "consolidation/annotated-command": "^2.11.0|^4.1", + "consolidation/config": "^1.2.1", + "consolidation/log": "^1.1.1|^2", + "consolidation/output-formatters": "^3.1.13|^4.1", + "consolidation/self-update": "^1.1.5", + "grasmash/yaml-expander": "^1.4", + "league/container": "^2.4.1", "php": ">=5.5.0", "symfony/console": "^2.8|^3|^4", "symfony/event-dispatcher": "^2.5|^3|^4", @@ -1199,20 +1199,13 @@ "codegyre/robo": "< 1.0" }, "require-dev": { - "codeception/aspect-mock": "^1|^2.1.1", - "codeception/base": "^2.3.7", - "codeception/verify": "^0.3.2", "g1a/composer-test-scenarios": "^3", - "goaop/framework": "~2.1.2", - "goaop/parser-reflection": "^1.1.0", "natxet/cssmin": "3.0.4", - "nikic/php-parser": "^3.1.5", - "patchwork/jsqueeze": "~2", + "patchwork/jsqueeze": "^2", "pear/archive_tar": "^1.4.4", "php-coveralls/php-coveralls": "^1", - "phpunit/php-code-coverage": "~2|~4", - "sebastian/comparator": "^1.2.4", - "squizlabs/php_codesniffer": "^2.8" + "phpunit/phpunit": "^5.7.27", + "squizlabs/php_codesniffer": "^3" }, "suggest": { "henrikbjorn/lurker": "For monitoring filesystem changes in taskWatch", @@ -1240,8 +1233,11 @@ "require": { "symfony/console": "^2.8" }, + "require-dev": { + "phpunit/phpunit": "^4.8.36" + }, "remove": [ - "goaop/framework" + "php-coveralls/php-coveralls" ], "config": { "platform": { @@ -1254,7 +1250,7 @@ } }, "branch-alias": { - "dev-master": "2.x-dev" + "dev-master": "1.x-dev" } }, "autoload": { @@ -1273,7 +1269,7 @@ } ], "description": "Modern task runner", - "time": "2019-10-29T15:50:02+00:00" + "time": "2020-02-18T17:31:26+00:00" }, { "name": "consolidation/self-update", @@ -1698,6 +1694,17 @@ ], "time": "2017-01-20T21:14:22+00:00" }, + { + "name": "dkarv/mdl-chip-input", + "version": "dev-master", + "source": { + "type": "git", + "url": "git@github.com:dkarv/mdl-chip-input.git", + "reference": "master" + }, + "type": "drupal-theme-library", + "time": "2018-10-19T20:09:36+00:00" + }, { "name": "dnoegel/php-xdg-base-dir", "version": "v0.1.1", @@ -4447,17 +4454,17 @@ }, { "name": "drupal/geocoder", - "version": "3.0.0-beta7", + "version": "3.0.0-beta9", "source": { "type": "git", "url": "https://git.drupalcode.org/project/geocoder.git", - "reference": "8.x-3.0-beta7" + "reference": "8.x-3.0-beta9" }, "dist": { "type": "zip", - "url": "https://ftp.drupal.org/files/projects/geocoder-8.x-3.0-beta7.zip", - "reference": "8.x-3.0-beta7", - "shasum": "c9ba155150a57dd2a9c6629e3a96c1eb71a5a20f" + "url": "https://ftp.drupal.org/files/projects/geocoder-8.x-3.0-beta9.zip", + "reference": "8.x-3.0-beta9", + "shasum": "29007881f6d79d6838ee97e74cc0d4ab89e8c519" }, "require": { "davedevelopment/stiphle": "^0.9.2", @@ -4502,8 +4509,8 @@ "dev-3.x": "3.x-dev" }, "drupal": { - "version": "8.x-3.0-beta7", - "datestamp": "1580097487", + "version": "8.x-3.0-beta9", + "datestamp": "1582227193", "security-coverage": { "status": "not-covered", "message": "Beta releases are not covered by Drupal security advisories." @@ -10109,7 +10116,7 @@ "reference": "master" }, "type": "library", - "time": "2019-03-13T23:53:42+00:00" + "time": "2019-04-02T18:33:21+00:00" }, { "name": "stack/builder", @@ -13479,10 +13486,6 @@ "name": "See contributors", "homepage": "https://www.drupal.org/node/3236/committers" }, - { - "name": "pcambra", - "homepage": "https://www.drupal.org/user/122101" - }, { "name": "salvis", "homepage": "https://www.drupal.org/user/82964" @@ -16258,6 +16261,7 @@ ], "minimum-stability": "dev", "stability-flags": { + "dkarv/mdl-chip-input": 20, "drupal/cas_attributes": 20, "drupal/config_exclude": 20, "drupal/config_ignore": 20, diff --git a/config/sync/block.block.entity_bundle_facet.yml b/config/sync/block.block.entity_bundle_facet.yml index 1b66dde6c6..43fe59a582 100644 --- a/config/sync/block.block.entity_bundle_facet.yml +++ b/config/sync/block.block.entity_bundle_facet.yml @@ -9,20 +9,17 @@ dependencies: - joinup_core theme: - joinup_theme -_core: - default_config_hash: 1E3EXKXXTxO26-0FqSGyJmwhR5-3oi4_fatysrd3JfE id: entity_bundle_facet theme: joinup_theme -region: filters +region: sidebar_left weight: -12 provider: null plugin: 'facet_block:type' settings: id: 'facet_block:type' - label: 'Collection content - Content type' + label: 'Content types' provider: facets - label_display: '0' - block_id: entity_bundle_facet + label_display: '1' visibility: request_route: id: request_route diff --git a/config/sync/block.block.exposed_form_search_page.yml b/config/sync/block.block.exposed_form_search_page.yml index 1cfa69b1d0..f14e6f27a7 100644 --- a/config/sync/block.block.exposed_form_search_page.yml +++ b/config/sync/block.block.exposed_form_search_page.yml @@ -9,12 +9,10 @@ dependencies: - views theme: - joinup_theme -_core: - default_config_hash: EhoRQx5awXD5borWP_3kfWUeGlBMOx441rQAxuDWKT4 id: exposed_form_search_page theme: joinup_theme -region: featured -weight: -14 +region: header +weight: -17 provider: null plugin: 'views_exposed_filter_block:search-page_1' settings: diff --git a/config/sync/block.block.global_search.yml b/config/sync/block.block.global_search.yml new file mode 100644 index 0000000000..7a0293358a --- /dev/null +++ b/config/sync/block.block.global_search.yml @@ -0,0 +1,26 @@ +uuid: 413ab78b-eaa2-4f75-872d-5b433bc03f8d +langcode: en +status: true +dependencies: + module: + - joinup_core + - joinup_search + theme: + - joinup_theme +id: global_search +theme: joinup_theme +region: header +weight: -19 +provider: null +plugin: joinup_search_global_search +settings: + id: joinup_search_global_search + label: 'Global search' + provider: joinup_search + label_display: '0' +visibility: + request_route: + id: request_route + routes: view.search.page_1 + negate: true + context_mapping: { } diff --git a/config/sync/block.block.group_facet.yml b/config/sync/block.block.group_facet.yml index e6a5058307..834b5d9027 100644 --- a/config/sync/block.block.group_facet.yml +++ b/config/sync/block.block.group_facet.yml @@ -9,12 +9,10 @@ dependencies: - joinup_core theme: - joinup_theme -_core: - default_config_hash: Q-yF1_SXvQ4zJe7jAbEOjlIknalAqWN6dK4hw2rrFWw id: group_facet theme: joinup_theme -region: filters -weight: -15 +region: sidebar_left +weight: -11 provider: null plugin: 'facet_block:group' settings: @@ -22,7 +20,6 @@ settings: label: 'Search page - Group facet' provider: facets label_display: '0' - block_id: group_facet visibility: request_route: id: request_route diff --git a/config/sync/block.block.joinup_theme_local_tasks.yml b/config/sync/block.block.joinup_theme_local_tasks.yml index 990b7a2b56..b05b9dbce3 100644 --- a/config/sync/block.block.joinup_theme_local_tasks.yml +++ b/config/sync/block.block.joinup_theme_local_tasks.yml @@ -4,12 +4,10 @@ status: true dependencies: theme: - joinup_theme -_core: - default_config_hash: oSSnm-ulGYQXZ_MTRcLJBHUJ4z-8YpaSECm4yCDziW0 id: joinup_theme_local_tasks theme: joinup_theme region: featured -weight: -12 +weight: -13 provider: null plugin: local_tasks_block settings: diff --git a/config/sync/block.block.policy_domain_facet.yml b/config/sync/block.block.policy_domain_facet.yml index 38d04f18fa..726c74d6f9 100644 --- a/config/sync/block.block.policy_domain_facet.yml +++ b/config/sync/block.block.policy_domain_facet.yml @@ -9,12 +9,10 @@ dependencies: - joinup_core theme: - joinup_theme -_core: - default_config_hash: IuqJvNOyi2TlD7hte9DuSYO-nuFTTKb4rcTQt7dcWDk id: policy_domain_facet theme: joinup_theme -region: filters -weight: -14 +region: sidebar_left +weight: -10 provider: null plugin: 'facet_block:policy_domain' settings: @@ -22,7 +20,6 @@ settings: label: 'Search page - Policy domain facet' provider: facets label_display: '0' - block_id: policy_domain_facet visibility: request_route: id: request_route diff --git a/config/sync/block.block.spatial_coverage_facet.yml b/config/sync/block.block.spatial_coverage_facet.yml index 7fba85f293..d94b955775 100644 --- a/config/sync/block.block.spatial_coverage_facet.yml +++ b/config/sync/block.block.spatial_coverage_facet.yml @@ -9,12 +9,10 @@ dependencies: - joinup_core theme: - joinup_theme -_core: - default_config_hash: M2RmoCsVaifOmwYCo5ajei1bXNHAGtfB1WvylYub-ZM id: spatial_coverage_facet theme: joinup_theme -region: filters -weight: -13 +region: sidebar_left +weight: -9 provider: null plugin: 'facet_block:spatial_coverage' settings: @@ -22,7 +20,6 @@ settings: label: 'Search page - Geographical coverage facet' provider: facets label_display: '0' - block_id: spatial_coverage_facet visibility: request_route: id: request_route diff --git a/config/sync/block.block.statistics.yml b/config/sync/block.block.statistics.yml index 38c762cf89..1d43910070 100644 --- a/config/sync/block.block.statistics.yml +++ b/config/sync/block.block.statistics.yml @@ -8,12 +8,10 @@ dependencies: - user theme: - joinup_theme -_core: - default_config_hash: BAp2EWGxFvtlaSYXP8oa99T-gPKU4fwoFEUOIaaDxAA id: statistics theme: joinup_theme region: featured -weight: -13 +weight: -14 provider: null plugin: statistics settings: diff --git a/config/sync/block.block.support.yml b/config/sync/block.block.support.yml index 1e0c313d20..808dbcc547 100644 --- a/config/sync/block.block.support.yml +++ b/config/sync/block.block.support.yml @@ -11,7 +11,7 @@ dependencies: id: support theme: joinup_theme region: header -weight: 0 +weight: -18 provider: null plugin: 'system_menu_block:support' settings: diff --git a/config/sync/facets.facet.group.yml b/config/sync/facets.facet.group.yml index 40bcd0c721..92794194b4 100644 --- a/config/sync/facets.facet.group.yml +++ b/config/sync/facets.facet.group.yml @@ -8,7 +8,7 @@ dependencies: module: - search_api id: group -name: Group +name: Collection/Solution url_alias: group weight: 0 min_count: 1 @@ -16,12 +16,11 @@ show_only_one_result: true field_identifier: entity_groups facet_source_id: 'search_api:views_page__search__page_1' widget: - type: links_inline + type: dropdown config: show_numbers: true - all_text: All - prefix_text: 'From:' - suffix_text: '' + default_option_label: 'Any Collection or Solution' + arbitrary_facet_plugin: _none query_operator: or use_hierarchy: false expand_hierarchy: false @@ -68,4 +67,4 @@ processor_configs: settings: { } empty_behavior: behavior: none -show_title: null +show_title: true diff --git a/config/sync/facets.facet.policy_domain.yml b/config/sync/facets.facet.policy_domain.yml index f17e0e35dc..ba47b9c775 100644 --- a/config/sync/facets.facet.policy_domain.yml +++ b/config/sync/facets.facet.policy_domain.yml @@ -16,12 +16,11 @@ show_only_one_result: true field_identifier: policy_domain facet_source_id: 'search_api:views_page__search__page_1' widget: - type: links_inline + type: dropdown config: show_numbers: true - all_text: 'all policy domains' - prefix_text: about - suffix_text: '' + default_option_label: 'Any policy domain' + arbitrary_facet_plugin: _none query_operator: or use_hierarchy: false expand_hierarchy: false @@ -68,4 +67,4 @@ processor_configs: settings: { } empty_behavior: behavior: none -show_title: null +show_title: true diff --git a/config/sync/facets.facet.spatial_coverage.yml b/config/sync/facets.facet.spatial_coverage.yml index 3a7f2fc6e6..438feccd9d 100644 --- a/config/sync/facets.facet.spatial_coverage.yml +++ b/config/sync/facets.facet.spatial_coverage.yml @@ -8,7 +8,7 @@ dependencies: module: - search_api id: spatial_coverage -name: 'Geographical coverage' +name: 'Geographic coverage' url_alias: spatial_coverage weight: 0 min_count: 1 @@ -16,12 +16,11 @@ show_only_one_result: true field_identifier: spatial_coverage facet_source_id: 'search_api:views_page__search__page_1' widget: - type: links_inline + type: dropdown config: show_numbers: true - all_text: everywhere - prefix_text: 'Located in:' - suffix_text: '' + default_option_label: 'Any location' + arbitrary_facet_plugin: _none query_operator: or use_hierarchy: false expand_hierarchy: false @@ -68,4 +67,4 @@ processor_configs: settings: { } empty_behavior: behavior: none -show_title: null +show_title: true diff --git a/config/sync/facets.facet.type.yml b/config/sync/facets.facet.type.yml index 3bfb2d433b..7ab62eef50 100644 --- a/config/sync/facets.facet.type.yml +++ b/config/sync/facets.facet.type.yml @@ -12,14 +12,17 @@ name: Type url_alias: type weight: 0 min_count: 1 -show_only_one_result: true +show_only_one_result: false field_identifier: entity_bundle facet_source_id: 'search_api:views_page__search__page_1' widget: - type: type + type: checkbox config: show_numbers: true - tabs: 3 + soft_limit: 0 + soft_limit_settings: + show_less_label: 'Show less' + show_more_label: 'Show more' query_operator: or use_hierarchy: false expand_hierarchy: false @@ -28,12 +31,6 @@ hard_limit: 0 exclude: false only_visible_when_facet_source_is_visible: true processor_configs: - active_widget_order: - processor_id: active_widget_order - weights: - sort: -2 - settings: - sort: ASC aggregated_entity_bundle_label: processor_id: aggregated_entity_bundle_label weights: @@ -69,4 +66,4 @@ processor_configs: settings: { } empty_behavior: behavior: none -show_title: null +show_title: false diff --git a/config/sync/node.type.tallinn_report.yml b/config/sync/node.type.tallinn_report.yml index 1d91f85fc2..27b3a161ef 100644 --- a/config/sync/node.type.tallinn_report.yml +++ b/config/sync/node.type.tallinn_report.yml @@ -2,8 +2,6 @@ uuid: 0740f119-f638-4e1f-96d2-4c8be79bb575 langcode: en status: true dependencies: { } -_core: - default_config_hash: LRgsj_XZP0y0hH82LNzJKqLfTjvJiEvddCM1av3jbTA name: 'Tallinn report' type: tallinn_report description: '' @@ -14,4 +12,4 @@ display_submitted: false label_singular: 'Tallinn report' label_plural: 'Tallinn reports' label_count: - no_count_capitalize: !!binary VGFsbGlubiByZXBvcnQDQGNvdW50IFRhbGxpbm4gcmVwb3J0cw== + no_count_capitalize: !!binary VGFsbGlubiByZXBvcnQDVGFsbGlubiByZXBvcnRz diff --git a/config/sync/views.view.search.yml b/config/sync/views.view.search.yml index 105b903315..c20ddaaa61 100644 --- a/config/sync/views.view.search.yml +++ b/config/sync/views.view.search.yml @@ -255,6 +255,50 @@ display: default_group_multiple: { } group_items: { } plugin_id: search_api_string + entity_bundle_1: + id: entity_bundle_1 + table: search_api_index_published + field: entity_bundle + relationship: none + group_type: group + admin_label: '' + operator: '!=' + value: + min: '' + max: '' + value: tallinn_report + group: 1 + exposed: false + expose: + operator_id: '' + label: '' + description: '' + use_operator: false + operator: '' + operator_limit_selection: false + operator_list: { } + identifier: '' + required: false + remember: false + multiple: false + remember_roles: + authenticated: authenticated + placeholder: '' + min_placeholder: '' + max_placeholder: '' + is_grouped: false + group_info: + label: '' + description: '' + identifier: '' + optional: true + widget: select + multiple: false + remember: false + default_group: All + default_group_multiple: { } + group_items: { } + plugin_id: search_api_string sorts: search_api_relevance: id: search_api_relevance diff --git a/tests/features/collection/collection.member_administration.feature b/tests/features/collection/collection.member_administration.feature index eaf7137030..1d5913aab3 100644 --- a/tests/features/collection/collection.member_administration.feature +++ b/tests/features/collection/collection.member_administration.feature @@ -265,7 +265,7 @@ Feature: Collection membership administration When I fill in "E-mail" with "gregory_house@example.com" And I press "Add" - Then the page should show the chips: + Then the page should show the following chips in the Content region: | Gregory House | # Verify that an error message is shown when trying to add a mail not # present in the system. @@ -280,18 +280,18 @@ Feature: Collection membership administration # Add some other users. When I fill in "E-mail" with "j.belanger@example.com" And I press "Add" - Then the page should show the chips: + Then the page should show the following chips in the Content region: | Jeannette Belanger | | Gregory House | When I fill in "E-mail" with "donald_duck@example.com" And I press "Add" - Then the page should show the chips: + Then the page should show the following chips in the Content region: | Jeannette Belanger | | Gregory House | | Donald Duck | # Remove a user. When I press the remove button on the chip "Donald Duck" - Then the page should show only the chips: + Then the page should show the following chips in the Content region: | Jeannette Belanger | | Gregory House | And I should not see the text "Donald Duck" @@ -308,7 +308,7 @@ Feature: Collection membership administration When I click "Add members" When I fill in "E-mail" with "dwight1@example.com" And I press "Add" - Then the page should show the chips: + Then the page should show the following chips in the Content region: | Christian Dwight | When I select "Facilitator" from "Role" And I press "Add members" diff --git a/tests/features/collection/homepage.feature b/tests/features/collection/homepage.feature index 19e632e31a..de927e8d24 100644 --- a/tests/features/collection/homepage.feature +++ b/tests/features/collection/homepage.feature @@ -145,34 +145,6 @@ Feature: Collection homepage And I should see the "Rohirrim make extraordinary deal" tile But I should not see the "Big hobbit feast - fireworks at midnight" tile - Scenario: Forward search facets to the search page (Advanced search) - Given I go to the homepage of the "Middle earth daily" collection - When I click the News content tab - And I click "Supplier exchange" in the "collection policy domain" inline facet - And I click "Advanced search" - Then I should be on the search page - Then the News content tab should be selected - And "Middle earth daily (1)" should be selected in the "from" inline facet - And "Supplier exchange (1)" should be selected in the "policy domain" inline facet - Then I should see the following tiles in the correct order: - | Breaking: Gandalf supposedly plans his retirement | - - Scenario: Forward search facets to the search page are ordered properly - Given I go to the homepage of the "Middle earth daily" collection - When I click the News content tab - And I click "Advanced search" - Then I should be on the search page - Then the News content tab should be selected - Then I should see the following tiles in the correct order: - | Rohirrim make extraordinary deal | - | Breaking: Gandalf supposedly plans his retirement | - - Scenario: Search engines and link crawlers should not follow advanced search link. - Given I go to the homepage of the "Middle earth daily" collection - Then search engines should be discouraged to follow the link "Advanced search" - When I click "Supplier exchange" in the "collection policy domain" inline facet - Then search engines should be discouraged to follow the link "Advanced search" - # Regression test to ensure that related community content does not appear in the draft view. # @see: https://webgate.ec.europa.eu/CITnet/jira/browse/ISAICP-3262 Scenario: The related content should not be shown in the draft view version as part of the content. diff --git a/tests/features/custom_page/custom_page.view.feature b/tests/features/custom_page/custom_page.view.feature index fcff1d1c4a..30c6a43dac 100644 --- a/tests/features/custom_page/custom_page.view.feature +++ b/tests/features/custom_page/custom_page.view.feature @@ -17,14 +17,14 @@ Feature: # An anonymous user can see only the custom pages of the published # groups. When I am on the homepage - And I enter "About" in the header search bar and hit enter + And I enter "About" in the search bar and press enter Then I should see the "About places" tile But I should not see the "About means" tile # Facilitators can see the content created inside their respective group # but not in the search because the content are not indexed. When I am logged in as a facilitator of the "Drafty things" - And I enter "About" in the header search bar and hit enter + And I enter "About" in the search bar and press enter Then I should see the "About places" tile And I should not see the "About means" tile diff --git a/tests/features/isa2_analytics/site_search.feature b/tests/features/isa2_analytics/site_search.feature index 681bb5178e..9f19ea1f32 100644 --- a/tests/features/isa2_analytics/site_search.feature +++ b/tests/features/isa2_analytics/site_search.feature @@ -6,5 +6,5 @@ Feature: Site search Scenario: Search keywords are tracked in analytics. When I am on the homepage - And I enter "sample text 1" in the header search bar and hit enter + When I enter "sample text 1" in the search bar and press enter Then the response should contain "\"search\":{\"keyword\":\"sample text 1\"}" diff --git a/tests/features/joinup_discussion/discussion.invite.feature b/tests/features/joinup_discussion/discussion.invite.feature index 046b566905..6a5ede3a00 100644 --- a/tests/features/joinup_discussion/discussion.invite.feature +++ b/tests/features/joinup_discussion/discussion.invite.feature @@ -137,12 +137,12 @@ Feature: Invite members to subscribe to discussions And I should not see the text "Shaquila Paternoster (paternoster)" When I fill in "E-mail" with "gloruskin.hr@example.com" - And I hit enter in the keyboard on the field "E-mail" + And I hit "enter" in the keyboard on the field "E-mail" And I wait for AJAX to finish Then the page should show only the chips: | Glory Ruskin | When I fill in "E-mail" with "lcrawford@example.com" - And I hit enter in the keyboard on the field "E-mail" + And I hit "enter" in the keyboard on the field "E-mail" And I wait for AJAX to finish Then the page should show the chips: | Lynwood Crawford | @@ -156,7 +156,7 @@ Feature: Invite members to subscribe to discussions # Add another one. When I fill in "E-mail" with "shaquila.paternoster@example.com" - And I hit enter in the keyboard on the field "E-mail" + And I hit "enter" in the keyboard on the field "E-mail" And I wait for AJAX to finish Then the page should show the chips: | Shaquila Paternoster | @@ -179,7 +179,7 @@ Feature: Invite members to subscribe to discussions # Try if it is possible to resend an invitation. Given the mail collector cache is empty When I fill in "E-mail" with "gloruskin.hr@example.com" - And I hit enter in the keyboard on the field "E-mail" + And I hit "enter" in the keyboard on the field "E-mail" And I wait for AJAX to finish Then the page should show only the chips: | Glory Ruskin | @@ -213,7 +213,7 @@ Feature: Invite members to subscribe to discussions When I go to the "Concerned about dissolved gases?" discussion And I click "Invite" And I fill in "E-mail" with "gloruskin.hr@example.com" - And I hit enter in the keyboard on the field "E-mail" + And I hit "enter" in the keyboard on the field "E-mail" And I wait for AJAX to finish Then the page should show only the chips: | Glory Ruskin | diff --git a/tests/features/joinup_search/group_search.feature b/tests/features/joinup_search/group_search.feature new file mode 100644 index 0000000000..a62bff2c16 --- /dev/null +++ b/tests/features/joinup_search/group_search.feature @@ -0,0 +1,254 @@ +@api @terms +Feature: Search inside groups + In order to quickly find content inside the group I am currently perusing + As a user of Joinup + I want to be able to launch a search limited to my current collection or solution + + Background: + Given collection: + | title | Chalet construction | + | logo | logo.png | + | moderation | no | + | policy domain | Demography | + | spatial coverage | Switzerland | + | state | validated | + And solution: + | title | Inclined foundations | + | description | Ways to construct foundations on hills and mountains. | + | banner | banner.jpg | + | logo | logo.png | + | collection | Chalet construction | + | state | validated | + And discussion content: + | title | body | state | collection | solution | + | Room sizes | What are the ideal dimensions? | validated | Chalet construction | | + | Terrace? | Want a decent sized terrace | validated | | Inclined foundations | + And document content: + | title | body | state | collection | solution | + | Ground plan | A classic design | validated | Chalet construction | | + | Rock types | Ranked by hardness | validated | | Inclined foundations | + And event content: + | title | body | state | collection | solution | + | Opening of the winter season | Ski resorts will open in December | validated | Chalet construction | | + | Presenting DrillMaster X88 | Our most finely ground drill bit | validated | | Inclined foundations | + And news content: + | title | body | collection | solution | policy domain | spatial coverage | state | + | Natural materials | Ground feel | Chalet construction | | Statistics and Analysis | Switzerland | validated | + | Still frozen | Maybe next week | | Inclined foundations | | Austria | validated | + And custom_page content: + | title | body | collection | solution | + | Resources | Here are some interesting links. | Chalet construction | | + | Geography | A collection of height maps. | | Inclined foundations | + And releases: + | title | release number | release notes | is version of | state | + | Pre-alpha | 0.0-alpha0 | Only works on flat ground. | Inclined foundations | validated | + And distributions: + | title | description | parent | access url | + | Zip archive | It has files inside. | Pre-alpha | test.zip | + + @javascript + Scenario: Group filters are shown as chips + # Pages that do not belong to a collection or solution do not have chips in + # the search field. + When I am on the homepage + Then the page should not contain any chips + When I visit the collection overview + Then the page should not contain any chips + When I visit the solution overview + Then the page should not contain any chips + When I visit the contact form + Then the page should not contain any chips + + # Check that the name of the collection is shown as a chip in the search + # field on the collection homepage. The chips are initially hidden but will + # appear after clicking on the search icon to open the search bar. + When I go to the homepage of the "Chalet construction" collection + And I open the search bar by clicking on the search icon + Then the page should show the following chip: + | Chalet construction | + + # Do a search without entering any keywords. Because the collection is shown + # as a chip in the search field the search results should be filtered and + # only show the content of the collection. + When I submit the search by pressing enter + Then the option with text "Chalet construction (6)" from select facet "collection/solution" is selected + And the page should show the tiles "Room sizes, Ground plan, Opening of the winter season, Natural materials, Resources, Inclined foundations" + + # Check that other types of pages in the collection also show the collection + # as a chip. + When I go to the "Room sizes" discussion + And I open the search bar by clicking on the search icon + Then the page should show the following chip: + | Chalet construction | + # It should be possible to remove the chip by clicking the delete button. + When I press the remove button on the chip "Chalet construction" + Then the page should not contain any chips + + When I go to the "Ground plan" document + And I open the search bar by clicking on the search icon + Then the page should show the following chip: + | Chalet construction | + # It should be possible to remove the chip by typing a backspace in the + # search field. + When I press backspace in the search bar + Then the page should not contain any chips + + When I go to the "Opening of the winter season" event + And I open the search bar by clicking on the search icon + Then the page should show the following chip: + | Chalet construction | + When I go to the "Natural materials" news + And I open the search bar by clicking on the search icon + Then the page should show the following chip: + | Chalet construction | + When I go to the "Resources" custom page + And I open the search bar by clicking on the search icon + Then the page should show the following chip: + | Chalet construction | + + # Check that the name of the solution is shown as a chip in the search field + # on the solution homepage. + When I go to the homepage of the "Inclined foundations" solution + And I open the search bar by clicking on the search icon + Then the page should show the following chip: + | Inclined foundations | + + # Do a search without entering any keywords. Because the solution is shown + # as a chip in the search field the search results should be filtered and + # only show the content of the solution. + When I submit the search by pressing enter + Then the option with text "Inclined foundations (6)" from select facet "collection/solution" is selected + Then the page should show the tiles "Pre-alpha, Presenting DrillMaster X88, Rock types, Still frozen, Geography, Terrace?" + + # Do a search with a keyword. The chip for the solution should be present + # so the results are filtered by keyword and solution. + Given I am on the homepage of the "Inclined foundations" solution + When I open the search bar by clicking on the search icon + Then the page should show the following chip: + | Inclined foundations | + When I enter "ground" in the search bar and press enter + Then the option with text "Inclined foundations (2)" from select facet "collection/solution" is selected + And the page should show the tiles "Pre-alpha, Presenting DrillMaster X88" + + # Do a search with a keyword after removing the chip for the solution. The + # results should only be filtered by keyword, not by solution. + Given I am on the homepage of the "Inclined foundations" solution + When I open the search bar by clicking on the search icon + And I press the remove button on the chip "Inclined foundations" + And I enter "ground" in the search bar and press enter + Then the option with text "Any Collection or Solution" from select facet "collection/solution" is selected + Then the page should show the tiles "Ground plan, Pre-alpha, Natural materials, Presenting DrillMaster X88" + + # Do a search with a keyword and removing the chip for the solution after + # the keywords have been typed in. This should have the same result. + Given I am on the homepage of the "Inclined foundations" solution + When I open the search bar by clicking on the search icon + And I enter "ground" in the search bar + And I press the remove button on the chip "Inclined foundations" + And I submit the search by pressing enter + Then the page should show the tiles "Ground plan, Pre-alpha, Natural materials, Presenting DrillMaster X88" + + # Check that other types of pages in the solution also show the collection + # as a chip. + When I go to the "Terrace?" discussion + And I open the search bar by clicking on the search icon + Then the page should show the following chip: + | Inclined foundations | + # It should be possible to remove the chip by clicking the delete button. + When I press the remove button on the chip "Inclined foundations" + Then the page should not contain any chips + + When I go to the "Rock types" document + And I open the search bar by clicking on the search icon + Then the page should show the following chip: + | Inclined foundations | + # It should be possible to remove the chip by typing a backspace in the + # search field. + When I press backspace in the search bar + Then the page should not contain any chips + + When I go to the "Presenting DrillMaster X88" event + And I open the search bar by clicking on the search icon + Then the page should show the following chip: + | Inclined foundations | + When I go to the "Still frozen" news + And I open the search bar by clicking on the search icon + Then the page should show the following chip: + | Inclined foundations | + When I go to the "Geography" custom page + And I open the search bar by clicking on the search icon + Then the page should show the following chip: + | Inclined foundations | + When I go to the "Pre-alpha" release + And I open the search bar by clicking on the search icon + Then the page should show the following chip: + | Inclined foundations | + When I go to the "Zip archive" distribution + And I open the search bar by clicking on the search icon + Then the page should show the following chip: + | Inclined foundations | + + @clearStaticCache + Scenario: Group search caching + # Initially the cache is cold. + When I go to the homepage of the "Chalet construction" collection + Then the page should show the following chip: + | Chalet construction | + And the page should not be cached + # A subsequent request should be served from cache. + When I reload the page + Then the page should show the following chip: + | Chalet construction | + And the page should be cached + # Check that changing the name of the collection correctly invalidates the + # cache. + When I change the name of the "Chalet construction" collection to "Chalet destruction" + And I go to the homepage of the "Chalet destruction" collection + Then the page should show the following chip: + | Chalet destruction | + And the page should not be cached + When I reload the page + Then the page should show the following chip: + | Chalet destruction | + And the page should be cached + + @javascript + Scenario: Group filters remain active in the search bar when viewing search results + When I go to the homepage of the "Chalet construction" collection + And I open the search bar by clicking on the search icon + Then the page should show the following chip: + | Chalet construction | + When I enter "ground" in the search bar and press enter + Then the option with text "Chalet construction (2)" from select facet "collection/solution" is selected + And the page should show the tiles "Ground plan, Natural materials" + And the page should show the following chip: + | Chalet construction | + When I press the remove button on the chip "Chalet construction" + And I submit the search by pressing enter + Then the page should not contain any chips + And the page should show the tiles "Ground plan, Pre-alpha, Natural materials, Presenting DrillMaster X88" + + @javascript + Scenario: Group filter chips appear in search bar after selecting them in facets + When I visit the search page + Then the option with text "Any Collection or Solution" from select facet "collection/solution" is selected + And I should see 12 tiles + + When I open the search bar by clicking on the search icon + Then the page should not contain any chips + + When I select "Inclined foundations" from the "collection/solution" select facet + Then the option with text "Inclined foundations (6)" from select facet "collection/solution" is selected + And I should see 6 tiles + + When I open the search bar by clicking on the search icon + Then the page should show the following chip: + | Inclined foundations | + + # The filter chip should remain active when doing another search. + When I enter "ground" in the search bar and press enter + Then the option with text "Inclined foundations (2)" from select facet "collection/solution" is selected + And I should see 2 tiles + When I open the search bar by clicking on the search icon + Then the page should show the following chip: + | Inclined foundations | diff --git a/tests/features/joinup_search/search.feature b/tests/features/joinup_search/search.feature index 65c628b506..9f02a1074f 100644 --- a/tests/features/joinup_search/search.feature +++ b/tests/features/joinup_search/search.feature @@ -2,6 +2,12 @@ Feature: Global search As a user of the site I can find content through the global search. + # Todo: This test runs with javascript enabled because in a non-javascript + # environment, the dropdown facet is simply a list of links. Remove the + # `@javascript` tag when the upstream issue in the Facets module is fixed. + # Ref. https://webgate.ec.europa.eu/CITnet/jira/browse/ISAICP-5739 + # Ref. https://www.drupal.org/project/facets/issues/2937191 + @javascript Scenario: Anonymous user can find items Given the following collection: | title | Molecular cooking collection | @@ -22,55 +28,92 @@ Feature: Global search # @todo The search page cache should be cleared when new content is added. # @see https://webgate.ec.europa.eu/CITnet/jira/browse/ISAICP-3428 And the cache has been cleared - When I am at "/search" + When I visit the search page # All content is visible. Then I should see the "Molecular cooking collection" tile And I should see the "El Celler de Can Roca" tile And I should see the "Spherification" tile And I should see the "Foam" tile - # Inline facets should be in place. - And "all policy domains" should be selected in the "policy domain" inline facet - And the "policy domain" inline facet should allow selecting the following values "Demography (2), Statistics and Analysis (1)" - And "everywhere" should be selected in the "spatial coverage" inline facet - And the "spatial coverage" inline facet should allow selecting the following values "Belgium (1), European Union (1), Luxembourg (1)" + # Facets should be in place. + And the option with text "Any policy domain" from select facet "policy domain" is selected + And the "policy domain" select facet should contain the following options: + | Any policy domain | + | Demography (2) | + | Statistics and Analysis (1) | + And the option with text "Any location" from select facet "spatial coverage" is selected + And the "spatial coverage" select facet should contain the following options: + | Any location | + | Belgium (1) | + | European Union (1) | + | Luxembourg (1) | + # Check that only one search field is available. In an earlier version of + # Joinup there were two search fields, but this was confusing users. + And there should be exactly 1 "search field" on the page # Test the policy domain facet. - When I click "Demography" in the "policy domain" inline facet - Then "Demography (2)" should be selected in the "policy domain" inline facet - And the "policy domain" inline facet should allow selecting the following values "Statistics and Analysis (1), all policy domains" - And "everywhere" should be selected in the "spatial coverage" inline facet - And the "spatial coverage" inline facet should allow selecting the following values "Belgium (1), European Union (1)" + When I select "Demography" from the "policy domain" select facet + Then the option with text "Demography (2)" from select facet "policy domain" is selected + # The selected option moves to the last position by default. + And the "policy domain" select facet should contain the following options: + | Any policy domain | + | Statistics and Analysis (1) | + | Demography (2) | + Then the option with text "Any location" from select facet "spatial coverage" is selected + And the "spatial coverage" select facet should contain the following options: + | Any location | + | Belgium (1) | + | European Union (1) | And I should see the "Molecular cooking collection" tile And I should see the "Spherification" tile But I should not see the "El Celler de Can Roca" tile And I should not see the "Foam" tile # Test the spatial coverage facet. - When I click "Belgium" in the "spatial coverage" inline facet - Then "Belgium (1)" should be selected in the "spatial coverage" inline facet - And the "spatial coverage" inline facet should allow selecting the following values "European Union (1), everywhere" - And "Demography (1)" should be selected in the "policy domain" inline facet - And the "policy domain" inline facet should allow selecting the following values "all policy domains" + When I select "Belgium" from the "spatial coverage" select facet + Then the option with text "Belgium (1)" from select facet "spatial coverage" is selected + And the "spatial coverage" select facet should contain the following options: + | Any location | + | European Union (1) | + | Belgium (1) | + Then the option with text "Demography (1)" from select facet "policy domain" is selected + And the "policy domain" select facet should contain the following options: + | Any policy domain | + | Demography (1) | And I should see the "Molecular cooking collection" tile But I should not see the "El Celler de Can Roca" tile And I should not see the "Spherification" tile And I should not see the "Foam" tile # Reset the search by visiting again the search page. - Given I am at "/search" + Given I am on the search page + Then I should see the text "Content types" in the "Left sidebar" region # Select link in the 'type' facet. - When I click the Solutions content tab - Then the "policy domain" inline facet should allow selecting the following values "Demography (1)" - And the "spatial coverage" inline facet should allow selecting the following values "European Union (1)" + + When I check the "News (1)" checkbox from the "Content types" facet + Then the "News" content checkbox item should be selected + And the "Content types" checkbox facet should allow selecting the following values "Solutions (2), Collection (1), News (1)" + + When I check the "Solutions (2)" checkbox from the "Content types" facet + Then the "Solutions" content checkbox item should be selected + And the "News" content checkbox item should be selected + Then the "Content types" checkbox facet should allow selecting the following values "Solutions (2), Collection (1), News (1)" + And the "policy domain" select facet should contain the following options: + | Any policy domain | + | Demography (1) | + | Statistics and Analysis (1) | + And the "spatial coverage" select facet should contain the following options: + | Any location | + | European Union (1) | + | Luxembourg (1) | And I should not see the "Molecular cooking collection" tile - And I should not see the "El Celler de Can Roca" tile + And I should see the "El Celler de Can Roca" tile But I should see the "Spherification" tile And I should see the "Foam" tile # Launch a text search. - When I fill in "Search" with "Cooking" - And I press "Search" + When I open the search bar by clicking on the search icon + And I enter "Cooking" in the search bar and press enter Then I should see the "Molecular cooking collection" tile And I should see the "Foam" tile But I should not see the "Spherification" tile @@ -126,70 +169,70 @@ Feature: Global search | ulyssesfrees | ulysses.freeman@example.com | Ulysses | Freeman | Omero snc | # "Alpha" is used in all the rdf entities titles. - When I enter "Alpha" in the header search bar and hit enter + When I enter "Alpha" in the search bar and press enter Then the page should show the tiles "Collection alpha, Solution alpha, Release Alpha, Licence Alpha" And I should not see the text "Newsletter omega" # "Omega" is used in all the node entities titles. - When I enter "omega" in the header search bar and hit enter + When I enter "omega" in the search bar and press enter Then the page should show the tiles "News omega, Event Omega, Document omega, Discussion omega, Page omega" # Orphaned entities are not indexed. # And I should see the text "Newsletter omega" # "Beta" is used in all the rdf entities body fields. - When I enter "beta" in the header search bar and hit enter + When I enter "beta" in the search bar and press enter Then the page should show the tiles "Collection alpha, Solution alpha, Release Alpha, Licence Alpha" And I should not see the text "Newsletter omega" # "Epsilon" is used in all the node entities body fields. - When I enter "epsilon" in the header search bar and hit enter + When I enter "epsilon" in the search bar and press enter Then the page should show the tiles "News omega, Event Omega, Document omega, Discussion omega, Page omega" # Orphaned entities are not indexed. # And I should see the text "Newsletter omega" # "Alphabet" is used in all the keywords fields. - When I enter "Alphabet" in the header search bar and hit enter + When I enter "Alphabet" in the search bar and press enter Then the page should show the tiles "Solution alpha, Release Alpha, News omega, Event Omega, Document omega" And I should not see the text "Newsletter omega" # "Gamma" is used in the collection abstract. - When I enter "gamma" in the header search bar and hit enter + When I enter "gamma" in the search bar and press enter Then the page should show the tiles "Collection alpha" And I should not see the text "Newsletter omega" # "Delta" is used in headline and short titles. - When I enter "delta" in the header search bar and hit enter + When I enter "delta" in the search bar and press enter Then the page should show the tiles "News omega, Event Omega, Document omega" And I should not see the text "Newsletter omega" # Search for the event fields: agenda, location, address, organisation, scope. - When I enter "agenda" in the header search bar and hit enter + When I enter "agenda" in the search bar and press enter Then the page should show the tiles "Event Omega" - When I enter "location" in the header search bar and hit enter + When I enter "location" in the search bar and press enter Then the page should show the tiles "Alternative event" - When I enter "place" in the header search bar and hit enter + When I enter "place" in the search bar and press enter Then the page should show the tiles "Event Omega" - When I enter "organisation" in the header search bar and hit enter + When I enter "organisation" in the search bar and press enter Then the page should show the tiles "Alternative event" - When I enter "international" in the header search bar and hit enter + When I enter "international" in the search bar and press enter Then the page should show the tiles "Event Omega" # The owner and contact information names should be indexed inside the solutions/releases they are linked to. - When I enter "responsible" in the header search bar and hit enter + When I enter "responsible" in the search bar and press enter Then the page should show the tiles "Solution alpha, Release Alpha" # Visit the homepage to be sure that the test fetches the correct updated page. When I go to the homepage - And I enter "contact" in the header search bar and hit enter + And I enter "contact" in the search bar and press enter Then the page should show the tiles "Solution alpha, Release Alpha" # Users should be found by first name, family name and organisation. - When I enter "Jenessa" in the header search bar and hit enter + When I enter "Jenessa" in the search bar and press enter Then the page should show the tiles "Jenessa Carlyle" - When I enter "freeman" in the header search bar and hit enter + When I enter "freeman" in the search bar and press enter Then the page should show the tiles "Ulysses Freeman" - When I enter "clyffco" in the header search bar and hit enter + When I enter "clyffco" in the search bar and press enter Then the page should show the tiles "Jenessa Carlyle" - When I enter "Omero+snc" in the header search bar and hit enter + When I enter "Omero+snc" in the search bar and press enter Then the page should show the tiles "Ulysses Freeman" Scenario: Collections and solutions are shown first in search results with the same relevance. @@ -221,7 +264,7 @@ Feature: Global search | Family name | Birdman | # The bird is the word... to search. - When I enter "Bird" in the header search bar and hit enter + When I enter "Bird" in the search bar and press enter Then I should see the following tiles in the correct order: | Ornithology: the study of birds | | Bird outposts in the wild | @@ -232,8 +275,7 @@ Feature: Global search | Bird Birdman | @clearStaticCache - Scenario: Solutions and/or releases are find by their distribution keyword. - + Scenario: Solutions and/or releases are found by their distribution keyword. Given the following licences: | title | | Apache-2.0 | @@ -242,7 +284,7 @@ Feature: Global search | title | Zzolution | | state | validated | - When I enter "ZzoluDistro" in the header search bar and hit enter + When I enter "ZzoluDistro" in the search bar and press enter Then I should see "No content found for your search." # Add distribution, child of solution. @@ -255,18 +297,18 @@ Feature: Global search | format | HTML | | representation technique | Datalog | - When I enter "zzoludistro" in the header search bar and hit enter + When I enter "zzoludistro" in the search bar and press enter Then the page should show only the tiles "Zzolution" - When I enter "ubermensch" in the header search bar and hit enter + When I enter "ubermensch" in the search bar and press enter Then the page should show only the tiles "Zzolution" - When I enter "zzolu-distro" in the header search bar and hit enter + When I enter "zzolu-distro" in the search bar and press enter Then the page should show only the tiles "Zzolution" - When I enter "apache" in the header search bar and hit enter + When I enter "apache" in the search bar and press enter # Also the licence itself is retrieved. Then the page should show only the tiles "Apache-2.0,Zzolution" - When I enter "HTML" in the header search bar and hit enter + When I enter "HTML" in the search bar and press enter Then the page should show only the tiles "Zzolution" - When I enter "Datalog" in the header search bar and hit enter + When I enter "Datalog" in the search bar and press enter Then the page should show only the tiles "Zzolution" Given I am logged in as a moderator @@ -283,48 +325,48 @@ Feature: Global search # Repeat the previous searches to prove that the initial keywords were # removed from the Search API index. Given I am an anonymous user - When I enter "zzoludistro" in the header search bar and hit enter + When I enter "zzoludistro" in the search bar and press enter Then I should see "No content found for your search." - When I enter "ubermensch" in the header search bar and hit enter + When I enter "ubermensch" in the search bar and press enter Then I should see "No content found for your search." - When I enter "zzolu-distro" in the header search bar and hit enter + When I enter "zzolu-distro" in the search bar and press enter Then I should see "No content found for your search." - When I enter "apache" in the header search bar and hit enter + When I enter "apache" in the search bar and press enter Then the page should show only the tiles "Apache-2.0" - When I enter "HTML" in the header search bar and hit enter + When I enter "HTML" in the search bar and press enter Then I should see "No content found for your search." - When I enter "Datalog" in the header search bar and hit enter + When I enter "Datalog" in the search bar and press enter Then I should see "No content found for your search." # Search now with the new keywords. - When I enter "distrozzolu" in the header search bar and hit enter + When I enter "distrozzolu" in the search bar and press enter Then the page should show only the tiles "Zzolution" - When I enter "nietzsche" in the header search bar and hit enter + When I enter "nietzsche" in the search bar and press enter Then the page should show only the tiles "Zzolution" - When I enter "guzzle" in the header search bar and hit enter + When I enter "guzzle" in the search bar and press enter Then the page should show only the tiles "Zzolution" - When I enter "lGPL" in the header search bar and hit enter + When I enter "lGPL" in the search bar and press enter # Also the licence itself is retrieved. Then the page should show only the tiles "LGPL,Zzolution" - When I enter "CSV" in the header search bar and hit enter + When I enter "CSV" in the search bar and press enter Then the page should show only the tiles "Zzolution" - When I enter "Human Language" in the header search bar and hit enter + When I enter "Human Language" in the search bar and press enter Then the page should show only the tiles "Zzolution" Given I delete the "DistroZzolu" asset distribution # The parent solution has been re-indexed without distribution data. - When I enter "distrozzolu" in the header search bar and hit enter + When I enter "distrozzolu" in the search bar and press enter Then I should see "No content found for your search." - When I enter "nietzsche" in the header search bar and hit enter + When I enter "nietzsche" in the search bar and press enter Then I should see "No content found for your search." - When I enter "guzzle" in the header search bar and hit enter + When I enter "guzzle" in the search bar and press enter Then I should see "No content found for your search." - When I enter "lGPL" in the header search bar and hit enter + When I enter "lGPL" in the search bar and press enter Then the page should show only the tiles "LGPL" - When I enter "CSV" in the header search bar and hit enter + When I enter "CSV" in the search bar and press enter Then I should see "No content found for your search." - When I enter "Human Language" in the header search bar and hit enter + When I enter "Human Language" in the search bar and press enter Then I should see "No content found for your search." # Add a new distribution, child of a release. @@ -333,7 +375,7 @@ Feature: Global search | state | validated | | is version of | Zzolution | - When I enter "ReleazzDistro" in the header search bar and hit enter + When I enter "ReleazzDistro" in the search bar and press enter Then I should see "No content found for your search." And the following distribution: @@ -345,18 +387,18 @@ Feature: Global search | format | HTML | | representation technique | Datalog | - When I enter "releazzDistro" in the header search bar and hit enter + When I enter "releazzDistro" in the search bar and press enter Then the page should show only the tiles "Releazz" - When I enter "dracula" in the header search bar and hit enter + When I enter "dracula" in the search bar and press enter Then the page should show only the tiles "Releazz" - When I enter "releazz-distro" in the header search bar and hit enter + When I enter "releazz-distro" in the search bar and press enter Then the page should show only the tiles "Releazz" - When I enter "apache" in the header search bar and hit enter + When I enter "apache" in the search bar and press enter # Also the licence itself is retrieved. Then the page should show only the tiles "Apache-2.0,Releazz" - When I enter "HTML" in the header search bar and hit enter + When I enter "HTML" in the search bar and press enter Then the page should show only the tiles "Releazz" - When I enter "Datalog" in the header search bar and hit enter + When I enter "Datalog" in the search bar and press enter Then the page should show only the tiles "Releazz" Given I am logged in as a moderator @@ -373,46 +415,46 @@ Feature: Global search # Repeat the previous searches to prove that the initial keywords were # removed from the Search API index. Given I am an anonymous user - When I enter "releazzDistro" in the header search bar and hit enter + When I enter "releazzDistro" in the search bar and press enter Then I should see "No content found for your search." - When I enter "dracula" in the header search bar and hit enter + When I enter "dracula" in the search bar and press enter Then I should see "No content found for your search." - When I enter "releazz-distro" in the header search bar and hit enter + When I enter "releazz-distro" in the search bar and press enter Then I should see "No content found for your search." - When I enter "apache" in the header search bar and hit enter + When I enter "apache" in the search bar and press enter Then the page should show only the tiles "Apache-2.0" - When I enter "HTML" in the header search bar and hit enter + When I enter "HTML" in the search bar and press enter Then I should see "No content found for your search." - When I enter "Datalog" in the header search bar and hit enter + When I enter "Datalog" in the search bar and press enter Then I should see "No content found for your search." # Search now with the new keywords. - When I enter "dIstrOreleazz" in the header search bar and hit enter + When I enter "dIstrOreleazz" in the search bar and press enter Then the page should show only the tiles "Releazz" - When I enter "zoRRo" in the header search bar and hit enter + When I enter "zoRRo" in the search bar and press enter Then the page should show only the tiles "Releazz" - When I enter "mishMash" in the header search bar and hit enter + When I enter "mishMash" in the search bar and press enter Then the page should show only the tiles "Releazz" - When I enter "LGpl" in the header search bar and hit enter + When I enter "LGpl" in the search bar and press enter # Also the licence itself is retrieved. Then the page should show only the tiles "LGPL,Releazz" - When I enter "CSV" in the header search bar and hit enter + When I enter "CSV" in the search bar and press enter Then the page should show only the tiles "Releazz" - When I enter "Human Language" in the header search bar and hit enter + When I enter "Human Language" in the search bar and press enter Then the page should show only the tiles "Releazz" Given I delete the "DistroReleazz" asset distribution # The parent release has been re-indexed without distribution data. - When I enter "dIstrOreleazz" in the header search bar and hit enter + When I enter "dIstrOreleazz" in the search bar and press enter Then I should see "No content found for your search." - When I enter "zoRRo" in the header search bar and hit enter + When I enter "zoRRo" in the search bar and press enter Then I should see "No content found for your search." - When I enter "mishMash" in the header search bar and hit enter + When I enter "mishMash" in the search bar and press enter Then I should see "No content found for your search." - When I enter "lGPL" in the header search bar and hit enter + When I enter "lGPL" in the search bar and press enter Then the page should show only the tiles "LGPL" - When I enter "CSV" in the header search bar and hit enter + When I enter "CSV" in the search bar and press enter Then I should see "No content found for your search." - When I enter "Human Language" in the header search bar and hit enter + When I enter "Human Language" in the search bar and press enter Then I should see "No content found for your search." diff --git a/tests/features/solution/homepage_related_content.feature b/tests/features/solution/homepage_related_content.feature index 9c6ff429f6..a799224119 100644 --- a/tests/features/solution/homepage_related_content.feature +++ b/tests/features/solution/homepage_related_content.feature @@ -104,27 +104,6 @@ Feature: Solution homepage # The total downloads of the 2 distributions should be shown. And I should see the text "Downloads: 1172" - Scenario: Forward search facets to the search page (Advanced search) - When I go to the homepage of the "Information sharing protocol" solution - When I click the Document content tab - And I click "E-inclusion" in the "solution policy domain" inline facet - And I click "European Union" in the "solution spatial coverage" inline facet - And I click "Advanced search" - Then I should be on the search page - And the Document content tab should be selected - And "Information sharing protocol (1)" should be selected in the "from" inline facet - And "E-inclusion (1)" should be selected in the "policy domain" inline facet - And "European Union (1)" should be selected in the "spatial coverage" inline facet - # Check that unfiltered content is not shown, including related content. - And I should see the "IS protocol draft 2" tile - But I should not see the "IS protocol paper 1" tile - And I should not see the "Protocol draft" tile - And I should not see the "PDF version" tile - And I should not see the "ZIP version" tile - And I should not see the "Fireproof" tile - And I should not see the "Code of conduct" tile - And I should not see the "Information sharing protocol" tile - # Regression test to ensure that related community content does not appear in the draft view. # @see: https://webgate.ec.europa.eu/CITnet/jira/browse/ISAICP-3262 Scenario: The related content should not be shown in the draft view version as part of the content. diff --git a/tests/features/solution/solution.member_administration.feature b/tests/features/solution/solution.member_administration.feature index 984c5443b0..9e38eb5ba6 100644 --- a/tests/features/solution/solution.member_administration.feature +++ b/tests/features/solution/solution.member_administration.feature @@ -49,7 +49,7 @@ Feature: Solution membership administration When I click "Add members" And I fill in "E-mail" with "marcia_garcia@example.com" And I press "Add" - Then the page should show only the chips: + Then the page should show the following chips in the Content region: | Marcia Garcia | When I select "Facilitator" from "Role" And I press "Add members" diff --git a/tests/src/Chip.php b/tests/src/Chip.php new file mode 100644 index 0000000000..ac569c52bc --- /dev/null +++ b/tests/src/Chip.php @@ -0,0 +1,82 @@ +element = $element; + $this->isVisible = $isVisible; + } + + /** + * Returns the chip text. + * + * @return string + * The chip text. + */ + public function getText(): string { + return $this->isVisible() ? $this->element->getText() : $this->element->getAttribute('data-description'); + } + + /** + * Returns whether or not the chip can be visually interacted with. + * + * @return bool + * TRUE if the chip can be visually interacted with. + */ + public function isVisible(): bool { + return $this->isVisible; + } + + /** + * Returns the remove button. + * + * @return \Behat\Mink\Element\NodeElement|null + * The element representing the remove button, or NULL if no remove button + * is present on the chip. + */ + public function getRemoveButton(): ?NodeElement { + $xpath = "/following-sibling::button[contains(concat(' ', normalize-space(@class), ' '), ' mdl-chip__action ')]"; + return $this->element->find('xpath', $xpath); + } + +} diff --git a/tests/src/Context/ScreenshotContext.php b/tests/src/Context/ScreenshotContext.php index d47ca6ddc7..5a5d1aa9ce 100644 --- a/tests/src/Context/ScreenshotContext.php +++ b/tests/src/Context/ScreenshotContext.php @@ -8,6 +8,7 @@ use Aws\S3\S3ClientInterface; use Behat\Behat\Context\Environment\InitializedContextEnvironment; use Behat\Behat\Hook\Scope\AfterStepScope; +use Behat\Mink\Exception\ExpectationException; use Behat\MinkExtension\Context\RawMinkContext; use Behat\Mink\Driver\Selenium2Driver; use Behat\Mink\Exception\DriverException; @@ -141,7 +142,7 @@ public function screenshotForPhpNotices(AfterStepScope $event) : void { try { $context->assertNotWarningMessage('Notice:'); } - catch (\Exception $e) { + catch (ExpectationException $e) { // Use the step test in the filename. $step = $event->getStep(); $file_name = str_replace(' ', '_', $step->getKeyword() . '_' . $step->getText()); diff --git a/tests/src/Traits/BrowserCapabilityDetectionTrait.php b/tests/src/Traits/BrowserCapabilityDetectionTrait.php index 15812c66f5..654fcea231 100644 --- a/tests/src/Traits/BrowserCapabilityDetectionTrait.php +++ b/tests/src/Traits/BrowserCapabilityDetectionTrait.php @@ -18,7 +18,7 @@ trait BrowserCapabilityDetectionTrait { * Returns TRUE when the browser environment supports executing JavaScript * code, for example because the test is running in Selenium or PhantomJS. */ - protected function browserSupportsJavaScript() { + protected function browserSupportsJavaScript(): bool { $driver = $this->getSession()->getDriver(); try { $driver->executeScript('return;'); diff --git a/tests/src/Traits/KeyboardInteractionTrait.php b/tests/src/Traits/KeyboardInteractionTrait.php new file mode 100644 index 0000000000..ea1bba1f8b --- /dev/null +++ b/tests/src/Traits/KeyboardInteractionTrait.php @@ -0,0 +1,92 @@ +translateKey($key); + + $element->keyDown($key); + try { + $element->keyUp($key); + } + catch (StaleElementReference $e) { + // Depending on the implementation of the user interaction we are trying + // to trigger by pressing the enter key, it is posssible the action is + // triggered on the keydown event or on the keyup event. If it is + // implemented on the keydown event then it might happen that the page + // refreshes immediately without waiting for the key to be released. + // Ignore the fact that the field might already be gone when performing + // the keyup event. + } + } + + /** + * Translates a human readable name for a keyboard key into an escape code. + * + * @param string $key_name + * The human readable key name. + * + * @return string|int + * The escape code for the key, or the originally passed string if the key + * name is not defined in the mapping. + */ + protected function translateKey(string $key_name) { + $keyboard_escape_codes = [ + 'alt' => 18, + 'backspace' => 8, + 'break' => 19, + 'capslock' => 20, + 'ctrl' => 17, + 'delete' => 46, + 'down' => 40, + 'end' => 35, + 'enter' => 13, + 'esc' => 27, + 'escape' => 27, + 'home' => 36, + 'insert' => 45, + 'left' => 37, + 'pagedown' => 34, + 'pageup' => 33, + 'pause' => 19, + 'right' => 39, + 'shift' => 16, + 'tab' => 9, + 'up' => 38, + ]; + // Support for all variations, e.g. ESC, Esc, page up, PageUp. + if (strlen($key_name) > 1) { + $normalized_key_name = strtolower(str_replace(' ', '', $key_name)); + if (array_key_exists($normalized_key_name, $keyboard_escape_codes)) { + return $keyboard_escape_codes[$normalized_key_name]; + } + } + return $key_name; + } + +} diff --git a/tests/src/Traits/TraversingTrait.php b/tests/src/Traits/TraversingTrait.php index eb5472ff27..5aa30685dd 100644 --- a/tests/src/Traits/TraversingTrait.php +++ b/tests/src/Traits/TraversingTrait.php @@ -4,9 +4,11 @@ namespace Drupal\joinup\Traits; +use Behat\Gherkin\Node\TableNode; use Behat\Mink\Element\NodeElement; use Behat\Mink\Element\TraversableElement; use Behat\Mink\Exception\ElementNotFoundException; +use PHPUnit\Framework\Assert; /** * Helper methods to deal with traversing of page elements. @@ -72,6 +74,48 @@ protected function findSelect(string $select, TraversableElement $region = NULL) return $element; } + /** + * Helper method that asserts a selected option of a select element. + * + * @param \Behat\Mink\Element\NodeElement $element + * The select node element. + * @param string $option + * The select option. + * + * @throws \Exception + * Thrown if there is no selected option or the selected option is not the + * correct one. + */ + protected function assertSelectedOption(NodeElement $element, string $option): void { + $option_element = $element->find('xpath', '//option[@selected="selected"]'); + if (!$option_element) { + throw new \Exception('No option is selected in the requested select'); + } + + if (trim($option_element->getText()) !== $option) { + throw new \Exception(sprintf('The option "%s" was not selected in the page %s, %s was selected', $option, $this->getSession()->getCurrentUrl(), $option_element->getHtml())); + } + } + + /** + * Helper method that asserts the available options of select fields. + * + * @param \Behat\Mink\Element\NodeElement $element + * The select element. + * @param \Behat\Gherkin\Node\TableNode $table + * The available list of options. + * + * @throws \Exception + * Throws an exception when the select is not found or options are not + * identical. + */ + protected function assertSelectAvailableOptions(NodeElement $element, TableNode $table): void { + $available_options = $this->getSelectOptions($element); + + $rows = $table->getColumn(0); + Assert::assertEquals($rows, $available_options); + } + /** * Retrieves the options of a select field. * @@ -85,7 +129,7 @@ protected function getSelectOptions(NodeElement $select): array { $options = []; foreach ($select->findAll('xpath', '//option') as $element) { /** @var \Behat\Mink\Element\NodeElement $element */ - $options[$element->getValue()] = trim($element->getText()); + $options[] = trim($element->getText()); } return $options; @@ -243,16 +287,27 @@ protected function getListingByHeading(string $type, string $heading): NodeEleme * * @param string $alias * The facet alias. + * @param \Behat\Mink\Element\NodeElement $region + * (optional) Limit the search to a specific region. If empty, the whole + * page will be used. Defaults to NULL. + * @param string $html_tag + * (optional) Limit to a specific html tag when searching for an element. + * This can be useful in cases where the data drupal facet id is placed in + * more than one html tag e.g. the dropdown has the id placed in both the + *
  • tag of links as well as the + {% endfor %} + + + diff --git a/web/modules/custom/solution/solution.behat.inc b/web/modules/custom/solution/solution.behat.inc index 5bccf26a85..34d88587eb 100644 --- a/web/modules/custom/solution/solution.behat.inc +++ b/web/modules/custom/solution/solution.behat.inc @@ -82,6 +82,7 @@ class SolutionSubContext extends DrupalSubContextBase implements DrupalSubContex * * @When I go to (the homepage of )the :solution solution * @When I visit (the homepage of )the :solution solution + * @Given I am on (the homepage of )the :solution solution */ public function visitSolution($solution) { /** @var \Drupal\rdf_entity\Entity\Rdf $solution */ @@ -105,6 +106,21 @@ class SolutionSubContext extends DrupalSubContextBase implements DrupalSubContex $this->visitPath($path); } + /** + * Navigates to the solution overview page. + * + * @todo This is currently dependent on the Joinup profile being installed, + * since the view providing this overview page is exported in the profile. + * Remove this todo when ISAICP-5176 is fixed. + * + * @see https://webgate.ec.europa.eu/CITnet/jira/browse/ISAICP-5176 + * + * @When I visit the solution overview( page) + */ + public function visitSolutionOverviewPage() { + $this->visitPath('/solutions'); + } + /** * Creates a number of solutions with data provided in a table. * @@ -712,15 +728,6 @@ class SolutionSubContext extends DrupalSubContextBase implements DrupalSubContex } } - /** - * Navigates to the solutions overview page. - * - * @When I visit the solution overview( page) - */ - public function visitSolutionOverviewPage() { - $this->visitPath('/solutions'); - } - /** * Checks that the given tile contains the given number of downloads. * diff --git a/web/profiles/joinup/config/install/block.block.entity_bundle_facet.yml b/web/profiles/joinup/config/install/block.block.entity_bundle_facet.yml index 663f0f238a..b0275d9388 100644 --- a/web/profiles/joinup/config/install/block.block.entity_bundle_facet.yml +++ b/web/profiles/joinup/config/install/block.block.entity_bundle_facet.yml @@ -10,15 +10,15 @@ dependencies: - joinup_theme id: entity_bundle_facet theme: joinup_theme -region: filters +region: sidebar_left weight: -12 provider: null plugin: 'facet_block:type' settings: id: 'facet_block:type' - label: 'Collection content - Content type' + label: 'Content types' provider: facets - label_display: '0' + label_display: '1' visibility: request_route: id: request_route diff --git a/web/profiles/joinup/config/install/block.block.exposed_form_search_page.yml b/web/profiles/joinup/config/install/block.block.exposed_form_search_page.yml index b5fb070a35..92a6dac95a 100644 --- a/web/profiles/joinup/config/install/block.block.exposed_form_search_page.yml +++ b/web/profiles/joinup/config/install/block.block.exposed_form_search_page.yml @@ -10,8 +10,8 @@ dependencies: - joinup_theme id: exposed_form_search_page theme: joinup_theme -region: featured -weight: -14 +region: header +weight: -17 provider: null plugin: 'views_exposed_filter_block:search-page_1' settings: diff --git a/web/profiles/joinup/config/install/block.block.group_facet.yml b/web/profiles/joinup/config/install/block.block.group_facet.yml index cf9322336f..0d0053bbcf 100644 --- a/web/profiles/joinup/config/install/block.block.group_facet.yml +++ b/web/profiles/joinup/config/install/block.block.group_facet.yml @@ -10,8 +10,8 @@ dependencies: - joinup_theme id: group_facet theme: joinup_theme -region: filters -weight: -15 +region: sidebar_left +weight: -11 provider: null plugin: 'facet_block:group' settings: diff --git a/web/profiles/joinup/config/install/block.block.joinup_theme_local_tasks.yml b/web/profiles/joinup/config/install/block.block.joinup_theme_local_tasks.yml index 7080d7a47e..289d20af8a 100644 --- a/web/profiles/joinup/config/install/block.block.joinup_theme_local_tasks.yml +++ b/web/profiles/joinup/config/install/block.block.joinup_theme_local_tasks.yml @@ -6,7 +6,7 @@ dependencies: id: joinup_theme_local_tasks theme: joinup_theme region: featured -weight: -12 +weight: -13 provider: null plugin: local_tasks_block settings: diff --git a/web/profiles/joinup/config/install/block.block.policy_domain_facet.yml b/web/profiles/joinup/config/install/block.block.policy_domain_facet.yml index c631c79f74..70224cdbd9 100644 --- a/web/profiles/joinup/config/install/block.block.policy_domain_facet.yml +++ b/web/profiles/joinup/config/install/block.block.policy_domain_facet.yml @@ -10,8 +10,8 @@ dependencies: - joinup_theme id: policy_domain_facet theme: joinup_theme -region: filters -weight: -14 +region: sidebar_left +weight: -10 provider: null plugin: 'facet_block:policy_domain' settings: diff --git a/web/profiles/joinup/config/install/block.block.spatial_coverage_facet.yml b/web/profiles/joinup/config/install/block.block.spatial_coverage_facet.yml index 77ca66fe39..cae4fce360 100644 --- a/web/profiles/joinup/config/install/block.block.spatial_coverage_facet.yml +++ b/web/profiles/joinup/config/install/block.block.spatial_coverage_facet.yml @@ -10,8 +10,8 @@ dependencies: - joinup_theme id: spatial_coverage_facet theme: joinup_theme -region: filters -weight: -13 +region: sidebar_left +weight: -9 provider: null plugin: 'facet_block:spatial_coverage' settings: diff --git a/web/profiles/joinup/config/install/block.block.statistics.yml b/web/profiles/joinup/config/install/block.block.statistics.yml index 7117f2511b..dde09fd62b 100644 --- a/web/profiles/joinup/config/install/block.block.statistics.yml +++ b/web/profiles/joinup/config/install/block.block.statistics.yml @@ -10,7 +10,7 @@ dependencies: id: statistics theme: joinup_theme region: featured -weight: -13 +weight: -14 provider: null plugin: statistics settings: diff --git a/web/profiles/joinup/config/install/block.block.support.yml b/web/profiles/joinup/config/install/block.block.support.yml index 09926f54c2..6405fe22ae 100644 --- a/web/profiles/joinup/config/install/block.block.support.yml +++ b/web/profiles/joinup/config/install/block.block.support.yml @@ -10,7 +10,7 @@ dependencies: id: support theme: joinup_theme region: header -weight: 0 +weight: -19 provider: null plugin: 'system_menu_block:support' settings: diff --git a/web/profiles/joinup/config/install/views.view.collections.yml b/web/profiles/joinup/config/install/views.view.collections.yml index 3e2d91d701..af020c28ec 100644 --- a/web/profiles/joinup/config/install/views.view.collections.yml +++ b/web/profiles/joinup/config/install/views.view.collections.yml @@ -1,3 +1,5 @@ +# @todo: this view should be moved into the `collection` module. +# @see https://webgate.ec.europa.eu/CITnet/jira/browse/ISAICP-5176 langcode: en status: true dependencies: diff --git a/web/profiles/joinup/config/install/views.view.solutions.yml b/web/profiles/joinup/config/install/views.view.solutions.yml index bf244974cd..b13e36e057 100644 --- a/web/profiles/joinup/config/install/views.view.solutions.yml +++ b/web/profiles/joinup/config/install/views.view.solutions.yml @@ -1,3 +1,5 @@ +# @todo: this view should be moved into the `solution` module. +# @see https://webgate.ec.europa.eu/CITnet/jira/browse/ISAICP-5176 langcode: en status: true dependencies: diff --git a/web/profiles/joinup/joinup.behat.inc b/web/profiles/joinup/joinup.behat.inc index 0c6ecaa434..b6b7db69d2 100644 --- a/web/profiles/joinup/joinup.behat.inc +++ b/web/profiles/joinup/joinup.behat.inc @@ -26,6 +26,7 @@ use Drupal\joinup\Traits\ContextualLinksTrait; use Drupal\joinup\Traits\EntityTrait; use Drupal\joinup\Traits\FileTrait; use Drupal\joinup\Traits\FormTrait; +use Drupal\joinup\Traits\KeyboardInteractionTrait; use Drupal\joinup\Traits\MaterialDesignTrait; use Drupal\joinup\Traits\NodeTrait; use Drupal\joinup\Traits\OgTrait; @@ -59,6 +60,7 @@ class JoinupSubContext extends DrupalSubContextBase { use EntityTrait; use FileTrait; use FormTrait; + use KeyboardInteractionTrait; use MaterialDesignTrait; use NodeTrait; use OgTrait; @@ -302,7 +304,7 @@ class JoinupSubContext extends DrupalSubContextBase { */ public function checkSelectContainsOptions($select, $options) { $field = $this->findSelect($select); - $available_options = array_values($this->getSelectOptions($field)); + $available_options = $this->getSelectOptions($field); $options = $this->explodeCommaSeparatedStepArgument($options); if (array_intersect($options, $available_options) !== $options) { @@ -325,7 +327,7 @@ class JoinupSubContext extends DrupalSubContextBase { */ public function checkSelectDoesNotContainOptions($select, $options) { $field = $this->findSelect($select); - $available_options = array_values($this->getSelectOptions($field)); + $available_options = $this->getSelectOptions($field); $options = $this->explodeCommaSeparatedStepArgument($options); $intersection = array_intersect($available_options, $options); @@ -351,10 +353,7 @@ class JoinupSubContext extends DrupalSubContextBase { */ public function assertSelectOptionsAsList($select, TableNode $table) { $field = $this->findSelect($select); - $available_options = array_values($this->getSelectOptions($field)); - - $rows = $table->getColumn(0); - Assert::assertEquals($rows, $available_options); + $this->assertSelectAvailableOptions($field, $table); } /** @@ -2341,20 +2340,23 @@ JS; } /** - * Press the enter key in the keyboard. + * Press a key in a field. * * Works only in JavaScript-enabled browsers. * + * @param string $key + * The human readable name of the key to press. * @param string $field - * The field where to press the enter key. + * The field in which to press the key. * * @throws \Exception * Thrown when the browser doesn't support JavaScript or when the field is * not found. * - * @When I hit enter( in the keyboard) on the field :field + * @When I hit :key( in the keyboard) on the field :field + * @When I hit|press the :key key in the :field field */ - public function hitEnterKeyboard($field) { + public function pressKeyInField(string $key, string $field): void { if (!$this->browserSupportsJavaScript()) { throw new \Exception('This step requires JavaScript to run.'); } @@ -2364,19 +2366,7 @@ JS; throw new \Exception("Could not find field '$field'"); } - $element->keyDown("\r"); - try { - $element->keyUp("\r"); - } - catch (StaleElementReference $e) { - // Depending on the implementation of the user interaction we are trying - // to trigger by pressing the enter key, it is posssible the action is - // triggered on the keydown event or on the keyup event. If it is - // implemented on the keydown event then it might happen that the page - // refreshes immediately without waiting for the key to be released. - // Ignore the fact that the field might already be gone when performing - // the keyup event. - } + $this->pressKeyInElement($key, $element); } /** @@ -2674,6 +2664,86 @@ JS; Assert::assertEquals($expected_status, $disabled); } + /** + * Checks that there are exactly the given number of elements on the page. + * + * @param string $count + * The number of elements that should be present on the page. + * @param string $element_name + * The human readable name of the element to find on the page. + * + * @Then there should be exactly :count :element_name on the page + */ + public function assertElementCount(string $count, string $element_name): void { + Assert::assertEquals((int) $count, count($this->getElementsMatchingElementAlias($element_name))); + } + + /** + * Returns selectors used to find elements with a human readable identifier. + * + * @param string $alias + * A human readable element identifier. + * + * @return array[] + * An indexed array of selectors intended to be used with Mink's `find()` + * methods. Each value is a tuple containing two strings: + * - 0: the selector, e.g. 'css' or 'xpath'. + * - 1: the locator. + * + * @throws \InvalidArgumentException + * Thrown when the element name is not defined. + */ + protected function getSelectorsMatchingElementAlias(string $alias): array { + $elements = [ + // The various search input fields. + [ + 'names' => [ + 'search bar', + 'search bars', + 'search field', + 'search fields', + ], + 'selectors' => [ + // The site-wide search field in the top right corner. + ['css', 'input#search-bar__input'], + // The search field on the search result pages. + ['css', '#block-exposed-form-search-page input.form-text'], + ], + ], + ]; + + foreach ($elements as $element) { + if (in_array($alias, $element['names'])) { + return $element['selectors']; + } + } + + throw new \InvalidArgumentException("No selectors are defined for the element named '$alias'."); + } + + /** + * Returns elements that match the given human readable identifier. + * + * @param string $alias + * A human readable element identifier. + * + * @return \Behat\Mink\Element\NodeElement[] + * The elements matching the identifier. + * + * @throws \InvalidArgumentException + * Thrown when the element name is not defined. + */ + protected function getElementsMatchingElementAlias(string $alias): array { + $elements = []; + + foreach ($this->getSelectorsMatchingElementAlias($alias) as $selector_tuple) { + list ($selector, $locator) = $selector_tuple; + $elements = array_merge($elements, $this->getSession()->getPage()->findAll($selector, $locator)); + } + + return $elements; + } + /** * Asserts that a paragraph containing the given text is present in the page. * diff --git a/web/themes/joinup/joinup_theme.info.yml b/web/themes/joinup/joinup_theme.info.yml index c34430af16..c0e7f74faa 100644 --- a/web/themes/joinup/joinup_theme.info.yml +++ b/web/themes/joinup/joinup_theme.info.yml @@ -11,6 +11,8 @@ libraries: libraries-extend: core/drupal.tableselect: - joinup_theme/tableselect + facets/drupal.facets.checkbox-widget: + - joinup_theme/facets-extend oe_webtools_cookie_consent/oe_webtools_cookie_consent.cck: - joinup_theme/cookie-extend diff --git a/web/themes/joinup/joinup_theme.libraries.yml b/web/themes/joinup/joinup_theme.libraries.yml index 0b02de7646..62a75794bf 100644 --- a/web/themes/joinup/joinup_theme.libraries.yml +++ b/web/themes/joinup/joinup_theme.libraries.yml @@ -6,7 +6,7 @@ material-design-lite: vendor/material-design-lite/material.min.js: {} global-components: - Version: 1.x + version: 1.x css: theme: css/style.min.css: {} @@ -15,8 +15,21 @@ global-components: dependencies: - core/jquery +global-search: + version: 1.x + js: + js/global-search.js: {} + dependencies: + - joinup_theme/mdl-chip-input + +mdl-chip-input: + version: dev-master + js: + # Hacked version of vendor/mdl-chip-input/dist/mdl-chips-input.js + js/mdl-chips-input.js: {} + form-components: - Version: 1.x + version: 1.x js: js/form.js: {} vendor/autosize/dist/autosize.js: {} @@ -27,7 +40,7 @@ form-components: - core/drupalSettings fieldset-show-more: - Version: 1.x + version: 1.x js: js/fieldset-show-more.js: {} dependencies: @@ -49,6 +62,11 @@ shared_entity: - core/jquery.once - core/drupal +facets-extend: + version: VERSION + js: + js/facets-extend.js: {} + cookie-extend: version: VERSION js: diff --git a/web/themes/joinup/joinup_theme.theme b/web/themes/joinup/joinup_theme.theme index e3ca538989..215287eed3 100644 --- a/web/themes/joinup/joinup_theme.theme +++ b/web/themes/joinup/joinup_theme.theme @@ -162,18 +162,6 @@ function _joinup_non_blue_header_routes() { ]; } -/** - * Get a list of routes which should have navy blue header. - * - * @return array - * The routes. - */ -function _joinup_navy_blue_header_routes() { - return [ - 'view.search.page_1', - ]; -} - /** * Get a list of routes which should have blue header, but they are not forms. * @@ -300,6 +288,10 @@ function joinup_theme_theme($existing, $type, $theme, $path) { 'render element' => 'form', 'path' => $path . '/templates/form', ], + 'joinup_exposed_search' => [ + 'render element' => 'form', + 'path' => $path . '/templates/form', + ], 'social_share' => [ 'variables' => ['entity' => NULL], 'path' => $path . '/templates/parts', @@ -350,7 +342,6 @@ function joinup_theme_preprocess_page(&$variables) { // Get routes which should have modifications. $blue_header_routes = _joinup_blue_header_routes(); - $navy_header_routes = _joinup_navy_blue_header_routes(); $other_forms = _joinup_non_blue_header_routes(); $not_forms = _joinup_not_forms_routes(); @@ -363,10 +354,6 @@ function joinup_theme_preprocess_page(&$variables) { $variables['is_blue_header'] = TRUE; $is_form_container = TRUE; } - - if (in_array($route_name, $navy_header_routes)) { - $variables['is_navy_header'] = TRUE; - } } // Check pattern for add pages. @@ -423,6 +410,11 @@ function joinup_theme_preprocess_page(&$variables) { $variables['custom_content_title'] = $title; } + + // Set a variable that identifies the search page. + if ($route_name == 'view.search.page_1') { + $variables['is_search_page'] = TRUE; + } } /** @@ -610,12 +602,17 @@ function joinup_theme_preprocess_block(&$variables) { } break; + // Add classes to identify the search bars. + case 'global_search': + case 'exposed_form_search_page': + $variables['attributes']['class'][] = 'search-bar search-bar--header search-bar--white mdl-textfield mdl-js-textfield mdl-chipfield mdl-textfield--expandable mdl-textfield--floating-label mdl-textfield--align-right'; + break; + // Add special classes for dropdown menus in header. case 'support': case 'joinup_theme_account_menu': $variables['attributes']['class'][] = 'block--small-nav'; break; - } // Set default title tag. @@ -738,18 +735,6 @@ function joinup_theme_preprocess_container(&$variables) { } } -/** - * Implements hook_preprocess_HOOK() for an advanced search inline facet region. - * - * Template: 'container--facet-region--inline-facets--with-advanced-search'. - */ -function joinup_theme_preprocess_container__facet_region__inline_facets__with_advanced_search(&$variables) { - $variables['advanced_search'] = [ - '#theme' => 'advanced_search_pseudo_facet', - '#entity' => $variables['element']['#entity'], - ]; -} - /** * Implements hook_preprocess_HOOK() for field-multiple-value-form.html.twig. */ @@ -905,6 +890,20 @@ function joinup_theme_preprocess_form(&$variables) { $variables['attributes']['class'][] = 'form__margin-top'; $variables['attributes']['class'][] = 'form__member-actions'; } + + // Get group parameter on the search page. + if ($variables['element']['#id'] == 'views-exposed-form-search-page-1') { + $param = \Drupal::request()->get('f'); + if (isset($param[0])) { + $id = str_replace('group:', '', $param[0], $count); + if ($count == 1) { + $rdf_entity = \Drupal::entityTypeManager()->getStorage('rdf_entity')->load($id); + if (!empty($rdf_entity)) { + $variables['filters'][$id] = $rdf_entity->label(); + } + } + } + } } /** @@ -1439,6 +1438,11 @@ function joinup_theme_theme_suggestions_page_title_alter(array &$suggestions, ar */ function joinup_theme_theme_suggestions_form_alter(array &$suggestions, array $variables) { $suggestions[] = 'form__' . str_replace('-', '_', $variables['element']['#form_id']); + + // Add suggestion for search form in the header. + if ($variables['element']['#id'] == 'views-exposed-form-search-page-1') { + $suggestions[] = 'form__joinup_exposed_search'; + } } /** @@ -1584,6 +1588,12 @@ function joinup_theme_form_alter(&$form, FormStateInterface $form_state, $form_i $form['#theme'][] = 'buttons_separated_form'; } + // Add suggestion for search form in the header. + if ($form['#id'] == 'views-exposed-form-search-page-1') { + $form['#theme'] = ['joinup_exposed_search']; + $form['keys']['#extra_suggestion'] = 'joinup_exposed_search'; + } + // Change markup in an username field. if ($form_id == 'user_form' && isset($form['user_name'])) { $form['user_name']['#template'] = '
    {{ "Username"|t }}
    {{ name }}
    '; @@ -1802,19 +1812,6 @@ function joinup_theme_preprocess_table__file_formatter_table(&$variables) { } } -/** - * Implements hook_form_FORM_ID_alter(). - * - * Add theme suggestions and classes in search form. - */ -function joinup_theme_form_views_exposed_form_alter(&$form, FormStateInterface $form_state, $form_id) { - if (strpos($form['#id'], 'views-exposed-form-search-page-') !== FALSE) { - $form['keys']['#extra_suggestion'] = 'search_bar'; - $form['keys']['#attributes']['class'][] = 'search-bar__input'; - $form['keys']['#attributes']['placeholder'] = t('Start typing to search...'); - } -} - /** * Implements hook_theme_suggestions_HOOK_alter(). * diff --git a/web/themes/joinup/js/facets-extend.js b/web/themes/joinup/js/facets-extend.js new file mode 100644 index 0000000000..c38119d3b9 --- /dev/null +++ b/web/themes/joinup/js/facets-extend.js @@ -0,0 +1,22 @@ +/** + * @file + * Extend facet javascript. + */ + +(function ($, Drupal) { + Drupal.behaviors.alterFactes = { + attach: function (context, settings) { + $(context).find('.facet-item').once('alterFacets').each(function () { + var $label = $(this).find('label'); + var $input = $(this).find('.facets-checkbox'); + var $link = $(this).find('a'); + $label.prepend($input); + $label.append($link); + + $label.addClass('mdl-checkbox mdl-js-checkbox mdl-js-ripple-effect'); + $input.addClass('mdl-checkbox__input'); + }); + } + }; + +})(jQuery, Drupal); diff --git a/web/themes/joinup/js/global-search.js b/web/themes/joinup/js/global-search.js new file mode 100644 index 0000000000..7e1f4b2ea1 --- /dev/null +++ b/web/themes/joinup/js/global-search.js @@ -0,0 +1,47 @@ +/** + * @file + * JavaScript behaviors for the global search bar. + */ + +(function ($, Drupal, drupalSettings) { + 'use strict'; + + Drupal.behaviors.globalSearch = { + attach: function (context, settings) { + // Attach the JS behaviour from mdl-chip-input to the search bar. + new window['MaterialChipInput'](jQuery('.search-bar.mdl-chipfield')[0]); + + // Position input cursor if chip is available. + $('.search-bar--header').each(function () { + var $searchBar = $(this); + var chipWidth = $(this).find('.mdl-chip').width(); + if (chipWidth !== 0) { + chipWidth = chipWidth + 30; + $(this).find('.search-bar__input').css('padding-left', chipWidth + 'px'); + } + + $('.mdl-chip').on('mousedown', function (event) { + event.preventDefault(); + event.stopPropagation(); + }); + + $('.mdl-chip__action').on('click', function () { + var chipWidth = $searchBar.find('.mdl-chip').width(); + if (chipWidth === 0 || chipWidth === undefined) { + $('.search-bar--header').find('.search-bar__input').css('padding-left', '0px'); + } + }); + + $('.search-bar__input').on('keydown', function (event) { + if (event.which === 8) { + var chipWidth = $searchBar.find('.mdl-chip').width(); + if (chipWidth === 0 || chipWidth === undefined) { + $('.search-bar--header').find('.search-bar__input').css('padding-left', '0px'); + } + } + }); + }); + } + }; + +})(jQuery, Drupal, drupalSettings); diff --git a/web/themes/joinup/js/mdl-chips-input.js b/web/themes/joinup/js/mdl-chips-input.js new file mode 100644 index 0000000000..07f5d61181 --- /dev/null +++ b/web/themes/joinup/js/mdl-chips-input.js @@ -0,0 +1,119 @@ +/** + * @file + * Support for chips in input fields. + * + * Based on `dkarv/mdl-chip-input`. + * + * @see https://github.com/dkarv/mdl-chip-input + */ + +(function () { + 'use strict'; + + var MaterialChipInput = function MaterialChipInput(element) { + this.element_ = element; + + this.init(); + }; + window['MaterialChipInput'] = MaterialChipInput; + + MaterialChipInput.prototype.addChip_ = function (id, text) { + var currentChipIds = this.getChipIds(); + if (currentChipIds.indexOf(id) > -1) { + // Ignore duplicates. + return; + } + var chip = document.createElement('span'); + chip.classList = 'mdl-chip mdl-chip--deletable'; + chip.innerHTML = + '' + text + '' + + ''; + var update = this.updateTargets_.bind(this); + chip.getElementsByClassName('mdl-chip__action')[0].onclick = function () { + chip.remove(); + update(); + }; + this.element_.insertBefore(chip, this.inputs_); + }; + + /** + * Returns the IDs of the currently active chips. + */ + MaterialChipInput.prototype.getChipIds = function () { + var currentChipIds = []; + var children = this.element_.children; + for (var i = children.length; i--;) { + if (children[i].classList.contains('mdl-chip')) { + currentChipIds.unshift(children[i].children[0].getAttribute('data-id')); + } + } + return currentChipIds; + }; + + /** + * Updates the hidden value fields to match the currently active chips. + * + * This currently only supports deleting previously existing values if a + * chip is deleted by the user. + */ + MaterialChipInput.prototype.updateTargets_ = function () { + var currentChipIds = this.getChipIds(); + var numTargets = this.targets_.length; + var target; + for (var i = numTargets - 1; i >= 0; i--) { + target = this.targets_[i]; + if (!(currentChipIds.indexOf(target.value) > -1)) { + target.remove(); + } + } + if (currentChipIds.length >= this.options_.maximum) { + this.input_.style.display = 'none'; + } + else { + this.input_.style.display = 'block'; + } + }; + + MaterialChipInput.prototype.mouseDown_ = function (event) { + this.input_.focus(); + }; + + MaterialChipInput.prototype.keyDown_ = function (event) { + var code = event.which || event.keyCode; + if (code === 8 && !this.input_.value) { + // Remove last tag if input is empty. + if (this.element_.children.length > 1) { + this.element_.children[this.element_.children.length - 2].remove(); + this.updateTargets_(); + } + } + }; + + MaterialChipInput.prototype.init = function () { + if (this.element_) { + this.inputs_ = this.element_.getElementsByClassName('inputs')[0]; + + this.input_ = this.element_.getElementsByClassName('mdl-textfield__input')[0]; + this.input_.addEventListener('keydown', this.keyDown_.bind(this)); + this.targets_ = this.element_.getElementsByClassName('mdl-chipfield__input'); + + // Let the whole element look like a input field. + this.element_.addEventListener('click', this.mouseDown_.bind(this)); + + // Set the default options. + this.options_ = { + maximum: Number.MAX_VALUE, + separator: ',' + }; + + // Initialize the chips. + var length = this.targets_.length; + var target; + for (var i = 0; i < length; i++) { + target = this.targets_[i]; + this.addChip_(target.value, target.getAttribute('data-description')); + } + } + }; +})(); diff --git a/web/themes/joinup/prototype/html-prototype-sandbox/partials/filters.mustache b/web/themes/joinup/prototype/html-prototype-sandbox/partials/filters.mustache index 30cdab9c86..315c070ee6 100644 --- a/web/themes/joinup/prototype/html-prototype-sandbox/partials/filters.mustache +++ b/web/themes/joinup/prototype/html-prototype-sandbox/partials/filters.mustache @@ -13,9 +13,6 @@
    Type (18)
    -
    @@ -48,4 +45,4 @@
    - \ No newline at end of file + diff --git a/web/themes/joinup/prototype/sass/_mdl-hacks.sass b/web/themes/joinup/prototype/sass/_mdl-hacks.sass index a000f5d687..c2376e08bb 100644 --- a/web/themes/joinup/prototype/sass/_mdl-hacks.sass +++ b/web/themes/joinup/prototype/sass/_mdl-hacks.sass @@ -80,10 +80,14 @@ .mdl-layout__container height: auto -.filters +.filter .mdl-menu__container max-height: 400px + margin-top: 5px &.is-upgraded + // Align drop down menu to the left on smaller devices. + +breakpoint(sm-mobile, mobile) + left: 0 !important .mdl-menu position: relative .mdl-menu diff --git a/web/themes/joinup/prototype/sass/app.sass b/web/themes/joinup/prototype/sass/app.sass index 51b71a32b5..92eafddef4 100644 --- a/web/themes/joinup/prototype/sass/app.sass +++ b/web/themes/joinup/prototype/sass/app.sass @@ -75,6 +75,7 @@ @import "components/icon-card" @import "components/inline-social-media" @import "components/chip" +@import "components/chipfield" @import "components/invite-form" @import "components/navigation-bottom" @import "components/image-caption" diff --git a/web/themes/joinup/prototype/sass/components/_block.sass b/web/themes/joinup/prototype/sass/components/_block.sass index 9e8fc07ac5..56454c8211 100644 --- a/web/themes/joinup/prototype/sass/components/_block.sass +++ b/web/themes/joinup/prototype/sass/components/_block.sass @@ -17,3 +17,15 @@ margin-top: 40px border-top: 1px solid $color-grey-light +.block-facet--checkbox + h2 + margin-top: 8px + margin-bottom: $tile-margin + .item-list__checkbox + list-style: none + margin-top: 0 + padding: 0 + .mdl-checkbox__label + color: $color-base + font-size: $font-size-small + font-weight: $font-weight \ No newline at end of file diff --git a/web/themes/joinup/prototype/sass/components/_chipfield.sass b/web/themes/joinup/prototype/sass/components/_chipfield.sass new file mode 100644 index 0000000000..34a85304ed --- /dev/null +++ b/web/themes/joinup/prototype/sass/components/_chipfield.sass @@ -0,0 +1,54 @@ +// Chipfield +// +// Markup: todo. +// + +// Component +// -------------------------------------------------- +.mdl-chipfield + //cursor: text + //padding-bottom: 0 + //margin-bottom: 20px + //border-bottom: 1px solid lightgrey + .inputs + margin-left: 5px + //float: left + width: 100% + display: inline-block + //position: relative + .mdl-chip + position: absolute + top: 15px + left: 55px + +z-index(navigation) + //float: left + //margin-top: 15px + //margin-right: 5px + .mdl-textfield__input + // ~ same height as the chips + 2*4 for the padding + //height: 38px + //border-bottom: none + .mdl-textfield__label + top: 8px + // hide stuff from MaterialTextField + .mdl-textfield__label:after + display: none + // search results + .results + width: 100% + max-height: 200px + overflow-y: auto + list-style: none + position: absolute + background-color: white + z-index: 10 + padding: 0 + margin-top: 1px + .results li + cursor: pointer + padding: 10px 5px 10px 10px + &:hover, &.is-selected + background-color: rgb(238, 238, 238) + + + diff --git a/web/themes/joinup/prototype/sass/components/_filters.sass b/web/themes/joinup/prototype/sass/components/_filters.sass index cbb774bd3d..678c351a75 100644 --- a/web/themes/joinup/prototype/sass/components/_filters.sass +++ b/web/themes/joinup/prototype/sass/components/_filters.sass @@ -35,10 +35,6 @@ .filter__term a text-decoration: none -.filter__advanced-search a - text-decoration: none - text-transform: lowercase - .filter__icon position: relative cursor: pointer diff --git a/web/themes/joinup/prototype/sass/components/_search-bar.sass b/web/themes/joinup/prototype/sass/components/_search-bar.sass index 5a40c2f713..7ca2267610 100644 --- a/web/themes/joinup/prototype/sass/components/_search-bar.sass +++ b/web/themes/joinup/prototype/sass/components/_search-bar.sass @@ -33,6 +33,7 @@ font-weight: $font-weight-thin color: lighten($color-grey-medium, 10%) border-bottom-color: lighten($color-grey-medium, 10%) + box-sizing: border-box &::-webkit-input-placeholder font-size: $font-size-base font-weight: $font-weight-thin @@ -171,4 +172,3 @@ width: calc(100% - 280px) .search-bar__input-container width: calc(100% - 50px) - diff --git a/web/themes/joinup/prototype/sass/layouts/sections/_section--sidebar-left.sass b/web/themes/joinup/prototype/sass/layouts/sections/_section--sidebar-left.sass index f352070613..0f53e7e250 100644 --- a/web/themes/joinup/prototype/sass/layouts/sections/_section--sidebar-left.sass +++ b/web/themes/joinup/prototype/sass/layouts/sections/_section--sidebar-left.sass @@ -6,5 +6,39 @@ // -------------------------------------------------- .section--sidebar-left +hidden-print - +breakpoint(xxs, sm) - margin: 0 + &:not(.section--sidebar-left--search) + +breakpoint(xxs, sm) + margin: 0 + +// Elements +// -------------------------------------------------- +.section--sidebar-left--search + min-width: 208px + .section--sidebar-left--search--wrapper + background-color: #F4F5F7 + padding: 5px 20px 20px 20px + +breakpoint(tablet) + margin: 16px 0 0 0 + ul.item-list__checkbox + margin-bottom: 10px + .mdl-checkbox__label + display: flex + flex-direction: row + flex-wrap: wrap + width: 100% + span + display: flex + flex-direction: column + flex-basis: 100% + flex: 1 + &.facet-item__value + flex: 2 + &.facet-item__count + text-align: right + h2 + font-size: 20px + margin-bottom: 10px + h3 + margin-bottom: 5px + select + width: 100% diff --git a/web/themes/joinup/templates/block/block--exposed-form-search-page.html.twig b/web/themes/joinup/templates/block/block--exposed-form-search-page.html.twig deleted file mode 100644 index 76fa21db49..0000000000 --- a/web/themes/joinup/templates/block/block--exposed-form-search-page.html.twig +++ /dev/null @@ -1,46 +0,0 @@ -{# -/** - * @file - * Theme override to display a block. - * - * Available variables: - * - plugin_id: The ID of the block implementation. - * - label: The configured label of the block if visible. - * - configuration: A list of the block's configuration values. - * - label: The configured label for the block. - * - label_display: The display settings for the label. - * - provider: The module or other provider that provided this block plugin. - * - Block plugin specific settings will also be stored here. - * - content: The content of this block. - * - attributes: array of HTML attributes populated by modules, intended to - * be added to the main container tag of this template. - * - id: A valid HTML ID and guaranteed unique. - * - title_attributes: Same as attributes, except applied to the main title - * tag that appears in the template. - * - title_prefix: Additional output populated by modules, intended to be - * displayed in front of the main title tag that appears in the template. - * - title_suffix: Additional output populated by modules, intended to be - * displayed after the main title tag that appears in the template. - * - * @see template_preprocess_block() - */ -#} -{% - set classes = [ - 'block', - 'block-' ~ configuration.provider|clean_class, - 'block-' ~ plugin_id|clean_class, - 'search-bar__block', - 'search-bar--white', - ] -%} - - {{ title_prefix }} - {% if label %} - {{ label }} - {% endif %} - {{ title_suffix }} - {% block content %} - {{ content }} - {% endblock %} - diff --git a/web/themes/joinup/templates/form/container--facet-region--inline-facets--with-advanced-search.html.twig b/web/themes/joinup/templates/form/container--facet-region--inline-facets--with-advanced-search.html.twig deleted file mode 100644 index 82f700a6d0..0000000000 --- a/web/themes/joinup/templates/form/container--facet-region--inline-facets--with-advanced-search.html.twig +++ /dev/null @@ -1,30 +0,0 @@ -{# -/** - * @file - * Theme implementation of the container wrapping facet regions of the search_api_field module. - * - * This is a variant of the container for the inline facet region that also - * includes an 'Advanced search' link. It is used on the collection and solution - * homepages. - * - * Available variables: - * - attributes: HTML attributes for the containing element. - * - children: The rendered child elements of the container. - * - has_parent: A flag to indicate that the container has one or more parent - * containers. - * - * @see template_preprocess_container() - * - * @ingroup themeable - */ -#} -{% - set classes = [ - 'filters', - 'filters--horizontal', - ] -%} - - {{ children }} - {{ advanced_search }} - diff --git a/web/themes/joinup/templates/form/form--joinup-exposed-search.html.twig b/web/themes/joinup/templates/form/form--joinup-exposed-search.html.twig new file mode 100644 index 0000000000..462337c4a0 --- /dev/null +++ b/web/themes/joinup/templates/form/form--joinup-exposed-search.html.twig @@ -0,0 +1,24 @@ +{# +/** + * @file + * Theme override for a 'form' element. + * + * Available variables + * - attributes: A list of HTML attributes for the wrapper element. + * - children: The child elements of the form. + * + * @see template_preprocess_form() + */ +#} +{{ attach_library('joinup_theme/global-search') }} +
    + + + {% for id, filter in filters %} + + {% endfor %} + {{ children }} + +
    diff --git a/web/themes/joinup/templates/form/form-element--textfield--joinup-exposed-search.html.twig b/web/themes/joinup/templates/form/form-element--textfield--joinup-exposed-search.html.twig new file mode 100644 index 0000000000..0e3c5af03a --- /dev/null +++ b/web/themes/joinup/templates/form/form-element--textfield--joinup-exposed-search.html.twig @@ -0,0 +1,47 @@ +{# +/** + * @file + * Theme override for a form element. + * + * Available variables: + * - attributes: HTML attributes for the containing element. + * - errors: (optional) Any errors for this form element, may not be set. + * - prefix: (optional) The form element prefix, may not be set. + * - suffix: (optional) The form element suffix, may not be set. + * - required: The required marker, or empty if the associated form element is + * not required. + * - type: The type of the element. + * - name: The name of the element. + * - label: A rendered label element. + * - label_display: Label display setting. It can have these values: + * - before: The label is output before the element. This is the default. + * The label includes the #title and the required marker, if #required. + * - after: The label is output after the element. For example, this is used + * for radio and checkbox #type elements. If the #title is empty but the + * field is #required, the label will contain only the required marker. + * - invisible: Labels are critical for screen readers to enable them to + * properly navigate through forms but can be visually distracting. This + * property hides the label for everyone except screen readers. + * - attribute: Set the title attribute on the element to create a tooltip but + * output no label element. This is supported only for checkboxes and radios + * in \Drupal\Core\Render\Element\CompositeFormElementTrait::preRenderCompositeFormElement(). + * It is used where a visual label is not needed, such as a table of + * checkboxes where the row and column provide the context. The tooltip will + * include the title and required marker. + * - description: (optional) A list of description properties containing: + * - content: A description of the form element, may not be set. + * - attributes: (optional) A list of HTML attributes to apply to the + * description content wrapper. Will only be set when description is set. + * - description_display: Description display setting. It can have these values: + * - before: The description is output before the element. + * - after: The description is output after the element. This is the default + * value. + * - invisible: The description is output after the element, hidden visually + * but available to screen readers. + * - disabled: True if the element is disabled. + * - title_display: Title display setting. + * + * @see template_preprocess_form_element() + */ +#} +{{ children }} diff --git a/web/themes/joinup/templates/form/input--textfield--joinup-exposed-search.html.twig b/web/themes/joinup/templates/form/input--textfield--joinup-exposed-search.html.twig new file mode 100644 index 0000000000..4bd655de73 --- /dev/null +++ b/web/themes/joinup/templates/form/input--textfield--joinup-exposed-search.html.twig @@ -0,0 +1,13 @@ +{# +/** + * @file + * Theme override for an 'input' #type form element. + * + * Available variables: + * - attributes: A list of HTML attributes for the input element. + * - children: Optional additional rendered elements. + * + * @see template_preprocess_input() + */ +#} +{{ children }} diff --git a/web/themes/joinup/templates/form/joinup-exposed-search.html.twig b/web/themes/joinup/templates/form/joinup-exposed-search.html.twig new file mode 100644 index 0000000000..7715c0bb1a --- /dev/null +++ b/web/themes/joinup/templates/form/joinup-exposed-search.html.twig @@ -0,0 +1,14 @@ +{# +/** + * @file + * Default theme implementation for the global search bar. + * + * Available variables: + * - filters: the search filters, to be displayed as chips. + * + * @see template_preprocess_joinup_search_global_search() + * + * @ingroup themeable + */ +#} +{{ form.keys }} \ No newline at end of file diff --git a/web/themes/joinup/templates/form/joinup-search-global-search.html.twig b/web/themes/joinup/templates/form/joinup-search-global-search.html.twig new file mode 100644 index 0000000000..bde88e82a4 --- /dev/null +++ b/web/themes/joinup/templates/form/joinup-search-global-search.html.twig @@ -0,0 +1,26 @@ +{# +/** + * @file + * Default theme implementation for the global search bar. + * + * Available variables: + * - filters: the search filters, to be displayed as chips. + * + * @see template_preprocess_joinup_search_global_search() + * + * @ingroup themeable + */ +#} +{{ attach_library('joinup_theme/global-search') }} +
    + + +
    + {% for id, filter in filters %} + + {% endfor %} + +
    +
    diff --git a/web/themes/joinup/templates/layout/page.html.twig b/web/themes/joinup/templates/layout/page.html.twig index 370ec9385f..c9ca7d5b44 100644 --- a/web/themes/joinup/templates/layout/page.html.twig +++ b/web/themes/joinup/templates/layout/page.html.twig @@ -49,8 +49,6 @@ {% if is_front and not logged_in %} {% include directory ~ '/templates/parts/featured--anonymous.html.twig' %} - {% elseif page.featured and is_navy_header %} - {% include directory ~ '/templates/parts/featured--navy-blue.html.twig' %} {% elseif page.featured or is_blue_header %}