1- /* global stripFunctions */
2-
31import $ from 'jquery' ;
4- import { CustomStore } from 'common/data/custom_store' ;
5- import ArrayStore from 'common/data/array_store' ;
6- import { isFunction } from 'core/utils/type' ;
7-
82import 'ui/tree_view' ;
93
10- const { testStart } = QUnit ;
11-
12- testStart ( function ( ) {
4+ QUnit . testStart ( function ( ) {
135 const markup = '<div id="treeView"></div>' ;
146
157 $ ( '#qunit-fixture' ) . html ( markup ) ;
168} ) ;
179
18- window . internals = {
19- NODE_CONTAINER_CLASS : 'dx-treeview-node-container' ,
20- OPENED_NODE_CONTAINER_CLASS : 'dx-treeview-node-container-opened' ,
21- NODE_CLASS : 'dx-treeview-node' ,
22- ITEM_CLASS : 'dx-treeview-item' ,
23- TOGGLE_ITEM_VISIBILITY_CLASS : 'dx-treeview-toggle-item-visibility' ,
24- TOGGLE_ITEM_VISIBILITY_OPENED_CLASS : 'dx-treeview-toggle-item-visibility-opened' ,
25- } ;
26-
27- window . DATA = ( function ( ) {
28- return [
29- // 0
30- [
31- { key : 1 , text : 'Item 1' } ,
32- { key : 2 , text : 'Item 2' } ,
33- { key : 3 , text : 'Item 3' }
34- ] ,
35- // 1
36- [
37- {
38- key : 1 , text : 'Item 1' , items : [
39- { key : 12 , text : 'Nested item 1' } ,
40- {
41- key : 13 , text : 'Nested item 2' , items : [
42- { key : 131 , text : 'Last item' }
43- ]
44- }
45- ]
46- } ,
47- { key : 2 , text : 'Item 2' }
48- ] ,
49- // 2
50- [
51- {
52- key : 1 , text : 'Item 1' , items : [
53- { key : 12 , text : 'Nested item 1' } ,
54- { key : 13 , text : 'Nested item 2' }
55- ]
56- } ,
57- { key : 2 , text : 'Item 2' }
58- ] ,
59- // 3
60- [
61- {
62- itemId : 1 ,
63- itemName : 'Item 1' ,
64- children : [
65- { itemId : 11 , itemName : 'Nested Item 1' }
66- ]
67- } ,
68- { itemId : 2 , itemName : 'Item 2' }
69- ] ,
70- // 4
71- [
72- { 'Id' : 1 , 'ParentId' : 0 , 'Name' : 'Animals' } ,
73- { 'Id' : 2 , 'ParentId' : 1 , 'Name' : 'Cat' } ,
74- { 'Id' : 3 , 'ParentId' : 1 , 'Name' : 'Dog' } ,
75- { 'Id' : 5 , 'ParentId' : 2 , 'Name' : 'Abyssinian' } ,
76- { 'Id' : 8 , 'ParentId' : 3 , 'Name' : 'Affenpinscher' } ,
77- { 'Id' : 9 , 'ParentId' : 3 , 'Name' : 'Afghan Hound' } ,
78- { 'Id' : 12 , 'ParentId' : 0 , 'Name' : 'Birds' } ,
79- { 'Id' : 13 , 'ParentId' : 12 , 'Name' : 'Akekee' }
80- ] ,
81- // 5
82- [
83- {
84- // id: "!/#$%&'()*+,./:;<=>?@[\]^`{|}~",
85- id : 1 ,
86- text : 'Item 1' ,
87- items : [
88- { id : 11 , text : 'Nested Item 1' } ,
89- {
90- id : 12 , text : 'Nested Item 2' , items : [
91- { id : 121 , text : 'Third level item 1' } ,
92- { id : 122 , text : 'Third level item 2' }
93- ]
94- }
95- ]
96- } ,
97- { id : 2 , text : 'Item 2' }
98- ] ,
99- [
100- {
101- id : 1 ,
102- text : 'Item 1' ,
103- items : [
104- {
105- id : 12 , text : 'Nested Item 2' , items : [
106- { id : 121 , text : 'Third level item 1' } ,
107- { id : 122 , text : 'Third level item 2' }
108- ]
109- }
110- ]
111- } ,
112- {
113- id : 2 ,
114- text : 'Item 2' ,
115- items : [
116- {
117- id : 22 , text : 'Nested Item 2' , items : [
118- { id : 221 , text : 'Third level item 1' } ,
119- { id : 222 , text : 'Third level item 2' }
120- ]
121- }
122- ]
123- }
124- ]
125- ] ;
126- } ) ( ) ;
127-
128- window . data2 = [
129- { id : 1 , parentId : 0 , text : 'Animals' } ,
130- { id : 2 , parentId : 1 , text : 'Cat' } ,
131- { id : 3 , parentId : 1 , text : 'Dog' } ,
132- { id : 4 , parentId : 1 , text : 'Cow' } ,
133- { id : 5 , parentId : 2 , text : 'Abyssinian' } ,
134- { id : 6 , parentId : 2 , text : 'Aegean cat' } ,
135- { id : 7 , parentId : 2 , text : 'Australian Mist' } ,
136- { id : 8 , parentId : 3 , text : 'Affenpinscher' } ,
137- { id : 9 , parentId : 3 , text : 'Afghan Hound' } ,
138- { id : 10 , parentId : 3 , text : 'Airedale Terrier' } ,
139- { id : 11 , parentId : 3 , text : 'Akita Inu' } ,
140- { id : 12 , parentId : 0 , text : 'Birds' } ,
141- { id : 13 , parentId : 12 , text : 'Akekee' } ,
142- { id : 14 , parentId : 12 , text : 'Arizona Woodpecker' } ,
143- { id : 15 , parentId : 12 , text : 'Black-chinned Sparrow' } ,
144- { id : 16 , parentId : 0 , text : 'Others' }
145- ] ;
146-
147- window . dataID = [
148- { id : 1 , 'elternId' : 0 , text : 'Animals' } ,
149- { id : 2 , 'elternId' : 1 , text : 'Cat' } ,
150- { id : 3 , 'elternId' : 2 , text : 'Abyssinian' } ,
151- { id : 4 , 'elternId' : 0 , text : 'Birds' } ,
152- { id : 5 , 'elternId' : 4 , text : 'Akekee' }
153- ] ;
154-
155- window . initTree = function ( options ) {
156- return $ ( '#treeView' ) . dxTreeView ( options ) ;
157- } ;
158-
159- window . stripFunctions = function ( obj ) {
160- const result = $ . extend ( true , { } , obj ) ;
161- $ . each ( result , function ( field , value ) {
162- if ( isFunction ( value ) ) {
163- delete result [ field ] ;
164- }
165-
166- if ( field === 'parent' && result . parent ) {
167- result . parent = stripFunctions ( result . parent ) ;
168- }
169-
170- } ) ;
171-
172- return result ;
173- } ;
174-
175- window . makeSlowDataSource = function ( data ) {
176- return {
177- store : new CustomStore ( {
178- load : function ( loadOptions ) {
179- return $ . Deferred ( function ( d ) {
180- setTimeout ( function ( ) {
181- new ArrayStore ( data ) . load ( loadOptions ) . done ( function ( ) {
182- d . resolve . apply ( d , arguments ) ;
183- } ) ;
184- } , 300 ) ;
185- } ) . promise ( ) ;
186- }
187- } )
188- } ;
189- } ;
190-
191- import 'generic_light.css!' ;
192-
193- import './treeViewParts/accessibility.js' ;
19410import './treeViewParts/animation.js' ;
19511import './treeViewParts/events.js' ;
19612import './treeViewParts/expresions.js' ;
@@ -201,11 +17,8 @@ import './treeViewParts/lazyRendering.js';
20117import './treeViewParts/optionChanged.js' ;
20218import './treeViewParts/regression.js' ;
20319import './treeViewParts/rendering.js' ;
204- import './treeViewParts/selection.js' ;
205- import './treeViewParts/searching.js' ;
20620import './treeViewParts/selectAllMode.js' ;
20721import './treeViewParts/selectAllWithSelectNodesRecursiveFalse.js' ;
20822import './treeViewParts/selectNodesRecursiveTrue.js' ;
20923import './treeViewParts/treeview.size.tests.js' ;
21024import './treeViewParts/usageWithoutKeys.js' ;
211- import './treeViewParts/virtualMode.js' ;
0 commit comments