File tree Expand file tree Collapse file tree 2 files changed +46
-0
lines changed
zeppelin-web/src/app/tabledata Expand file tree Collapse file tree 2 files changed +46
-0
lines changed Original file line number Diff line number Diff line change @@ -89,6 +89,7 @@ export default class PivotTransformation extends Transformation {
8989 for ( let j = i + 1 ; j < list . length ; j ++ ) {
9090 if ( angular . equals ( list [ i ] , list [ j ] ) ) {
9191 list . splice ( j , 1 )
92+ j --
9293 }
9394 }
9495 }
Original file line number Diff line number Diff line change 1313 */
1414
1515import TableData from './tabledata.js'
16+ import PivotTransformation from './pivot.js'
1617
1718describe ( 'TableData build' , function ( ) {
1819 let td
@@ -39,3 +40,47 @@ describe('TableData build', function () {
3940 expect ( td . comment ) . toBe ( 'hello' )
4041 } )
4142} )
43+
44+ describe ( 'PivotTransformation build' , function ( ) {
45+ let pt
46+
47+ beforeEach ( function ( ) {
48+ console . log ( PivotTransformation )
49+ pt = new PivotTransformation ( )
50+ } )
51+
52+ it ( 'check the result of keys, groups and values unique' , function ( ) {
53+ // set inited mock data
54+ let config = {
55+ common : {
56+ pivot : {
57+ keys : [ { index : 4 , name : '4' } ,
58+ { index : 3 , name : '3' } ,
59+ { index : 4 , name : '4' } ,
60+ { index : 3 , name : '3' } ,
61+ { index : 3 , name : '3' } ,
62+ { index : 3 , name : '3' } ,
63+ { index : 3 , name : '3' } ,
64+ { index : 5 , name : '5' } ] ,
65+ groups : [ ] ,
66+ values : [ ]
67+ }
68+ }
69+ }
70+ pt . tableDataColumns = [
71+ { index : 1 , name : '1' } ,
72+ { index : 2 , name : '2' } ,
73+ { index : 3 , name : '3' } ,
74+ { index : 4 , name : '4' } ,
75+ { index : 5 , name : '5' } ]
76+
77+ pt . setConfig ( config )
78+
79+ pt . removeUnknown ( )
80+
81+ expect ( config . common . pivot . keys . length ) . toBe ( 3 )
82+ expect ( config . common . pivot . keys [ 0 ] . index ) . toBe ( 4 )
83+ expect ( config . common . pivot . keys [ 1 ] . index ) . toBe ( 3 )
84+ expect ( config . common . pivot . keys [ 2 ] . index ) . toBe ( 5 )
85+ } )
86+ } )
You can’t perform that action at this time.
0 commit comments