This repository was archived by the owner on Sep 8, 2020. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +12
-0
lines changed Expand file tree Collapse file tree 2 files changed +12
-0
lines changed Original file line number Diff line number Diff line change @@ -62,6 +62,7 @@ angular.module('ui.tinymce', [])
6262 ed . on ( 'init' , function ( ) {
6363 ngModel . $render ( ) ;
6464 ngModel . $setPristine ( ) ;
65+ ngModel . $setUntouched ( ) ;
6566 if ( form ) {
6667 form . $setPristine ( ) ;
6768 }
@@ -81,6 +82,8 @@ angular.module('ui.tinymce', [])
8182
8283 ed . on ( 'blur' , function ( ) {
8384 element [ 0 ] . blur ( ) ;
85+ ngModel . $setTouched ( ) ;
86+ scope . $digest ( ) ;
8487 } ) ;
8588
8689 // Update model when an object has been resized (table, image)
Original file line number Diff line number Diff line change @@ -35,6 +35,7 @@ describe('uiTinymce', function () {
3535 compile ( ) ;
3636 expect ( directiveElement . controller ( 'form' ) . $pristine ) . toBe ( true ) ;
3737 expect ( directiveElement . controller ( 'ngModel' ) . $pristine ) . toBe ( true ) ;
38+ expect ( directiveElement . controller ( 'ngModel' ) . $touched ) . toBe ( false ) ;
3839 } ) ;
3940
4041 describe ( 'compiling this directive' , function ( ) {
@@ -65,6 +66,14 @@ describe('uiTinymce', function () {
6566 } ) ;
6667 } ) ;
6768
69+ it ( "should set touched on blur" , function ( ) {
70+ compile ( ) ;
71+ expect ( directiveElement . controller ( 'ngModel' ) . $touched ) . toBe ( false ) ;
72+
73+ element . find ( "textarea" ) . triggerHandler ( "blur" ) ;
74+ expect ( directiveElement . controller ( 'ngModel' ) . $touched ) . toBe ( true ) ;
75+ } ) ;
76+
6877 it ( 'should remove tinymce instance on $scope destruction' , function ( ) {
6978 compile ( ) ;
7079 expect ( tinymce . get ( element . attr ( 'id' ) ) ) . toBeDefined ( ) ;
You can’t perform that action at this time.
0 commit comments