This repository was archived by the owner on Sep 16, 2021. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +48
-0
lines changed Expand file tree Collapse file tree 1 file changed +48
-0
lines changed Original file line number Diff line number Diff line change @@ -208,4 +208,52 @@ describe('The Fancytree adapter', function() {
208
208
expect ( tree . getNodeByKey ( 'cms' ) . isActive ( ) ) . toBe ( true ) ;
209
209
} ) ;
210
210
211
+ it ( 'prefixes the root node to path output when configured' , function ( ) {
212
+ jasmine . Ajax . stubRequest ( / ^ \/ r o o t _ a p i / ) . andReturn ( {
213
+ responseText : JSON . stringify ( {
214
+ node_name : 'cms' ,
215
+ label : 'cms' ,
216
+ path : '\/cms' ,
217
+ children : {
218
+ content : {
219
+ node_name : 'content' ,
220
+ label : 'Content' ,
221
+ path : '/cms/content' ,
222
+ children : {
223
+ some_article : [ ] ,
224
+ other_article : [ ]
225
+ }
226
+ } ,
227
+ routes : {
228
+ node_name : 'routes' ,
229
+ label : 'Routes' ,
230
+ path : '/cms/routes' ,
231
+ children : { }
232
+ }
233
+ }
234
+ } )
235
+ } ) ;
236
+
237
+ var adapter = new FancytreeAdapter ( {
238
+ request : {
239
+ load : function ( path ) {
240
+ return {
241
+ url : '/root_api'
242
+ } ;
243
+ } ,
244
+ } ,
245
+ root_node : '/cms'
246
+ } ) ;
247
+
248
+ adapter . bindToElement ( this . $tree ) ;
249
+
250
+ var $input = $ ( '<input type=text value="/cms/routes"/>' ) ;
251
+ adapter . bindToInput ( $input ) ;
252
+
253
+ var tree = this . $tree . fancytree ( 'getTree' ) ;
254
+
255
+ tree . getNodeByKey ( 'content' ) . setActive ( ) ;
256
+ expect ( $input ) . toHaveValue ( '/cms/content' ) ;
257
+ } ) ;
258
+
211
259
} ) ;
You can’t perform that action at this time.
0 commit comments