@@ -66,6 +66,11 @@ describe('<RolesGridPage />', () => {
6666 kibana : [ { base : [ ] , spaces : [ ] , feature : { } } ] ,
6767 transient_metadata : { enabled : false } ,
6868 } ,
69+ {
70+ name : 'special%chars%role' ,
71+ elasticsearch : { cluster : [ ] , indices : [ ] , run_as : [ ] } ,
72+ kibana : [ { base : [ ] , spaces : [ ] , feature : { } } ] ,
73+ } ,
6974 ] ) ;
7075 } ) ;
7176
@@ -121,7 +126,7 @@ describe('<RolesGridPage />', () => {
121126 expect ( wrapper . find ( PermissionDenied ) ) . toMatchSnapshot ( ) ;
122127 } ) ;
123128
124- it ( 'renders role actions as appropriate' , async ( ) => {
129+ it ( 'renders role actions as appropriate, escaping when necessary ' , async ( ) => {
125130 const wrapper = mountWithIntl (
126131 < RolesGridPage
127132 rolesAPIClient = { apiClientMock }
@@ -137,16 +142,26 @@ describe('<RolesGridPage />', () => {
137142
138143 expect ( wrapper . find ( PermissionDenied ) ) . toHaveLength ( 0 ) ;
139144
140- const editButton = wrapper . find ( 'EuiButtonIcon[data-test-subj="edit-role-action-test-role-1"]' ) ;
145+ let editButton = wrapper . find ( 'EuiButtonIcon[data-test-subj="edit-role-action-test-role-1"]' ) ;
141146 expect ( editButton ) . toHaveLength ( 1 ) ;
142147 expect ( editButton . prop ( 'href' ) ) . toBe ( '/edit/test-role-1' ) ;
143148
144- const cloneButton = wrapper . find (
145- 'EuiButtonIcon[data-test-subj="clone -role-action-test- role-1 "]'
149+ editButton = wrapper . find (
150+ 'EuiButtonIcon[data-test-subj="edit -role-action-special%chars% role"]'
146151 ) ;
152+ expect ( editButton ) . toHaveLength ( 1 ) ;
153+ expect ( editButton . prop ( 'href' ) ) . toBe ( '/edit/special%25chars%25role' ) ;
154+
155+ let cloneButton = wrapper . find ( 'EuiButtonIcon[data-test-subj="clone-role-action-test-role-1"]' ) ;
147156 expect ( cloneButton ) . toHaveLength ( 1 ) ;
148157 expect ( cloneButton . prop ( 'href' ) ) . toBe ( '/clone/test-role-1' ) ;
149158
159+ cloneButton = wrapper . find (
160+ 'EuiButtonIcon[data-test-subj="clone-role-action-special%chars%role"]'
161+ ) ;
162+ expect ( cloneButton ) . toHaveLength ( 1 ) ;
163+ expect ( cloneButton . prop ( 'href' ) ) . toBe ( '/clone/special%25chars%25role' ) ;
164+
150165 expect (
151166 wrapper . find ( 'EuiButtonIcon[data-test-subj="edit-role-action-disabled-role"]' )
152167 ) . toHaveLength ( 1 ) ;
@@ -182,6 +197,11 @@ describe('<RolesGridPage />', () => {
182197 kibana : [ { base : [ ] , spaces : [ ] , feature : { } } ] ,
183198 metadata : { _reserved : true } ,
184199 } ,
200+ {
201+ name : 'special%chars%role' ,
202+ elasticsearch : { cluster : [ ] , indices : [ ] , run_as : [ ] } ,
203+ kibana : [ { base : [ ] , spaces : [ ] , feature : { } } ] ,
204+ } ,
185205 {
186206 name : 'test-role-1' ,
187207 elasticsearch : { cluster : [ ] , indices : [ ] , run_as : [ ] } ,
@@ -198,6 +218,11 @@ describe('<RolesGridPage />', () => {
198218 kibana : [ { base : [ ] , spaces : [ ] , feature : { } } ] ,
199219 transient_metadata : { enabled : false } ,
200220 } ,
221+ {
222+ name : 'special%chars%role' ,
223+ elasticsearch : { cluster : [ ] , indices : [ ] , run_as : [ ] } ,
224+ kibana : [ { base : [ ] , spaces : [ ] , feature : { } } ] ,
225+ } ,
201226 {
202227 name : 'test-role-1' ,
203228 elasticsearch : { cluster : [ ] , indices : [ ] , run_as : [ ] } ,
0 commit comments