@@ -1482,119 +1482,118 @@ describe('Pivot pipes #pivotGrid', () => {
14821482 { Years : '2021' , AllProduct : 'All Products' , Discontinued : 'false' , Country : 'USA' , SellerName : 'David' } ,
14831483 { Years : '2021' , AllProduct : 'All Products' , Discontinued : 'false' , Country : 'USA' , SellerName : 'John' }
14841484 ] ) ;
1485-
1486- // automation for https://github.com/IgniteUI/igniteui-angular/issues/10545
1487- it ( 'should generate last dimension values for all records.' , ( ) => {
1488- data = [
1489- {
1490- ProductCategory : 'Clothing' , UnitPrice : 12.81 , SellerName : 'Stanley' ,
1491- Country : 'Bulgaria' , City : 'Sofia' , Date : '01/01/2021' , UnitsSold : 282
1492- } ,
1493- {
1494- ProductCategory : 'Clothing' , UnitPrice : 49.57 , SellerName : 'Elisa' ,
1495- Country : 'USA' , City : 'New York' , Date : '01/05/2019' , UnitsSold : 296
1496- } ,
1497- {
1498- ProductCategory : 'Bikes' , UnitPrice : 3.56 , SellerName : 'Lydia' ,
1499- Country : 'Uruguay' , City : 'Ciudad de la Costa' , Date : '01/06/2020' , UnitsSold : 68
1500- } ,
1501- {
1502- ProductCategory : 'Accessories' , UnitPrice : 85.58 , SellerName : 'David' ,
1503- Country : 'USA' , City : 'New York' , Date : '04/07/2021' , UnitsSold : 293
1504- } ,
1505- {
1506- ProductCategory : 'Components' , UnitPrice : 18.13 , SellerName : 'John' ,
1507- Country : 'USA' , City : 'New York' , Date : '12/08/2021' , UnitsSold : 240
1508- } ,
1509- {
1510- ProductCategory : 'Clothing' , UnitPrice : 68.33 , SellerName : 'Larry' ,
1511- Country : 'Uruguay' , City : 'Ciudad de la Costa' , Date : '05/12/2020' , UnitsSold : 456
1512- } ,
1513- {
1514- ProductCategory : 'Clothing' , UnitPrice : 16.05 , SellerName : 'Walter' ,
1515- Country : 'Bulgaria' , City : 'Plovdiv' , Date : '02/19/2020' , UnitsSold : 492
1516- } ] ;
1517- pivotConfig . columns = [ {
1518- memberName : 'Country' ,
1519- enabled : true
1485+ } ) ;
1486+ // automation for https://github.com/IgniteUI/igniteui-angular/issues/10545
1487+ it ( 'should generate last dimension values for all records.' , ( ) => {
1488+ data = [
1489+ {
1490+ ProductCategory : 'Clothing' , UnitPrice : 12.81 , SellerName : 'Stanley' ,
1491+ Country : 'Bulgaria' , City : 'Sofia' , Date : '01/01/2021' , UnitsSold : 282
1492+ } ,
1493+ {
1494+ ProductCategory : 'Clothing' , UnitPrice : 49.57 , SellerName : 'Elisa' ,
1495+ Country : 'USA' , City : 'New York' , Date : '01/05/2019' , UnitsSold : 296
1496+ } ,
1497+ {
1498+ ProductCategory : 'Bikes' , UnitPrice : 3.56 , SellerName : 'Lydia' ,
1499+ Country : 'Uruguay' , City : 'Ciudad de la Costa' , Date : '01/06/2020' , UnitsSold : 68
1500+ } ,
1501+ {
1502+ ProductCategory : 'Accessories' , UnitPrice : 85.58 , SellerName : 'David' ,
1503+ Country : 'USA' , City : 'New York' , Date : '04/07/2021' , UnitsSold : 293
1504+ } ,
1505+ {
1506+ ProductCategory : 'Components' , UnitPrice : 18.13 , SellerName : 'John' ,
1507+ Country : 'USA' , City : 'New York' , Date : '12/08/2021' , UnitsSold : 240
1508+ } ,
1509+ {
1510+ ProductCategory : 'Clothing' , UnitPrice : 68.33 , SellerName : 'Larry' ,
1511+ Country : 'Uruguay' , City : 'Ciudad de la Costa' , Date : '05/12/2020' , UnitsSold : 456
1512+ } ,
1513+ {
1514+ ProductCategory : 'Clothing' , UnitPrice : 16.05 , SellerName : 'Walter' ,
1515+ Country : 'Bulgaria' , City : 'Plovdiv' , Date : '02/19/2020' , UnitsSold : 492
15201516 } ] ;
1521- pivotConfig . rows = [
1522- new IgxPivotDateDimension (
1523- {
1524- memberName : 'Date' ,
1525- enabled : true
1526- } ,
1527- {
1528- months : false
1529- }
1530- ) ,
1517+ pivotConfig . columns = [ {
1518+ memberName : 'Country' ,
1519+ enabled : true
1520+ } ] ;
1521+ pivotConfig . rows = [
1522+ new IgxPivotDateDimension (
15311523 {
1532- memberName : 'City ' ,
1524+ memberName : 'Date ' ,
15331525 enabled : true
15341526 } ,
15351527 {
1536- memberFunction : ( ) => 'All' ,
1537- memberName : 'AllProducts' ,
1538- enabled : true ,
1539- childLevel : {
1540- memberFunction : ( recData ) => recData . ProductCategory ,
1541- memberName : 'ProductCategory' ,
1542- enabled : true
1543- }
1544- } ,
1545- {
1546- memberName : 'SellerName' ,
1528+ months : false
1529+ }
1530+ ) ,
1531+ {
1532+ memberName : 'City' ,
1533+ enabled : true
1534+ } ,
1535+ {
1536+ memberFunction : ( ) => 'All' ,
1537+ memberName : 'AllProducts' ,
1538+ enabled : true ,
1539+ childLevel : {
1540+ memberFunction : ( recData ) => recData . ProductCategory ,
1541+ memberName : 'ProductCategory' ,
15471542 enabled : true
15481543 }
1549- ] ;
1550- const rowPipeResult = rowPipe . transform ( data , pivotConfig , expansionStates ) ;
1551- const columnPipeResult = columnPipe . transform ( rowPipeResult , pivotConfig , new Map < any , boolean > ( ) ) ;
1552- const rowStatePipeResult = rowStatePipe . transform ( columnPipeResult , pivotConfig , expansionStates , true ) ;
1553- const sellers = rowStatePipeResult . map ( x => x . SellerName ) ;
1554- // there should be no empty values.
1555- expect ( sellers . filter ( x => x === undefined ) . length ) . toBe ( 0 ) ;
1556- } ) ;
1557-
1558- // automation for https://github.com/IgniteUI/igniteui-angular/issues/10662
1559- it ( 'should retain processed values for last dimension when bound to complex object.' , ( ) => {
1560- data = DATA ;
1561- pivotConfig . rows = [
1562- {
1563- memberName : 'Date' ,
1564- enabled : true ,
1565- } ,
1544+ } ,
1545+ {
1546+ memberName : 'SellerName' ,
1547+ enabled : true
1548+ }
1549+ ] ;
1550+ const rowPipeResult = rowPipe . transform ( data , pivotConfig , expansionStates ) ;
1551+ const columnPipeResult = columnPipe . transform ( rowPipeResult , pivotConfig , new Map < any , boolean > ( ) ) ;
1552+ const rowStatePipeResult = rowStatePipe . transform ( columnPipeResult , pivotConfig , expansionStates , true ) ;
1553+ const sellers = rowStatePipeResult . map ( x => x . SellerName ) ;
1554+ // there should be no empty values.
1555+ expect ( sellers . filter ( x => x === undefined ) . length ) . toBe ( 0 ) ;
1556+ } ) ;
1557+
1558+ // automation for https://github.com/IgniteUI/igniteui-angular/issues/10662
1559+ it ( 'should retain processed values for last dimension when bound to complex object.' , ( ) => {
1560+ data = DATA ;
1561+ pivotConfig . rows = [
1562+ {
1563+ memberName : 'Date' ,
1564+ enabled : true ,
1565+ } ,
1566+ {
1567+ memberName : 'AllProduct' ,
1568+ memberFunction : ( ) => 'All Products' ,
1569+ enabled : true ,
1570+ childLevel :
15661571 {
1567- memberName : 'AllProduct' ,
1568- memberFunction : ( ) => 'All Products' ,
1569- enabled : true ,
1570- childLevel :
1571- {
15721572
1573- memberName : 'Product' ,
1574- memberFunction : ( recData ) => recData . Product . Name ,
1575- enabled : true
1576- }
1577- } ,
1573+ memberName : 'Product' ,
1574+ memberFunction : ( recData ) => recData . Product . Name ,
1575+ enabled : true
1576+ }
1577+ } ,
1578+ {
1579+ memberName : 'AllSeller' ,
1580+ memberFunction : ( ) => 'All Sellers' ,
1581+ enabled : true ,
1582+ childLevel :
15781583 {
1579- memberName : 'AllSeller ' ,
1580- memberFunction : ( ) => 'All Sellers' ,
1584+ memberName : 'Seller ' ,
1585+ memberFunction : ( recData ) => recData . Seller . Name ,
15811586 enabled : true ,
1582- childLevel :
1583- {
1584- memberName : 'Seller' ,
1585- memberFunction : ( recData ) => recData . Seller . Name ,
1586- enabled : true ,
1587- } ,
15881587 } ,
1589- ] ;
1588+ } ,
1589+ ] ;
15901590
1591- const rowPipeResult = rowPipe . transform ( data , pivotConfig , expansionStates ) ;
1592- const columnPipeResult = columnPipe . transform ( rowPipeResult , pivotConfig , new Map < any , boolean > ( ) ) ;
1593- const rowStatePipeResult = rowStatePipe . transform ( columnPipeResult , pivotConfig , expansionStates , true ) ;
1591+ const rowPipeResult = rowPipe . transform ( data , pivotConfig , expansionStates ) ;
1592+ const columnPipeResult = columnPipe . transform ( rowPipeResult , pivotConfig , new Map < any , boolean > ( ) ) ;
1593+ const rowStatePipeResult = rowStatePipe . transform ( columnPipeResult , pivotConfig , expansionStates , true ) ;
15941594
1595- const res = rowStatePipeResult . filter ( x => x . AllSeller === undefined ) . map ( x => x . Seller ) ;
1596- // all values should be strings as the result of the processed member function is string.
1597- expect ( res . filter ( x => typeof x !== 'string' ) . length ) . toBe ( 0 ) ;
1598- } ) ;
1595+ const res = rowStatePipeResult . filter ( x => x . AllSeller === undefined ) . map ( x => x . Seller ) ;
1596+ // all values should be strings as the result of the processed member function is string.
1597+ expect ( res . filter ( x => typeof x !== 'string' ) . length ) . toBe ( 0 ) ;
15991598 } ) ;
16001599} ) ;
0 commit comments