@@ -14,7 +14,8 @@ describe('uiTinymce', function () {
14
14
} ) ) ;
15
15
16
16
afterEach ( function ( ) {
17
- angular . module ( 'ui.tinymce' ) . value ( 'uiTinymceConfig' , { } ) ; // cleanup
17
+ angular . module ( 'ui.tinymce' ) . value ( 'uiTinymceConfig' , { } ) ;
18
+ element . remove ( ) ;
18
19
} ) ;
19
20
20
21
/**
@@ -23,6 +24,7 @@ describe('uiTinymce', function () {
23
24
function compile ( ) {
24
25
runs ( function ( ) {
25
26
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 ) ;
26
28
} ) ;
27
29
scope . $apply ( ) ;
28
30
waits ( 1 ) ;
@@ -47,7 +49,7 @@ describe('uiTinymce', function () {
47
49
expect ( tinymce . init . mostRecentCall . args [ 0 ] . tinymce . bar ) . toEqual ( 'baz' ) ;
48
50
} ) ;
49
51
} ) ;
50
-
52
+
51
53
it ( 'should execute the passed `setup` option' , function ( ) {
52
54
scope . setupFooBar = jasmine . createSpy ( 'setupFooBar' ) ;
53
55
compile ( ) ;
@@ -64,7 +66,7 @@ describe('uiTinymce', function () {
64
66
scope.$apply(function() {
65
67
scope.foo = text;
66
68
});
67
- expect(element.find('textarea').tinymce( ).getContent()).toEqual(text);
69
+ expect(tinymce.get('foo' ).getContent()).toEqual(text);
68
70
});
69
71
});
70
72
it('should handle undefined gracefully', function() {
@@ -73,7 +75,7 @@ describe('uiTinymce', function () {
73
75
scope.$apply(function() {
74
76
scope.foo = undefined;
75
77
});
76
- expect(element.find('textarea').tinymce( ).getContent()).toEqual('');
78
+ expect(tinymce.get('foo' ).getContent()).toEqual('');
77
79
});
78
80
});
79
81
it('should handle null gracefully', function() {
@@ -82,18 +84,18 @@ describe('uiTinymce', function () {
82
84
scope.$apply(function() {
83
85
scope.foo = null;
84
86
});
85
- expect(element.find('textarea').tinymce( ).getContent()).toEqual('');
87
+ expect(tinymce.get('foo' ).getContent()).toEqual('');
86
88
});
87
89
});
88
90
});
89
91
describe('using the editor', function () {
90
92
it('should update the model', function() {
91
93
compile();
92
94
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);
95
97
});
96
98
});
97
99
});
98
- */
100
+ */
99
101
} ) ;
0 commit comments