@@ -56,7 +56,7 @@ describe("froala", function () {
5656 if ( scope . froalaOptions === undefined ) {
5757 scope . froalaOptions = { } ;
5858 }
59- scope . froalaOptions . initOnClick = true ;
59+ scope . froalaOptions . disableRightClick = true ;
6060 scope . content = '' ;
6161 } ;
6262
@@ -88,7 +88,7 @@ describe("froala", function () {
8888 compileElement ( ) ;
8989
9090 expect ( froalaEditorStub . args [ 0 ] [ 0 ] . placeholderText ) . toEqual ( 'Placeholder' ) ;
91- expect ( froalaEditorStub . args [ 0 ] [ 0 ] . initOnClick ) . toBeTruthy ( ) ;
91+ expect ( froalaEditorStub . args [ 0 ] [ 0 ] . disableRightClick ) . toBeTruthy ( ) ;
9292 } ) ;
9393
9494 it ( 'Uses default option values when no options are provided' , function ( ) {
@@ -150,6 +150,7 @@ describe("froala", function () {
150150 } ) ;
151151
152152 froalaEditorOnStub . callArgOn ( 1 ) ;
153+ $rootScope . $digest ( ) ;
153154
154155 expect ( $rootScope . content ) . toEqual ( 'My String' ) ;
155156 } ) ;
@@ -160,6 +161,7 @@ describe("froala", function () {
160161 } ) ;
161162
162163 element . trigger ( 'froalaEditor.contentChanged' ) ;
164+ $rootScope . $digest ( ) ;
163165
164166 expect ( $rootScope . content ) . toEqual ( 'My String' ) ;
165167 } ) ;
@@ -169,6 +171,7 @@ describe("froala", function () {
169171
170172 $rootScope . content = '<i>New Text</i>' ;
171173 $rootScope . $digest ( ) ;
174+ element . trigger ( 'froalaEditor.initialized' ) ;
172175
173176 expect ( froalaEditorStub . getCall ( 1 ) . args [ 0 ] ) . toEqual ( 'html.set' ) ;
174177 expect ( froalaEditorStub . getCall ( 1 ) . args [ 1 ] ) . toEqual ( '<i>New Text</i>' ) ;
@@ -217,9 +220,11 @@ describe("froala", function () {
217220 createEditorInManualMode ( ) ;
218221
219222 $rootScope . initControls . initialize ( ) ;
223+ element . trigger ( 'froalaEditor.initialized' ) ;
224+
220225 $rootScope . initControls . initialize ( ) ;
221226
222- expect ( froalaEditorStub . callCount ) . toEqual ( 1 ) ;
227+ expect ( froalaEditorStub . callCount ) . toEqual ( 4 ) ; // 1 for creating editor and 3 after initialized event
223228 } ) ;
224229
225230 it ( 'Can re-initialize the editor after closing it' , function ( ) {
@@ -297,12 +302,21 @@ describe("froala", function () {
297302
298303 } ) ;
299304
300- it ( 'Sets the view to the value of the model' , function ( ) {
305+ it ( 'Sets the view to the value of the model' , function ( ) {
301306 $rootScope . content = '<i>New Text</i>' ;
302307
303308 compileViewElement ( ) ;
304309 $rootScope . $digest ( ) ;
305310
306311 expect ( view . html ( ) ) . toEqual ( "<i>New Text</i>" ) ;
307- } ) ;
312+ } ) ;
313+
314+ it ( 'Sets options when the editor is instantiated manually' , function ( ) {
315+ createEditorInManualMode ( ) ;
316+
317+ $rootScope . initControls . initialize ( { initOnClick : false } ) ;
318+
319+ expect ( froalaEditorStub . called ) . toBeTruthy ( ) ;
320+ expect ( froalaEditorStub . args [ 0 ] [ 0 ] . initOnClick ) . toBeFalsy ( ) ;
321+ } ) ;
308322} ) ;
0 commit comments