1 | <!DOCTYPE html> |
---|
2 | <html> |
---|
3 | <head> |
---|
4 | <title>#11131 - Widget breaks when switching to source mode while having nested editable focused</title> |
---|
5 | <meta name="cktester-tags" content="editor,unit"> |
---|
6 | <script src="../../cktester/cktester.js"></script> |
---|
7 | </head> |
---|
8 | <body> |
---|
9 | <textarea id="framed"></textarea> |
---|
10 | <div id="inline" contenteditable="true"></div> |
---|
11 | <textarea id="divarea"></textarea> |
---|
12 | <script> |
---|
13 | ( function() { |
---|
14 | 'use strict'; |
---|
15 | |
---|
16 | var editorsDefinitions = { |
---|
17 | framed: { |
---|
18 | name: 'framed' |
---|
19 | }, |
---|
20 | /* |
---|
21 | @todo: inline editor should fire contentDomUnload event too. |
---|
22 | inline: { |
---|
23 | name: 'inline', |
---|
24 | creator: 'inline' |
---|
25 | },*/ |
---|
26 | divarea: { |
---|
27 | name: 'divarea', |
---|
28 | config: { |
---|
29 | extraPlugins: 'divarea' |
---|
30 | } |
---|
31 | } |
---|
32 | }; |
---|
33 | |
---|
34 | var tests = { |
---|
35 | 'test editable detach events': function( editor ) { |
---|
36 | var editable = editor.editable(), |
---|
37 | eventFiredTimes = 0; |
---|
38 | |
---|
39 | editor.on( 'contentDomUnload', function() { |
---|
40 | eventFiredTimes++; |
---|
41 | } ); |
---|
42 | editable.detach(); |
---|
43 | |
---|
44 | assert.areSame( 1, eventFiredTimes, 'after calling editable.detach() contentDomUnload should be fired only once' ); |
---|
45 | } |
---|
46 | }; |
---|
47 | |
---|
48 | CKTESTER.tools.setUpEditors( editorsDefinitions, function( editors ) { |
---|
49 | CKTESTER.test( CKTESTER.tools.createTestsForEditors( editors, tests ) ); |
---|
50 | } ); |
---|
51 | } )(); |
---|
52 | </script> |
---|
53 | </body> |
---|
54 | </html> |
---|