@@ -14,7 +14,8 @@ describe('uiTinymce', function () {
1414 } ) ) ;
1515
1616 afterEach ( function ( ) {
17- angular . module ( 'ui.tinymce' ) . value ( 'uiTinymceConfig' , { } ) ; // cleanup
17+ angular . module ( 'ui.tinymce' ) . value ( 'uiTinymceConfig' , { } ) ;
18+ element . remove ( ) ;
1819 } ) ;
1920
2021 /**
@@ -23,6 +24,7 @@ describe('uiTinymce', function () {
2324 function compile ( ) {
2425 runs ( function ( ) {
2526 element = $compile ( '<form><textarea id="foo" ui-tinymce="{foo: \'bar\', setup: setupFooBar() }" ng-model="foo"></textarea></form>' ) ( scope ) ;
27+ angular . element ( document . getElementsByTagName ( 'body' ) [ 0 ] ) . append ( element ) ;
2628 } ) ;
2729 scope . $apply ( ) ;
2830 waits ( 1 ) ;
@@ -47,7 +49,7 @@ describe('uiTinymce', function () {
4749 expect ( tinymce . init . mostRecentCall . args [ 0 ] . tinymce . bar ) . toEqual ( 'baz' ) ;
4850 } ) ;
4951 } ) ;
50-
52+
5153 it ( 'should execute the passed `setup` option' , function ( ) {
5254 scope . setupFooBar = jasmine . createSpy ( 'setupFooBar' ) ;
5355 compile ( ) ;
@@ -64,7 +66,7 @@ describe('uiTinymce', function () {
6466 scope.$apply(function() {
6567 scope.foo = text;
6668 });
67- expect(element.find('textarea').tinymce( ).getContent()).toEqual(text);
69+ expect(tinymce.get('foo' ).getContent()).toEqual(text);
6870 });
6971 });
7072 it('should handle undefined gracefully', function() {
@@ -73,7 +75,7 @@ describe('uiTinymce', function () {
7375 scope.$apply(function() {
7476 scope.foo = undefined;
7577 });
76- expect(element.find('textarea').tinymce( ).getContent()).toEqual('');
78+ expect(tinymce.get('foo' ).getContent()).toEqual('');
7779 });
7880 });
7981 it('should handle null gracefully', function() {
@@ -82,18 +84,18 @@ describe('uiTinymce', function () {
8284 scope.$apply(function() {
8385 scope.foo = null;
8486 });
85- expect(element.find('textarea').tinymce( ).getContent()).toEqual('');
87+ expect(tinymce.get('foo' ).getContent()).toEqual('');
8688 });
8789 });
8890 });
8991 describe('using the editor', function () {
9092 it('should update the model', function() {
9193 compile();
9294 runs(function () {
93- element.find('textarea').tinymce( ).setContent(text);
94- expect($rootScope.x ).toEqual(text);
95+ tinymce.get('foo' ).setContent(text);
96+ expect(scope.foo ).toEqual(text);
9597 });
9698 });
9799 });
98- */
100+ */
99101} ) ;
0 commit comments