File tree 6 files changed +98
-3
lines changed
6 files changed +98
-3
lines changed Original file line number Diff line number Diff line change @@ -23,10 +23,11 @@ function GluuTypeAhead({
23
23
formik,
24
24
required,
25
25
doc_category,
26
+ doc_entry,
26
27
} ) {
27
28
const { t } = useTranslation ( )
28
29
return (
29
- < GluuTooltip doc_category = { doc_category } doc_entry = { name } >
30
+ < GluuTooltip doc_category = { doc_category } doc_entry = { doc_entry || name } >
30
31
< FormGroup row >
31
32
{ ! ! required ? (
32
33
< GluuLabel label = { label } size = { 4 } required />
Original file line number Diff line number Diff line change @@ -52,7 +52,11 @@ function GluuTypeAheadWithAdd({
52
52
53
53
< Row >
54
54
< Col sm = { 10 } >
55
- < Input placeholder = { placeholder } id = { inputId } aria-label = "new_entry" />
55
+ < Input
56
+ placeholder = { placeholder }
57
+ id = { inputId }
58
+ aria-label = "new_entry"
59
+ />
56
60
</ Col >
57
61
< Button color = "primary" type = "button" onClick = { addItem } >
58
62
< i className = "fa fa-plus-circle mr-2" > </ i >
Original file line number Diff line number Diff line change
1
+ import React from 'react'
2
+ import { render , screen } from '@testing-library/react'
3
+ import GluuToogleRow from '../GluuToogleRow'
4
+ import i18n from '../../../../i18n'
5
+ import { I18nextProvider } from 'react-i18next'
6
+ const LABEL = 'fields.application_type'
7
+ const NAME = 'applicationType'
8
+ const VALUE = false
9
+ function formikf ( ) { }
10
+
11
+ it ( 'Test gluutooltip' , ( ) => {
12
+ render (
13
+ < I18nextProvider i18n = { i18n } >
14
+ < GluuToogleRow
15
+ label = { LABEL }
16
+ name = { NAME }
17
+ value = { VALUE }
18
+ doc_category = "openid_client"
19
+ formik = { formikf }
20
+ />
21
+ </ I18nextProvider > ,
22
+ )
23
+ screen . getByText ( 'The OpenID connect Client application type.' )
24
+ expect (
25
+ screen . getByText ( 'The OpenID connect Client application type.' ) ,
26
+ ) . toHaveAttribute ( 'data-id' , 'tooltip' )
27
+ } )
Original file line number Diff line number Diff line change
1
+ import React from 'react'
2
+ import { render , screen } from '@testing-library/react'
3
+ import GluuTypeAhead from '../GluuTypeAhead'
4
+ import i18n from '../../../../i18n'
5
+ import { I18nextProvider } from 'react-i18next'
6
+
7
+ const LABEL = 'fields.application_type'
8
+ let NAME = 'applicationType'
9
+ const VALUE = [ 'Monday' ]
10
+ const OPTIONS = [ 'Monday' , 'Tuesday' ]
11
+
12
+ it ( 'Test gluu typeahead' , ( ) => {
13
+ render (
14
+ < I18nextProvider i18n = { i18n } >
15
+ < GluuTypeAhead
16
+ doc_category = "openid_client"
17
+ name = { NAME }
18
+ value = { VALUE }
19
+ label = { LABEL }
20
+ options = { OPTIONS }
21
+ />
22
+ </ I18nextProvider > ,
23
+ )
24
+ screen . getByText ( 'Application Type:' )
25
+ screen . getByText ( VALUE [ 0 ] )
26
+ screen . getByText ( 'The OpenID connect Client application type.' )
27
+ expect (
28
+ screen . getByText ( 'The OpenID connect Client application type.' ) ,
29
+ ) . toHaveAttribute ( 'data-id' , 'tooltip' )
30
+ } )
Original file line number Diff line number Diff line change
1
+ import React from 'react'
2
+ import { render , screen } from '@testing-library/react'
3
+ import GluuTypeAheadForDn from '../GluuTypeAheadForDn'
4
+ import i18n from '../../../../i18n'
5
+ import { I18nextProvider } from 'react-i18next'
6
+
7
+ const LABEL = 'fields.application_type'
8
+ const NAME = 'applicationType'
9
+ const VALUE = [ { name : 'Monday' , dn : '111111112222' } ]
10
+ const OPTIONS = [
11
+ { name : 'Monday' , dn : '111111112222' } ,
12
+ { name : 'Tuesday' , dn : '1001112222' } ,
13
+ ]
14
+
15
+ it ( 'Test gluu typeahead for dn' , ( ) => {
16
+ render (
17
+ < I18nextProvider i18n = { i18n } >
18
+ < GluuTypeAheadForDn
19
+ doc_category = "openid_client"
20
+ name = { NAME }
21
+ value = { VALUE }
22
+ label = { LABEL }
23
+ options = { OPTIONS }
24
+ />
25
+ </ I18nextProvider > ,
26
+ )
27
+ screen . getByText ( 'Application Type:' )
28
+ screen . getByText ( VALUE [ 0 ] . name )
29
+ screen . getByText ( 'The OpenID connect Client application type.' )
30
+ expect (
31
+ screen . getByText ( 'The OpenID connect Client application type.' ) ,
32
+ ) . toHaveAttribute ( 'data-id' , 'tooltip' )
33
+ } )
Original file line number Diff line number Diff line change @@ -6,7 +6,7 @@ import { I18nextProvider } from 'react-i18next'
6
6
7
7
it ( 'Test GluuTypeAheadWithAdd component' , ( ) => {
8
8
const LABEL = 'fields.application_type'
9
- let NAME = 'application_type'
9
+ const NAME = 'application_type'
10
10
const VALUE = [ 'Monday' ]
11
11
const OPTIONS = [ 'Monday' , 'Tuesday' ]
12
12
render (
You can’t perform that action at this time.
0 commit comments