diff --git a/src/authorizations/components/redesigned/CustomApiTokenOverlay.test.tsx b/src/authorizations/components/redesigned/CustomApiTokenOverlay.test.tsx new file mode 100644 index 0000000000..0ab0fd29f6 --- /dev/null +++ b/src/authorizations/components/redesigned/CustomApiTokenOverlay.test.tsx @@ -0,0 +1,29 @@ +import React from 'react' +import {render, fireEvent} from '@testing-library/react' +import {CustomApiTokenOverlay} from './CustomApiTokenOverlay' + +describe('CustomApitokenDescription', () => { + const props = { + onClose: () => true, + } + + it('displays description box', () => { + const {getByText} = render() + + expect(getByText('Description')).toBeDefined() + expect(getByText('Generate a Personal Api Token')).toBeDefined() + }) + + describe('when user inputs something into the description box', () => { + it("should update the component's state", () => { + const {getByTestId} = render() + + fireEvent.change(getByTestId('custom-api-token-input'), { + target: {value: 'chocolate'}, + }) + + const element = getByTestId('custom-api-token-input') + expect(element['value']).toEqual('chocolate') + }) + }) +}) diff --git a/src/authorizations/components/redesigned/CustomApiTokenOverlay.tsx b/src/authorizations/components/redesigned/CustomApiTokenOverlay.tsx index 7688136341..2d03972e77 100644 --- a/src/authorizations/components/redesigned/CustomApiTokenOverlay.tsx +++ b/src/authorizations/components/redesigned/CustomApiTokenOverlay.tsx @@ -1,7 +1,15 @@ -import React, {FC} from 'react' +import React, {FC, useState} from 'react' // Components -import {Overlay} from '@influxdata/clockface' +import { + Overlay, + Form, + Input, + FlexBox, + AlignItems, + FlexDirection, + ComponentSize, +} from '@influxdata/clockface' interface OwnProps { onClose: () => void @@ -11,12 +19,36 @@ export const CustomApiTokenOverlay: FC = props => { const handleDismiss = () => { props.onClose() } + const [description, setDescription] = useState('') + + const handleInputChange = event => { + setDescription(event.target.value) + } + return ( + +
+ + + + + +
+
) }