-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(admin-ui): write test for all Gluu custom base UI components #290
- Loading branch information
Showing
6 changed files
with
98 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
import React from 'react' | ||
import { render, screen } from '@testing-library/react' | ||
import GluuToogleRow from '../GluuToogleRow' | ||
import i18n from '../../../../i18n' | ||
import { I18nextProvider } from 'react-i18next' | ||
const LABEL = 'fields.application_type' | ||
const NAME = 'applicationType' | ||
const VALUE = false | ||
function formikf() {} | ||
|
||
it('Test gluutooltip', () => { | ||
render( | ||
<I18nextProvider i18n={i18n}> | ||
<GluuToogleRow | ||
label={LABEL} | ||
name={NAME} | ||
value={VALUE} | ||
doc_category="openid_client" | ||
formik={formikf} | ||
/> | ||
</I18nextProvider>, | ||
) | ||
screen.getByText('The OpenID connect Client application type.') | ||
expect( | ||
screen.getByText('The OpenID connect Client application type.'), | ||
).toHaveAttribute('data-id', 'tooltip') | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
import React from 'react' | ||
import { render, screen } from '@testing-library/react' | ||
import GluuTypeAhead from '../GluuTypeAhead' | ||
import i18n from '../../../../i18n' | ||
import { I18nextProvider } from 'react-i18next' | ||
|
||
const LABEL = 'fields.application_type' | ||
let NAME = 'applicationType' | ||
const VALUE = ['Monday'] | ||
const OPTIONS = ['Monday', 'Tuesday'] | ||
|
||
it('Test gluu typeahead', () => { | ||
render( | ||
<I18nextProvider i18n={i18n}> | ||
<GluuTypeAhead | ||
doc_category="openid_client" | ||
name={NAME} | ||
value={VALUE} | ||
label={LABEL} | ||
options={OPTIONS} | ||
/> | ||
</I18nextProvider>, | ||
) | ||
screen.getByText('Application Type:') | ||
screen.getByText(VALUE[0]) | ||
screen.getByText('The OpenID connect Client application type.') | ||
expect( | ||
screen.getByText('The OpenID connect Client application type.'), | ||
).toHaveAttribute('data-id', 'tooltip') | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
import React from 'react' | ||
import { render, screen } from '@testing-library/react' | ||
import GluuTypeAheadForDn from '../GluuTypeAheadForDn' | ||
import i18n from '../../../../i18n' | ||
import { I18nextProvider } from 'react-i18next' | ||
|
||
const LABEL = 'fields.application_type' | ||
const NAME = 'applicationType' | ||
const VALUE = [{ name: 'Monday', dn: '111111112222' }] | ||
const OPTIONS = [ | ||
{ name: 'Monday', dn: '111111112222' }, | ||
{ name: 'Tuesday', dn: '1001112222' }, | ||
] | ||
|
||
it('Test gluu typeahead for dn', () => { | ||
render( | ||
<I18nextProvider i18n={i18n}> | ||
<GluuTypeAheadForDn | ||
doc_category="openid_client" | ||
name={NAME} | ||
value={VALUE} | ||
label={LABEL} | ||
options={OPTIONS} | ||
/> | ||
</I18nextProvider>, | ||
) | ||
screen.getByText('Application Type:') | ||
screen.getByText(VALUE[0].name) | ||
screen.getByText('The OpenID connect Client application type.') | ||
expect( | ||
screen.getByText('The OpenID connect Client application type.'), | ||
).toHaveAttribute('data-id', 'tooltip') | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters