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', [])
62
62
ed . on ( 'init' , function ( ) {
63
63
ngModel . $render ( ) ;
64
64
ngModel . $setPristine ( ) ;
65
+ ngModel . $setUntouched ( ) ;
65
66
if ( form ) {
66
67
form . $setPristine ( ) ;
67
68
}
@@ -81,6 +82,8 @@ angular.module('ui.tinymce', [])
81
82
82
83
ed . on ( 'blur' , function ( ) {
83
84
element [ 0 ] . blur ( ) ;
85
+ ngModel . $setTouched ( ) ;
86
+ scope . $digest ( ) ;
84
87
} ) ;
85
88
86
89
// 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 () {
35
35
compile ( ) ;
36
36
expect ( directiveElement . controller ( 'form' ) . $pristine ) . toBe ( true ) ;
37
37
expect ( directiveElement . controller ( 'ngModel' ) . $pristine ) . toBe ( true ) ;
38
+ expect ( directiveElement . controller ( 'ngModel' ) . $touched ) . toBe ( false ) ;
38
39
} ) ;
39
40
40
41
describe ( 'compiling this directive' , function ( ) {
@@ -65,6 +66,14 @@ describe('uiTinymce', function () {
65
66
} ) ;
66
67
} ) ;
67
68
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
+
68
77
it ( 'should remove tinymce instance on $scope destruction' , function ( ) {
69
78
compile ( ) ;
70
79
expect ( tinymce . get ( element . attr ( 'id' ) ) ) . toBeDefined ( ) ;
You can’t perform that action at this time.
0 commit comments