diff --git a/solution/ui/e2e/cypress/e2e/policy-repository.spec.cy.js b/solution/ui/e2e/cypress/e2e/policy-repository.spec.cy.js index eee90b9e55..c1d56b4d90 100644 --- a/solution/ui/e2e/cypress/e2e/policy-repository.spec.cy.js +++ b/solution/ui/e2e/cypress/e2e/policy-repository.spec.cy.js @@ -46,8 +46,8 @@ describe("Policy Repository", () => { cy.url().should("include", "/policy-repository?subjects=2"); }); - it("should make a successful request to the file-manager/files endpoint", () => { - cy.intercept("**/v3/file-manager/files?**").as("files"); + it("should make a successful request to the content-search endpoint", () => { + cy.intercept("**/v3/content-search/?**").as("files"); cy.viewport("macbook-15"); cy.eregsLogin({ username, password }); cy.visit("/policy-repository"); @@ -59,7 +59,7 @@ describe("Policy Repository", () => { }); it("loads the correct subject and search query when the URL is changed", () => { - cy.intercept("**/v3/file-manager/files?subjects=1&q=test**").as("qFiles"); + cy.intercept("**/v3/content-search/?subjects=1&q=test**").as("qFiles"); cy.viewport("macbook-15"); cy.eregsLogin({ username, password }); cy.visit("/policy-repository"); @@ -109,7 +109,7 @@ describe("Policy Repository", () => { }); it("should display and fetch the correct subjects on load if they are included in URL", () => { - cy.intercept("**/v3/file-manager/files?subjects=1&subjects=2**", { + cy.intercept("**/v3/content-search/?subjects=1&subjects=2**", { fixture: "policy-docs.json", }).as("subjectFiles"); cy.viewport("macbook-15"); @@ -130,12 +130,13 @@ describe("Policy Repository", () => { .find("a") .should("have.attr", "href") .and("not.include", "undefined") - .and("include", "/42/430/5#430-5"); + .and("include", "/42/435/116#435-116"); + cy.checkAccessibility(); }); it("should display and fetch the correct search query on load if it is included in URL", () => { - cy.intercept("**/v3/file-manager/files?q=test**").as("qFiles"); + cy.intercept("**/v3/content-search/?q=test**").as("qFiles"); cy.viewport("macbook-15"); cy.eregsLogin({ username, password }); cy.visit("/policy-repository/?q=test"); @@ -145,6 +146,74 @@ describe("Policy Repository", () => { cy.get("input#main-content").should("have.value", "test"); }); + it("should have a Documents to Show checkbox list", () => { + cy.viewport("macbook-15"); + cy.eregsLogin({ username, password }); + cy.visit("/policy-repository"); + cy.get(".doc-type__toggle-container h3").should( + "have.text", + "Documents to Show" + ); + cy.get(".doc-type__toggle fieldset").should("exist"); + cy.get(".doc-type__toggle fieldset > div").should("have.length", 2); + cy.get(".doc-type__toggle fieldset > div") + .eq(0) + .find("label") + .should("have.text", "Public Resources"); + cy.get(".doc-type__toggle fieldset > div") + .eq(0) + .find("input") + .should("be.checked") + .and("have.value", "external"); + cy.get(".doc-type__toggle fieldset > div") + .eq(1) + .find("label") + .should("have.text", "Internal Resources"); + cy.get(".doc-type__toggle fieldset > div") + .eq(1) + .find("input") + .should("be.checked") + .and("have.value", "internal"); + }); + + it("should show only the Table of Contents if both or neither checkboxes are checked", () => { + cy.viewport("macbook-15"); + cy.eregsLogin({ username, password }); + cy.visit("/policy-repository"); + cy.get(".subj-toc__container").should("exist"); + cy.get(".doc-type__toggle fieldset > div") + .eq(0) + .find("input") + .uncheck({force: true}); + cy.url().should("include", "/policy-repository?type=internal"); + cy.get(".subj-toc__container").should("not.exist"); + cy.get(".doc-type__toggle fieldset > div") + .eq(1) + .find("input") + .uncheck({force: true}); + cy.get(".subj-toc__container").should("exist"); + cy.get(".doc-type__toggle fieldset > div") + .eq(0) + .find("input") + .check({force: true}); + cy.get(".doc-type__toggle fieldset > div") + .eq(1) + .find("input") + .check({force: true}); + cy.url().should("include", "/policy-repository?type=all"); + }); + + it("should not make a request to the content-search endpoint if both checkboxes are checked on load", () => { + cy.intercept("**/v3/content-search/**").as("contentSearch"); + cy.viewport("macbook-15"); + cy.eregsLogin({ username, password }); + cy.visit("/policy-repository"); + cy.wait(2000); + cy.get("@contentSearch.all").then((interception) => { + expect(interception).to.have.length(0); + }); + }); + it("goes to another SPA page from the policy repository page", () => { cy.viewport("macbook-15"); cy.eregsLogin({ username, password }); @@ -183,8 +252,8 @@ describe("Policy Repository Search", () => { cy.get("#loginIndicator").should("be.visible"); }); - it("should make a successful request to the file-manager/files endpoint", () => { - cy.intercept("**/v3/file-manager/files**").as("queriedFiles"); + it("should make a successful request to the content-search endpoint", () => { + cy.intercept("**/v3/content-search/?**").as("queriedFiles"); cy.viewport("macbook-15"); cy.eregsLogin({ username, diff --git a/solution/ui/e2e/cypress/fixtures/policy-docs.json b/solution/ui/e2e/cypress/fixtures/policy-docs.json index aa0ad1b678..0383be0fc1 100644 --- a/solution/ui/e2e/cypress/fixtures/policy-docs.json +++ b/solution/ui/e2e/cypress/fixtures/policy-docs.json @@ -1,48 +1,148 @@ { - "count":1, - "next":null, + "count": 2, + "next": null, "previous": null, - "results": - [ - { - "document_name": "[Mock] Cypress Fixture", - "file_name": "ff-test-em.pdf", - "date": "2023-08-30", - "summary": "This is a test of the ABP broadcasting system", - "locations": [ - { - "id": 959, - "title": 42, - "part": 430, - "type": "section", - "section_id": 5, - "parent": 955 + "results": [ + { + "doc_name_string": null, + "file_name_string": null, + "date_string": "2019-07-26", + "summary_string": "State Guidance for the New Limited Exception to the IMD Exclusion for Certain Pregnant and Postpartum Women included in Section 1012 of the Substance Use-Disorder Prevention that Promotes Opioid Recovery and Treatment (SUPPORT) for Patients and Communities Act (Pub. L. 115-271), entitled Help for Moms and Babies", + "locations": [ + { + "id": 242, + "title": 42, + "part": 435, + "type": "section", + "section_id": 116, + "parent": 876 + }, + { + "id": 256, + "title": 42, + "part": 435, + "type": "section", + "section_id": 301, + "parent": 877 + }, + { + "id": 29, + "title": 42, + "part": 440, + "type": "section", + "section_id": 140, + "parent": 1124 + }, + { + "id": 30, + "title": 42, + "part": 440, + "type": "section", + "section_id": 160, + "parent": 1124 + }, + { + "id": 53, + "title": 42, + "part": 440, + "type": "section", + "section_id": 210, + "parent": 1125 + }, + { + "id": 54, + "title": 42, + "part": 440, + "type": "section", + "section_id": 220, + "parent": 1125 + }, + { + "id": 10, + "title": 42, + "part": 440, + "type": "section", + "section_id": 250, + "parent": 1125 + } + ], + "document_type": null, + "resource_type": "external", + "subjects": [], + "category": { + "id": 9, + "name": "CMCS Informational Bulletin (CIB)", + "description": "", + "order": 300, + "show_if_empty": false, + "is_fr_doc_category": false, + "type": "subcategory", + "parent": { + "id": 5, + "name": "Subregulatory Guidance", + "description": "SMDLs, SHOs, CIBs, FAQs, SMM", + "order": 400, + "show_if_empty": true, + "is_fr_doc_category": false, + "type": "" + } }, - { - "id": 850, - "title": 42, - "part": 430, - "type": "section", - "section_id": 10, - "parent": 960 - } - ], - "document_type": { - "id": 4, - "name": "Informal Guidance", - "description": "Useful internal emails and one-pagers" + "url": "https://www.medicaid.gov/federal-policy-guidance/downloads/cib072619-1012.pdf", + "document_name_headline": null, + "summary_headline": "SUPPORT) for Patients and Communities Act (Pub. L. 115-271), entitled Help for Moms and Babies" }, - "subjects": [ - { + { + "doc_name_string": "[Mock] Cypress Fixture", + "file_name_string": "ff-test-em.pdf", + "date_string": "2023-08-30", + "summary_string": "This is the summary. Rubber baby buggy bumper", + "locations": [ + { + "id": 1355, + "title": 42, + "part": 400, + "type": "subpart", + "subpart_id": "A" + }, + { + "id": 2974, + "title": 45, + "part": 75, + "type": "section", + "section_id": 101, + "parent": 3318 + } + ], + "document_type": { "id": 2, - "full_name": "Alternative Benefit Plan", - "short_name": null, - "abbreviation": "ABP" - } - ], - "uid": "e641d2f8-7fde-41d5-a025-8388bb51d6ae", - "document_name_headline": null, - "summary_headline": null - } -] + "name": "Curated Formal Guidance", + "description": "Collections of references and excerpts from public materials, such as State Medicaid Manual" + }, + "resource_type": "internal", + "subjects": [ + { + "id": 3, + "full_name": "Access to Services", + "short_name": null, + "abbreviation": null + }, + { + "id": 4, + "full_name": "Adult Day Health", + "short_name": null, + "abbreviation": null + }, + { + "id": 5, + "full_name": "Ambulatory Prenatal Care", + "short_name": null, + "abbreviation": null + } + ], + "category": {}, + "url": "d89af093-8975-4bcb-a747-abe346ebb274", + "document_name_headline": "[Mock] Cypress Fixture", + "summary_headline": "This is the summary. Rubber baby buggy bumper" + } + ] } diff --git a/solution/ui/regulations/.eslintrc.json b/solution/ui/regulations/.eslintrc.json index 2a5b4f89f7..068cac751a 100644 --- a/solution/ui/regulations/.eslintrc.json +++ b/solution/ui/regulations/.eslintrc.json @@ -17,6 +17,7 @@ "rules": { "eqeqeq": "off", "no-console": ["error", { "allow": ["warn", "error"] }], + "no-nested-ternary": "off", "vue/order-in-components": "off", "vue/no-unsupported-features": [ "error", @@ -24,6 +25,7 @@ "version": "^2.7.0", "ignores": [] } - ] + ], + "vue/no-v-html": "off" } } diff --git a/solution/ui/regulations/css/scss/_application_settings.scss b/solution/ui/regulations/css/scss/_application_settings.scss index 017e3102fd..86cde58fcf 100644 --- a/solution/ui/regulations/css/scss/_application_settings.scss +++ b/solution/ui/regulations/css/scss/_application_settings.scss @@ -131,6 +131,9 @@ $jump_to_submit_active_focus: $dark_blue; $policy_subject_selected_chip_background: $dark_blue; +$choice-checked-background-color: $mid_blue; +$choice-checked-border-color: $mid_blue; + // Borders $border_color: $light_gray; diff --git a/solution/ui/regulations/css/scss/partials/_policy_repository.scss b/solution/ui/regulations/css/scss/partials/_policy_repository.scss index 6cd68b238b..9a6b17fca0 100644 --- a/solution/ui/regulations/css/scss/partials/_policy_repository.scss +++ b/solution/ui/regulations/css/scss/partials/_policy_repository.scss @@ -59,6 +59,15 @@ .sidebar__filters { flex: 1; + margin-bottom: 1rem; + + @mixin filter-container-styles { + padding: 0.75rem 1rem; + border: 2px solid $border_color; + border-radius: 4px; + margin-block-start: 1rem; + margin-block-end: 1rem; + } .sticky-container { position: sticky; @@ -106,12 +115,34 @@ } } + .doc-type__toggle { + @include filter-container-styles; + + fieldset { + margin-top: 0; + + .ds-c-choice:checked + label::before { + background-color: $mid_blue; + border-color: $mid_blue; + } + + label { + margin: 0; + font-size: 18px; + line-height: 24px; + } + + div:not(:last-child) { + margin-bottom: 0.75rem; + } + } + } + .subjects__list { height: 300px; overflow: scroll; - padding: 0.75rem 1rem; - border: 2px solid $border_color; - border-radius: 4px; + + @include filter-container-styles; .subjects__li { margin-bottom: 0.75rem; @@ -221,6 +252,10 @@ &--view { font-size: $font-size-sm; } + + &--search { + font-weight: 400; + } } .document__subjects { @@ -231,6 +266,11 @@ .subject__chip { @include common-chip-styles; + + font-size: 11px; + line-height: 18px; + height: unset; + padding: 2px 8px; } } } diff --git a/solution/ui/regulations/eregs-component-lib/src/components/shared-components/results-item-parts/RelatedSections.vue b/solution/ui/regulations/eregs-component-lib/src/components/shared-components/results-item-parts/RelatedSections.vue index 00f8db29a1..ea1f20c691 100644 --- a/solution/ui/regulations/eregs-component-lib/src/components/shared-components/results-item-parts/RelatedSections.vue +++ b/solution/ui/regulations/eregs-component-lib/src/components/shared-components/results-item-parts/RelatedSections.vue @@ -22,9 +22,10 @@ const props = defineProps({ }, }); -const filteredLocations = props.item.locations.filter( - (location) => props.partsLastUpdated[location.part] -); +const filteredLocations = props.item.locations.filter((location) => { + const { part } = location; + return props.partsLastUpdated[part]; +}); const locationsCount = filteredLocations.length; const groupedLocations = _groupBy(filteredLocations, "title"); diff --git a/solution/ui/regulations/eregs-vite/src/components/policy-repository/DocumentTypeSelector.vue b/solution/ui/regulations/eregs-vite/src/components/policy-repository/DocumentTypeSelector.vue new file mode 100644 index 0000000000..047ff7e42b --- /dev/null +++ b/solution/ui/regulations/eregs-vite/src/components/policy-repository/DocumentTypeSelector.vue @@ -0,0 +1,77 @@ + + + diff --git a/solution/ui/regulations/eregs-vite/src/components/policy-repository/PolicyResults.vue b/solution/ui/regulations/eregs-vite/src/components/policy-repository/PolicyResults.vue index e514ef7504..a4478754a2 100644 --- a/solution/ui/regulations/eregs-vite/src/components/policy-repository/PolicyResults.vue +++ b/solution/ui/regulations/eregs-vite/src/components/policy-repository/PolicyResults.vue @@ -1,5 +1,8 @@