@@ -643,6 +643,69 @@ export function main() {
643643 } , 500 ) ;
644644 } ) ;
645645 } ) ;
646+ it ( 'should populate featuerList when features are defined via grid options.' , ( done ) => {
647+ var template = '<div><ig-grid [(widgetId)]="gridID" [(options)]="optsAllFeatures" [(dataSource)]="data1"></ig-grid></div>' ;
648+ TestBed . overrideComponent ( TestComponent , {
649+ set : {
650+ template : template
651+ }
652+ } ) ;
653+ TestBed . compileComponents ( ) . then ( ( ) => {
654+ let fixture = TestBed . createComponent ( TestComponent ) ;
655+ fixture . detectChanges ( ) ;
656+ var list = fixture . componentInstance . viewChild . featuresList ;
657+ expect ( list . allFeatures . length ) . toBe ( 14 ) ;
658+ expect ( list . updating !== undefined ) . toBeTruthy ( "Feature should be populated." ) ;
659+ expect ( list . filtering !== undefined ) . toBeTruthy ( "Feature should be populated." ) ;
660+ expect ( list . paging !== undefined ) . toBeTruthy ( "Feature should be populated." ) ;
661+ expect ( list . columnFixing !== undefined ) . toBeTruthy ( "Feature should be populated." ) ;
662+ expect ( list . columnMoving !== undefined ) . toBeTruthy ( "Feature should be populated." ) ;
663+ expect ( list . sorting !== undefined ) . toBeTruthy ( "Feature should be populated." ) ;
664+ expect ( list . tooltips !== undefined ) . toBeTruthy ( "Feature should be populated." ) ;
665+ expect ( list . cellMerging !== undefined ) . toBeTruthy ( "Feature should be populated." ) ;
666+ expect ( list . selection !== undefined ) . toBeTruthy ( "Feature should be populated." ) ;
667+ expect ( list . rowSelectors !== undefined ) . toBeTruthy ( "Feature should be populated." ) ;
668+ expect ( list . resizing !== undefined ) . toBeTruthy ( "Feature should be populated." ) ;
669+ expect ( list . multiColumnHeaders !== undefined ) . toBeTruthy ( "Feature should be populated." ) ;
670+ expect ( list . columnFixing !== undefined ) . toBeTruthy ( "Feature should be populated." ) ;
671+ expect ( list . summaries !== undefined ) . toBeTruthy ( "Feature should be populated." ) ;
672+ done ( ) ;
673+ } ) ;
674+ } ) ;
675+
676+ it ( 'should populate featuerList when features are defined via grid options - part 2.' , ( done ) => {
677+ var template = '<div><ig-grid [(widgetId)]="gridID" [(options)]="optsAllFeatures2" [(dataSource)]="data1"></ig-grid></div>' ;
678+ TestBed . overrideComponent ( TestComponent , {
679+ set : {
680+ template : template
681+ }
682+ } ) ;
683+ TestBed . compileComponents ( ) . then ( ( ) => {
684+ let fixture = TestBed . createComponent ( TestComponent ) ;
685+ fixture . detectChanges ( ) ;
686+ var list = fixture . componentInstance . viewChild . featuresList ;
687+ expect ( list . allFeatures . length ) . toBe ( 2 ) ;
688+ expect ( list . appendRowsOnDemand !== undefined ) . toBeTruthy ( "Feature should be populated." ) ;
689+ expect ( list . responsive !== undefined ) . toBeTruthy ( "Feature should be populated." ) ;
690+ done ( ) ;
691+ } ) ;
692+ } ) ;
693+ it ( 'should populate featuerList when features are defined via grid options - part 3.' , ( done ) => {
694+ var template = '<div><ig-grid [(widgetId)]="gridID" [(options)]="optsAllFeatures3" [(dataSource)]="data1"></ig-grid></div>' ;
695+ TestBed . overrideComponent ( TestComponent , {
696+ set : {
697+ template : template
698+ }
699+ } ) ;
700+ TestBed . compileComponents ( ) . then ( ( ) => {
701+ let fixture = TestBed . createComponent ( TestComponent ) ;
702+ fixture . detectChanges ( ) ;
703+ var list = fixture . componentInstance . viewChild . featuresList ;
704+ expect ( list . allFeatures . length ) . toBe ( 1 ) ;
705+ expect ( list . groupBy !== undefined ) . toBeTruthy ( "Feature should be populated." ) ;
706+ done ( ) ;
707+ } ) ;
708+ } ) ;
646709 } ) ;
647710}
648711
@@ -667,6 +730,9 @@ class TestComponent {
667730 public caption : string ;
668731 public idHeaderText : string ;
669732 public gridWidth : string ;
733+ public optsAllFeatures :any ;
734+ public optsAllFeatures2 :any ;
735+ public optsAllFeatures3 :any ;
670736 @ViewChild ( Infragistics . IgGridComponent ) public viewChild : Infragistics . IgGridComponent ;
671737
672738 constructor ( ) {
@@ -741,6 +807,108 @@ class TestComponent {
741807 }
742808 ]
743809 } ;
810+ this . optsAllFeatures = {
811+ width : "700px" ,
812+ height : "400px" ,
813+ autoCommit : true ,
814+ autoGenerateColumns : false ,
815+ columns : [
816+ { key : "Id" , headerText : "ID" , width : "100px" , dataType : "string" } ,
817+ { key : "Date" , headerText : "Date" , dataType : "date" , width : "100px" , format : "dd/MM/yyyy" } ,
818+ ] ,
819+ primaryKey : "Id" ,
820+ features : [
821+ {
822+ name : "Filtering"
823+ } ,
824+ {
825+ name : "Updating"
826+ } ,
827+ {
828+ name : "Paging"
829+ } ,
830+ {
831+ name : "ColumnFixing"
832+ } ,
833+ {
834+ name : "Sorting"
835+ } ,
836+ {
837+ name : "Summaries"
838+ } ,
839+ {
840+ name : "Hiding"
841+ } ,
842+ {
843+ name : "ColumnMoving"
844+ } ,
845+ {
846+ name : "Tooltips"
847+ } ,
848+ {
849+ name : "CellMerging"
850+ } ,
851+ {
852+ name : "Selection"
853+ } ,
854+ {
855+ name : "RowSelectors"
856+ } ,
857+ //{
858+ //name: "AppendRowsOnDemand"
859+ //},
860+ //{
861+ //name: "GroupBy"
862+ //},
863+ {
864+ name : "Resizing"
865+ } ,
866+ {
867+ name : "MultiColumnHeaders"
868+ } ,
869+ //{
870+ // name: "Responsive"
871+ //}
872+ ]
873+ } ;
874+ this . optsAllFeatures2 = {
875+ width : "700px" ,
876+ height : "400px" ,
877+ autoCommit : true ,
878+ autoGenerateColumns : false ,
879+ columns : [
880+ { key : "Id" , headerText : "ID" , width : "100px" , dataType : "string" } ,
881+ { key : "Date" , headerText : "Date" , dataType : "date" , width : "100px" , format : "dd/MM/yyyy" } ,
882+ ] ,
883+ primaryKey : "Id" ,
884+ features : [
885+ {
886+ name : "AppendRowsOnDemand"
887+ } ,
888+ {
889+ name : "Responsive"
890+ }
891+ ]
892+ } ;
893+
894+ this . optsAllFeatures3 = {
895+ width : "700px" ,
896+ height : "400px" ,
897+ autoCommit : true ,
898+ autoGenerateColumns : false ,
899+ columns : [
900+ { key : "Id" , headerText : "ID" , width : "100px" , dataType : "string" } ,
901+ { key : "Date" , headerText : "Date" , dataType : "date" , width : "100px" , format : "dd/MM/yyyy" } ,
902+ ] ,
903+ primaryKey : "Id" ,
904+ features : [
905+ {
906+ name :"GroupBy"
907+ }
908+ ]
909+ } ;
910+
911+
744912 this . optsNew = {
745913 dataSource : this . singleRecData ,
746914 height : "300px" ,
@@ -752,7 +920,7 @@ class TestComponent {
752920 { key : "Age" , headerText : "Age" , dataType : "number" , width : "100px" , template : "Age: ${Age}" } ,
753921 { key : "HireDate" , headerText : "HireDate" , dataType : "date" , width : "100px" } ,
754922 ] } ;
755- }
923+ } ;
756924
757925 public cellClickHandler ( evt ) {
758926 this . firedEvent = evt ;
0 commit comments