diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md index 8d5d98ab4..cb3056c14 100644 --- a/.github/ISSUE_TEMPLATE/bug_report.md +++ b/.github/ISSUE_TEMPLATE/bug_report.md @@ -16,16 +16,25 @@ Please test using the latest version of the application to make sure the issue h -## πŸ€” Expected Behavior +## How to reproduce - +Steps to reproduce the issue: -## 😯 Current Behavior + 1. Open the application in a browser - + 2. + + 3. + +## 😯 Current Behavior + +## πŸ€” Expected Behavior + + + ## πŸ’ Possible Solution @@ -33,7 +42,6 @@ Please test using the latest version of the application to make sure the issue h ## πŸ”¦ Context - ## πŸ’» Code Sample @@ -48,4 +56,4 @@ Please test using the latest version of the application to make sure the issue h | ---------------- | ---------- | | Browser | | Operating System | -| NPM/Node/Yarn | +| | diff --git a/.github/ISSUE_TEMPLATE/documentation.md b/.github/ISSUE_TEMPLATE/documentation.md index 4f62280d8..ebf526bc5 100644 --- a/.github/ISSUE_TEMPLATE/documentation.md +++ b/.github/ISSUE_TEMPLATE/documentation.md @@ -1,11 +1,11 @@ --- name: πŸ“š Documentation -about: Find an inaccuracy in the documentation or something missing? +about: Found an inaccuracy in the documentation or something missing? labels: 'scope:documentation' --- diff --git a/.github/ISSUE_TEMPLATE/feature_request.md b/.github/ISSUE_TEMPLATE/feature_request.md index 88f2fcfee..a241468ac 100644 --- a/.github/ISSUE_TEMPLATE/feature_request.md +++ b/.github/ISSUE_TEMPLATE/feature_request.md @@ -13,26 +13,22 @@ Please provide a clear and concise description of what the feature would be. # πŸ™‹ Feature Request - - -## πŸ€” Expected Behavior - - - -## 😯 Current Behavior - - - -## πŸ’ Possible Solution - - + ## πŸ”¦ Context - + +## 😯 Describe the feature + + + ## πŸ’» Examples + +## πŸ’ Possible Solution + + diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md index dfc96029a..8aba96865 100644 --- a/.github/pull_request_template.md +++ b/.github/pull_request_template.md @@ -1,31 +1,19 @@ ## Description - + ## Related issues ## Impacted Areas in the application - + ## Testing - - -## Deploy Notes - - + diff --git a/.travis.yml b/.travis.yml index 69447fe26..b5a2412b7 100644 --- a/.travis.yml +++ b/.travis.yml @@ -10,10 +10,10 @@ branches: language: node_js -cache: - yarn: true - directories: - - node_modules +cache: false +# yarn: true +# directories: +# - node_modules install: - yarn install --frozen-lockfile diff --git a/src/components/Form/FormHelpButton.test.tsx b/src/components/Form/FormHelpButton.test.tsx index 088cafb81..be79d4714 100644 --- a/src/components/Form/FormHelpButton.test.tsx +++ b/src/components/Form/FormHelpButton.test.tsx @@ -1,5 +1,5 @@ import React from 'react' -import { render, fireEvent } from '@testing-library/react' +import { render, fireEvent, waitForElementToBeRemoved } from '@testing-library/react' import FormHelpButton from './FormHelpButton' describe('FormHelpButton', () => { @@ -15,28 +15,52 @@ describe('FormHelpButton', () => { expect(queryByText('def')).toBeNull() }) - it('opens', () => { - const { getByLabelText, queryByText } = render() + it('opens', async () => { + const { getByLabelText, findByText, queryByText } = render() - fireEvent.focus(getByLabelText('help')) + fireEvent.click(getByLabelText('help')) + await findByText('def') expect(queryByText('def')).not.toBeNull() }) - it('displays help', () => { - const { getByLabelText, getByText } = render() + it('displays help', async () => { + const { getByLabelText, findByText, queryByText } = render( + , + ) - fireEvent.focus(getByLabelText('help')) + fireEvent.click(getByLabelText('help')) - expect(getByText('some help')).toBeTruthy() + await findByText('some help') + expect(queryByText('some help')).toBeTruthy() }) - it('closes', () => { - const { getByLabelText, queryByText } = render() + it('closes inside', async () => { + const { getByLabelText, findByText, queryByText } = render() + fireEvent.click(getByLabelText('help')) + await findByText('def') + expect(queryByText('def')).not.toBeNull() + + fireEvent.click(getByLabelText('help')) + + await waitForElementToBeRemoved(() => queryByText('def')) + expect(queryByText('def')).toBeNull() + }) + + it('closes outside', async () => { + const { getByLabelText, findByText, getByText, queryByText } = render( +
+ + click outside +
, + ) + fireEvent.click(getByLabelText('help')) + await findByText('def') + expect(queryByText('def')).not.toBeNull() - fireEvent.focus(getByLabelText('help')) - fireEvent.blur(getByLabelText('help')) + fireEvent.click(getByText('click outside')) + await waitForElementToBeRemoved(() => queryByText('def')) expect(queryByText('def')).toBeNull() }) }) diff --git a/src/components/Form/FormHelpButton.tsx b/src/components/Form/FormHelpButton.tsx index f2ced9e08..a5cd7b2f7 100644 --- a/src/components/Form/FormHelpButton.tsx +++ b/src/components/Form/FormHelpButton.tsx @@ -1,6 +1,6 @@ -import React, { useState } from 'react' +import React from 'react' -import { Button, Card, CardBody, CardHeader, Popover } from 'reactstrap' +import { Button, Card, CardBody, CardHeader, UncontrolledPopover } from 'reactstrap' import { FaQuestion } from 'react-icons/fa' @@ -17,14 +17,13 @@ export interface FormHelpButtonProps { } export default function FormHelpButton({ identifier, label, help }: FormHelpButtonProps) { - const [popoverOpen, setPopoverOpen] = useState(false) - return ( <> - + {label} {help} - + ) }