@@ -1226,8 +1226,8 @@ describe('IgxPivotGrid #pivotGrid', () => {
12261226 expected = [ 'Uruguay' , 'USA' , 'Bulgaria' ] ;
12271227 expect ( colHeaders ) . toEqual ( expected ) ;
12281228 const expectedExpressions : ISortingExpression [ ] = [
1229- { dir : SortingDirection . None , fieldName : 'All' , strategy : DefaultPivotSortingStrategy . instance ( ) } ,
1230- { dir : SortingDirection . None , fieldName : 'ProductCategory' , strategy : DefaultPivotSortingStrategy . instance ( ) } ,
1229+ { dir : SortingDirection . None , fieldName : 'All' , strategy : DefaultPivotSortingStrategy . instance ( ) } ,
1230+ { dir : SortingDirection . None , fieldName : 'ProductCategory' , strategy : DefaultPivotSortingStrategy . instance ( ) } ,
12311231 { dir : SortingDirection . Desc , fieldName : 'Country' , strategy : DefaultPivotSortingStrategy . instance ( ) }
12321232 ] ;
12331233 expect ( pivotGrid . dimensionsSortingExpressionsChange . emit ) . toHaveBeenCalledWith ( expectedExpressions ) ;
@@ -1265,8 +1265,8 @@ describe('IgxPivotGrid #pivotGrid', () => {
12651265 expected = [ 'Uruguay' , 'USA' , 'Bulgaria' ] ;
12661266 expect ( colHeaders ) . toEqual ( expected ) ;
12671267 const expectedExpressions : ISortingExpression [ ] = [
1268- { dir : SortingDirection . None , fieldName : 'All' , strategy : DefaultPivotSortingStrategy . instance ( ) } ,
1269- { dir : SortingDirection . None , fieldName : 'ProductCategory' , strategy : DefaultPivotSortingStrategy . instance ( ) } ,
1268+ { dir : SortingDirection . None , fieldName : 'All' , strategy : DefaultPivotSortingStrategy . instance ( ) } ,
1269+ { dir : SortingDirection . None , fieldName : 'ProductCategory' , strategy : DefaultPivotSortingStrategy . instance ( ) } ,
12701270 { dir : SortingDirection . Desc , fieldName : 'Country' , strategy : DefaultPivotSortingStrategy . instance ( ) }
12711271 ] ;
12721272 expect ( pivotGrid . dimensionsSortingExpressionsChange . emit ) . toHaveBeenCalledWith ( expectedExpressions ) ;
@@ -2012,7 +2012,31 @@ describe('IgxPivotGrid #pivotGrid', () => {
20122012 expect ( pivotGrid . values . map ( x => x . member ) ) . toEqual ( [ 'UnitPrice' , 'UnitsSold' ] ) ;
20132013 expect ( pivotGrid . values . map ( x => x . enabled ) ) . toEqual ( [ true , true ] ) ;
20142014 } ) ;
2015+
2016+ it ( 'should allow creating IgxPivotDateDimension with no base dimension and setting it later.' , ( ) => {
2017+ const pivotGrid = fixture . componentInstance . pivotGrid ;
2018+ const dateDimension = new IgxPivotDateDimension ( ) ;
2019+ dateDimension . memberName = 'Date' ;
2020+ dateDimension . enabled = true ;
2021+ dateDimension . baseDimension = {
2022+ memberName : 'Date' ,
2023+ enabled : true ,
2024+ } ;
2025+ dateDimension . options = {
2026+ fullDate : true ,
2027+ months : false ,
2028+ total : false ,
2029+ years : true ,
2030+ quarters : false
2031+ }
2032+ pivotGrid . pivotConfiguration . rows = [ dateDimension ] ;
2033+ pivotGrid . pipeTrigger ++ ;
2034+ fixture . detectChanges ( ) ;
2035+
2036+ expect ( pivotGrid . rowList . length ) . toBe ( 10 ) ;
2037+ } ) ;
20152038 } ) ;
2039+
20162040 } ) ;
20172041
20182042 describe ( 'IgxPivotGrid complex hierarchy #pivotGrid' , ( ) => {
@@ -2655,12 +2679,12 @@ describe('IgxPivotGrid #pivotGrid', () => {
26552679
26562680 //check rows
26572681 const rows = pivotGrid . rowList . toArray ( ) ;
2658- expect ( rows . length ) . toBe ( 4 ) ;
2659- const expectedHeaders = [ 'Accessories' , 'Bikes' , 'Clothing' , 'Components' ] ;
2660- const rowHeaders = fixture . debugElement . queryAll (
2661- By . directive ( IgxPivotRowDimensionHeaderComponent ) ) ;
2662- const rowDimensionHeaders = rowHeaders . map ( x => x . componentInstance . column . header ) ;
2663- expect ( rowDimensionHeaders ) . toEqual ( expectedHeaders ) ;
2682+ expect ( rows . length ) . toBe ( 4 ) ;
2683+ const expectedHeaders = [ 'Accessories' , 'Bikes' , 'Clothing' , 'Components' ] ;
2684+ const rowHeaders = fixture . debugElement . queryAll (
2685+ By . directive ( IgxPivotRowDimensionHeaderComponent ) ) ;
2686+ const rowDimensionHeaders = rowHeaders . map ( x => x . componentInstance . column . header ) ;
2687+ expect ( rowDimensionHeaders ) . toEqual ( expectedHeaders ) ;
26642688
26652689 // check columns
26662690 const colHeaders = pivotGrid . columns . filter ( x => x . level === 0 ) . map ( x => x . header ) ;
@@ -2673,7 +2697,7 @@ describe('IgxPivotGrid #pivotGrid', () => {
26732697
26742698 } ) ;
26752699
2676- it ( 'should allow formatting based on additional record and column data' , ( ) => {
2700+ it ( 'should allow formatting based on additional record and column data' , ( ) => {
26772701 pivotGrid . pivotConfiguration = {
26782702 columns : [
26792703 {
@@ -2696,7 +2720,7 @@ describe('IgxPivotGrid #pivotGrid', () => {
26962720 } ,
26972721 enabled : true ,
26982722 formatter : ( value , rowData : IPivotGridRecord , columnData : IPivotGridColumn ) => {
2699- return rowData . dimensionValues . get ( 'ProductCategory' ) + '/' + columnData . dimensionValues . get ( 'City' ) + ':' + value ;
2723+ return rowData . dimensionValues . get ( 'ProductCategory' ) + '/' + columnData . dimensionValues . get ( 'City' ) + ':' + value ;
27002724 }
27012725 }
27022726 ]
@@ -2848,7 +2872,7 @@ describe('IgxPivotGrid #pivotGrid', () => {
28482872 const layoutContainer = fixture . debugElement . query (
28492873 By . directive ( IgxPivotRowDimensionMrlRowComponent ) ) ;
28502874 const contentRowHeaders = layoutContainer . queryAll (
2851- By . directive ( IgxPivotRowDimensionContentComponent ) ) ;
2875+ By . directive ( IgxPivotRowDimensionContentComponent ) ) ;
28522876
28532877 // check each dimension from hierarchy is on another column.
28542878 const rowDimensionCol1 = contentRowHeaders . filter ( y => y . componentInstance . layout . colStart === 1 ) ;
@@ -2871,19 +2895,19 @@ describe('IgxPivotGrid #pivotGrid', () => {
28712895
28722896 const rowDimensionCol4 = contentRowHeaders . filter ( y => y . componentInstance . layout . colStart === 4 ) ;
28732897 const rowDimensionHeadersCol4 = contentRowHeaders . filter ( y => y . componentInstance . layout . colStart === 4 )
2874- . map ( x => x . componentInstance . rowDimensionColumn . header ) ;
2898+ . map ( x => x . componentInstance . rowDimensionColumn . header ) ;
28752899 dimensions = rowDimensionCol4 . map ( x => x . componentInstance . dimension ) ;
28762900 expect ( dimensions . every ( x => x . memberName === "ProductCategory" ) ) . toBeTruthy ( ) ;
28772901 expect ( rowDimensionHeadersCol4 ) . toEqual ( [ "Bikes" , "Clothing" , "Accessories" ,
2878- "Clothing" , "Clothing" , "Components" , "Components" ] ) ;
2902+ "Clothing" , "Clothing" , "Components" , "Components" ] ) ;
28792903 } ) ;
28802904
28812905 it ( "should horizontally expand/collapse on a single dimension hierarchy." , ( ) => {
28822906 fixture . detectChanges ( ) ;
28832907 let layoutContainer = fixture . debugElement . query (
28842908 By . directive ( IgxPivotRowDimensionMrlRowComponent ) ) ;
28852909 let contentRowHeaders = layoutContainer . queryAll (
2886- By . directive ( IgxPivotRowDimensionContentComponent ) ) ;
2910+ By . directive ( IgxPivotRowDimensionContentComponent ) ) ;
28872911
28882912 // collapse All Products
28892913 let rowDimensionCol3 = contentRowHeaders . filter ( y => y . componentInstance . layout . colStart === 3 ) [ 0 ] ;
@@ -2898,24 +2922,24 @@ describe('IgxPivotGrid #pivotGrid', () => {
28982922 layoutContainer = fixture . debugElement . query (
28992923 By . directive ( IgxPivotRowDimensionMrlRowComponent ) ) ;
29002924 contentRowHeaders = layoutContainer . queryAll (
2901- By . directive ( IgxPivotRowDimensionContentComponent ) ) ;
2925+ By . directive ( IgxPivotRowDimensionContentComponent ) ) ;
29022926 rowDimensionCol3 = contentRowHeaders . filter ( y => y . componentInstance . layout . colStart === 3 ) [ 0 ] ;
29032927 expect ( rowDimensionCol3 . componentInstance . layout . colStart ) . toEqual ( 3 ) ;
29042928 expect ( rowDimensionCol3 . componentInstance . layout . colEnd ) . toEqual ( 5 ) ;
29052929
29062930 // check icon is updated
29072931 expander = rowDimensionCol3 . query ( By . directive ( IgxIconComponent ) ) ;
2908- expect ( expander . nativeElement . innerText ) . toBe ( "chevron_right" ) ;
2932+ expect ( expander . nativeElement . innerText ) . toBe ( "chevron_right" ) ;
29092933
2910- // toggle All Products
2934+ // toggle All Products
29112935 expander . nativeElement . click ( ) ;
29122936 fixture . detectChanges ( ) ;
29132937
29142938 // check cell is no longer merged.
29152939 layoutContainer = fixture . debugElement . query (
29162940 By . directive ( IgxPivotRowDimensionMrlRowComponent ) ) ;
29172941 contentRowHeaders = layoutContainer . queryAll (
2918- By . directive ( IgxPivotRowDimensionContentComponent ) ) ;
2942+ By . directive ( IgxPivotRowDimensionContentComponent ) ) ;
29192943 rowDimensionCol3 = contentRowHeaders . filter ( y => y . componentInstance . layout . colStart === 3 ) [ 0 ] ;
29202944 expect ( rowDimensionCol3 . componentInstance . layout . colStart ) . toEqual ( 3 ) ;
29212945 expect ( rowDimensionCol3 . componentInstance . layout . colEnd ) . toEqual ( 4 ) ;
@@ -2925,14 +2949,14 @@ describe('IgxPivotGrid #pivotGrid', () => {
29252949
29262950 it ( "should collapse fully the last dimension if all parent dimensions get collapsed." , ( ) => {
29272951 pivotGrid . data = [ {
2928- ProductCategory : 'Clothing' , UnitPrice : 12.81 , SellerName : 'Stanley Brooker' ,
2929- Country : 'Bulgaria' , City : 'Plovdiv' , Date : '01/01/2012' , UnitsSold : 282
2930- } ] ;
2952+ ProductCategory : 'Clothing' , UnitPrice : 12.81 , SellerName : 'Stanley Brooker' ,
2953+ Country : 'Bulgaria' , City : 'Plovdiv' , Date : '01/01/2012' , UnitsSold : 282
2954+ } ] ;
29312955 fixture . detectChanges ( ) ;
29322956 let layoutContainer = fixture . debugElement . query (
29332957 By . directive ( IgxPivotRowDimensionMrlRowComponent ) ) ;
29342958 let contentRowHeaders = layoutContainer . queryAll (
2935- By . directive ( IgxPivotRowDimensionContentComponent ) ) ;
2959+ By . directive ( IgxPivotRowDimensionContentComponent ) ) ;
29362960
29372961 const rowDimensionsCol3 = contentRowHeaders . filter ( y => y . componentInstance . layout . colStart === 3 ) ;
29382962 let rowDimensionsCol4 = contentRowHeaders . filter ( y => y . componentInstance . layout . colStart === 4 ) ;
@@ -2945,7 +2969,7 @@ describe('IgxPivotGrid #pivotGrid', () => {
29452969 layoutContainer = fixture . debugElement . query (
29462970 By . directive ( IgxPivotRowDimensionMrlRowComponent ) ) ;
29472971 contentRowHeaders = layoutContainer . queryAll (
2948- By . directive ( IgxPivotRowDimensionContentComponent ) ) ;
2972+ By . directive ( IgxPivotRowDimensionContentComponent ) ) ;
29492973 rowDimensionsCol4 = contentRowHeaders . filter ( y => y . componentInstance . layout . colStart === 4 ) ;
29502974 // nothing is now on column 4 since all are collapsed.
29512975 expect ( rowDimensionsCol4 . length ) . toBe ( 0 ) ;
@@ -2976,7 +3000,7 @@ describe('IgxPivotGrid #pivotGrid', () => {
29763000 const contentRowHeaders = layoutContainers [ 0 ] . queryAll (
29773001 By . directive ( IgxPivotRowDimensionContentComponent ) ) ;
29783002 const summaryRowHeaders = layoutContainers [ 1 ] . queryAll (
2979- By . directive ( IgxPivotRowDimensionContentComponent ) ) ;
3003+ By . directive ( IgxPivotRowDimensionContentComponent ) ) ;
29803004
29813005 // check first column of data contains summary
29823006 const summaryRowHeader = summaryRowHeaders . map ( x => x . componentInstance . rowDimensionColumn . header ) ;
@@ -3103,7 +3127,7 @@ describe('IgxPivotGrid #pivotGrid', () => {
31033127 fixture . detectChanges ( ) ;
31043128
31053129 GridFunctions . verifyHeaderIsFocused ( row0Col0 . parent ) ;
3106- let activeCells = fixture . debugElement . queryAll ( By . css ( `${ ACTIVE_CELL_CSS_CLASS } ` ) ) ;
3130+ let activeCells = fixture . debugElement . queryAll ( By . css ( `${ ACTIVE_CELL_CSS_CLASS } ` ) ) ;
31073131 expect ( activeCells . length ) . toBe ( 1 ) ;
31083132
31093133 UIInteractions . triggerKeyDownEvtUponElem ( 'ArrowRight' , row0Col0 . nativeElement ) ;
@@ -3217,7 +3241,7 @@ describe('IgxPivotGrid #pivotGrid', () => {
32173241 const productRowContents = rowHeaders . filter ( x => x . componentInstance . column . field === "ProductCategory" ) ;
32183242 const productRowContentsHeaders = productRowContents . map ( x => x . componentInstance . column . header ) ;
32193243
3220- expect ( productRowContentsHeaders ) . toEqual ( [ 'ProductCategory' , 'Accessories' , 'Bikes' , 'Clothing' , 'Components' ] ) ;
3244+ expect ( productRowContentsHeaders ) . toEqual ( [ 'ProductCategory' , 'Accessories' , 'Bikes' , 'Clothing' , 'Components' ] ) ;
32213245
32223246 const sortIcon = productsHeaderColumn . querySelectorAll ( 'igx-icon' ) [ 0 ] ;
32233247 sortIcon . click ( ) ;
@@ -3229,7 +3253,7 @@ describe('IgxPivotGrid #pivotGrid', () => {
32293253 By . directive ( IgxPivotRowDimensionHeaderComponent ) ) ;
32303254 const updatedProductRowContents = rowHeaders . filter ( x => x . componentInstance . column . field === "ProductCategory" ) ;
32313255 const updatedProductRowContentsHeaders = updatedProductRowContents . map ( x => x . componentInstance . column . header ) ;
3232- expect ( updatedProductRowContentsHeaders ) . toEqual ( [ 'ProductCategory' , 'Components' , 'Clothing' , 'Bikes' , 'Accessories' ] ) ;
3256+ expect ( updatedProductRowContentsHeaders ) . toEqual ( [ 'ProductCategory' , 'Components' , 'Clothing' , 'Bikes' , 'Accessories' ] ) ;
32333257 } ) ;
32343258
32353259 it ( "should allow select/deselect the correct rows on row header click." , ( ) => {
0 commit comments