@@ -610,12 +610,22 @@ describe('my app', function() {
610610 } ) ;
611611 } ) ;
612612
613+ describe ( "HTML Editor" , function ( ) {
614+ it ( "should be initialized and have event handler" , function ( ) {
615+ util . isInitialized ( "htmlEditor1" , "igHtmlEditor" ) ;
616+ expect ( util . getResult ( 'testEventListener("igHtmlEditor", "htmlEditor1", "actionExecuted")' ) ) . toBe ( true ) ;
617+ } ) ;
618+ } ) ;
619+
613620 describe ( "Editor" , function ( ) {
614- it ( "Datepicker should be initialized" , function ( ) {
621+ it ( "Datepicker should be initialized and should be with a value from the scope " , function ( ) {
615622 util . isInitialized ( "datePicker1" , "igDatePicker" ) ;
623+ expect ( util . getResult ( 'testEventListener("igDatePicker", "datePicker1", "mouseover")' ) ) . toBe ( true ) ;
624+ expect ( util . getResult ( '$("#datePicker1").igDatePicker("value").getTime()' ) ) . toBe ( new Date ( 2016 , 0 , 20 ) . getTime ( ) ) ;
616625 } ) ;
617626 it ( "Currency should be initialized and should be with a value from the scope" , function ( ) {
618627 util . isInitialized ( "currency1" , "igCurrencyEditor" ) ;
628+ expect ( util . getResult ( 'testEventListener("igCurrencyEditor", "currency1", "mouseover")' ) ) . toBe ( true ) ;
619629 expect ( util . getResult ( '$("#currency1").val()' ) ) . toBe ( "$12.10" ) ;
620630 } ) ;
621631 it ( "Currency should be changing its view when the model is changed" , function ( ) {
@@ -629,15 +639,35 @@ describe('my app', function() {
629639 var currencyInModel = 'angular.element("#currency1").scope().editors.currency;' ;
630640 expect ( util . getResult ( currencyInModel ) ) . toBe ( 12.1 ) ;
631641 } ) ;
632- it ( "Date should be initialized" , function ( ) {
642+ it ( "Date should be initialized and should be with a value from the scope " , function ( ) {
633643 util . isInitialized ( "date1" , "igDateEditor" ) ;
644+ expect ( util . getResult ( 'testEventListener("igDateEditor", "date1", "mouseover")' ) ) . toBe ( true ) ;
645+ expect ( util . getResult ( '$("#date1").igDateEditor("value").getTime()' ) ) . toBe ( new Date ( 2016 , 0 , 20 ) . getTime ( ) ) ;
646+ } ) ;
647+ it ( "Date should be changing its view when the model is changed" , function ( ) {
648+ var newTime = new Date ( 2016 , 0 , 20 ) . getTime ( ) ,
649+ scope = 'angular.element("#currency1").scope()' ;
650+ util . executeScript ( scope + '.editors.date = new Date(' + newTime + ');' ) ;
651+ util . executeScript ( scope + '.$apply();' ) ;
652+ expect ( util . getResult ( '$("#date1").igDateEditor("value").getTime()' ) ) . toBe ( newTime ) ;
653+ expect ( util . getResult ( '$("#datePicker1").igDatePicker("value").getTime()' ) ) . toBe ( newTime ) ;
654+ } ) ;
655+ it ( "Date should update model on value change" , function ( ) {
656+ var newDateString = "11/11/2016" ,
657+ dateInModel = 'angular.element("#date1").scope().editors.date.getTime();' ;
658+ util . executeScript ( '$("#date1").trigger("focus").val("' + newDateString + '").trigger("paste").trigger("blur")' ) ;
659+ expect ( util . getResult ( dateInModel ) ) . toBe ( new Date ( newDateString ) . getTime ( ) ) ;
660+ expect ( util . getResult ( '$("#datePicker1").igDatePicker("value").getTime()' ) ) . toBe ( new Date ( newDateString ) . getTime ( ) ) ;
634661 } ) ;
635- it ( "Mask should be initialized" , function ( ) {
662+ it ( "Mask should be initialized and should be with a value from the scope " , function ( ) {
636663 util . isInitialized ( "mask1" , "igMaskEditor" ) ;
664+ expect ( util . getResult ( 'testEventListener("igMaskEditor", "mask1", "mouseover")' ) ) . toBe ( true ) ;
665+ expect ( util . getResult ( '$("#mask1").igMaskEditor("value")' ) ) . toBe ( "134-134-134" ) ;
637666 } ) ;
638667 it ( "Numeric should be initialized and should be with a value from the scope" , function ( ) {
639668 util . isInitialized ( "numeric1" , "igNumericEditor" ) ;
640- expect ( util . getResult ( '$("#numeric1").val()' ) ) . toBe ( "12.1" ) ;
669+ expect ( util . getResult ( 'testEventListener("igNumericEditor", "numeric1", "mouseover")' ) ) . toBe ( true ) ;
670+ expect ( util . getResult ( '$("#numeric1").igNumericEditor("value")' ) ) . toBe ( 12.1 ) ;
641671 } ) ;
642672 it ( "Numeric should be changing its view when the model is changed" , function ( ) {
643673 var scope = 'angular.element("#numeric1").scope()' ;
@@ -650,11 +680,14 @@ describe('my app', function() {
650680 var currencyInModel = 'angular.element("#numeric1").scope().editors.currency;' ;
651681 expect ( util . getResult ( currencyInModel ) ) . toBe ( 123 ) ;
652682 } ) ;
653- it ( "Percent should be initialized" , function ( ) {
683+ it ( "Percent should be initialized and should be with a value from the scope " , function ( ) {
654684 util . isInitialized ( "percent1" , "igPercentEditor" ) ;
685+ expect ( util . getResult ( 'testEventListener("igPercentEditor", "percent1", "mouseover")' ) ) . toBe ( true ) ;
686+ expect ( util . getResult ( '$("#percent1").igPercentEditor("value")' ) ) . toBe ( 12 ) ;
655687 } ) ;
656688 it ( "Text should be initialized" , function ( ) {
657689 util . isInitialized ( "text1" , "igTextEditor" ) ;
690+ expect ( util . getResult ( 'testEventListener("igTextEditor", "text1", "mouseover")' ) ) . toBe ( true ) ;
658691 } ) ;
659692 it ( "Text should updated model correctly" , function ( ) {
660693 var textInModel = 'angular.element("#text1").scope().editors.text;' ;
0 commit comments