@@ -43,6 +43,67 @@ describe('Basic IgxPivotGrid #pivotGrid', () => {
4343 expect ( cells . first . nativeElement . classList ) . toContain ( 'test' ) ;
4444 expect ( cells . last . nativeElement . classList ) . not . toContain ( 'test' ) ;
4545 } ) ;
46+
47+ it ( 'should remove row dimensions from chip' , ( ) => {
48+ const pivotGrid = fixture . componentInstance . pivotGrid ;
49+ pivotGrid . pivotConfiguration . rows . push ( {
50+ memberName : 'SellerName' ,
51+ enabled : true
52+ } ) ;
53+ pivotGrid . pipeTrigger ++ ;
54+ fixture . detectChanges ( ) ;
55+ expect ( pivotGrid . rowDimensions . length ) . toBe ( 2 ) ;
56+ expect ( pivotGrid . rowList . first . data [ 'SellerName' ] ) . not . toBeUndefined ( ) ;
57+
58+ const headerRow = fixture . nativeElement . querySelector ( 'igx-pivot-header-row' ) ;
59+ const rowChip = headerRow . querySelector ( 'igx-chip[id="SellerName"]' ) ;
60+ const removeIcon = rowChip . querySelectorAll ( 'igx-icon' ) [ 3 ] ;
61+ removeIcon . click ( ) ;
62+ fixture . detectChanges ( ) ;
63+ expect ( pivotGrid . pivotConfiguration . rows [ 1 ] . enabled ) . toBeFalse ( ) ;
64+ expect ( pivotGrid . rowDimensions . length ) . toBe ( 1 ) ;
65+ expect ( pivotGrid . rowList . first . data [ 'SellerName' ] ) . toBeUndefined ( ) ;
66+
67+ } ) ;
68+
69+ it ( 'should remove column dimensions from chip' , ( ) => {
70+ const pivotGrid = fixture . componentInstance . pivotGrid ;
71+ expect ( pivotGrid . columns . length ) . toBe ( 9 ) ;
72+ pivotGrid . pivotConfiguration . columns . push ( {
73+ memberName : 'SellerName' ,
74+ enabled : true
75+ } ) ;
76+ pivotGrid . pipeTrigger ++ ;
77+ pivotGrid . setupColumns ( ) ;
78+ fixture . detectChanges ( ) ;
79+ expect ( pivotGrid . columnDimensions . length ) . toBe ( 2 ) ;
80+ expect ( pivotGrid . columns . length ) . not . toBe ( 9 ) ;
81+
82+ const headerRow = fixture . nativeElement . querySelector ( 'igx-pivot-header-row' ) ;
83+ const rowChip = headerRow . querySelector ( 'igx-chip[id="SellerName"]' ) ;
84+ const removeIcon = rowChip . querySelectorAll ( 'igx-icon' ) [ 3 ] ;
85+ removeIcon . click ( ) ;
86+ fixture . detectChanges ( ) ;
87+ expect ( pivotGrid . pivotConfiguration . columns [ 1 ] . enabled ) . toBeFalse ( ) ;
88+ expect ( pivotGrid . columnDimensions . length ) . toBe ( 1 ) ;
89+ expect ( pivotGrid . columns . length ) . toBe ( 9 ) ;
90+ } ) ;
91+
92+ it ( 'should remove value from chip' , ( ) => {
93+ const pivotGrid = fixture . componentInstance . pivotGrid ;
94+ expect ( pivotGrid . columns . length ) . toBe ( 9 ) ;
95+ expect ( pivotGrid . values . length ) . toBe ( 2 ) ;
96+
97+ const headerRow = fixture . nativeElement . querySelector ( 'igx-pivot-header-row' ) ;
98+ const rowChip = headerRow . querySelector ( 'igx-chip[id="UnitsSold"]' ) ;
99+ const removeIcon = rowChip . querySelectorAll ( 'igx-icon' ) [ 3 ] ;
100+ removeIcon . click ( ) ;
101+ fixture . detectChanges ( ) ;
102+ expect ( pivotGrid . pivotConfiguration . values [ 0 ] . enabled ) . toBeFalse ( ) ;
103+ expect ( pivotGrid . values . length ) . toBe ( 1 ) ;
104+ expect ( pivotGrid . columns . length ) . not . toBe ( 9 ) ;
105+ } ) ;
106+
46107 describe ( 'IgxPivotGrid Features #pivotGrid' , ( ) => {
47108 it ( 'should show excel style filtering via dimension chip.' , ( ) => {
48109 const excelMenu = GridFunctions . getExcelStyleFilteringComponent ( fixture , 'igx-pivot-grid' ) ;
0 commit comments