Skip to content
This repository was archived by the owner on Sep 16, 2021. It is now read-only.

Commit b243c8b

Browse files
committed
Added test
1 parent b4478fb commit b243c8b

File tree

1 file changed

+48
-0
lines changed

1 file changed

+48
-0
lines changed

Tests/js/adapter/fancytreeSpec.js

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -208,4 +208,52 @@ describe('The Fancytree adapter', function() {
208208
expect(tree.getNodeByKey('cms').isActive()).toBe(true);
209209
});
210210

211+
it('prefixes the root node to path output when configured', function () {
212+
jasmine.Ajax.stubRequest(/^\/root_api/).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+
211259
});

0 commit comments

Comments
 (0)