1 | <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> |
---|
2 | <html xmlns="http://www.w3.org/1999/xhtml"> |
---|
3 | <head> |
---|
4 | <title>Config</title> |
---|
5 | <link rel="stylesheet" type="text/css" href="../test.css" /> |
---|
6 | <script type="text/javascript" src="../../../ckeditor_source.js"></script> |
---|
7 | <script type="text/javascript" src="../test.js"></script> |
---|
8 | <script type="text/javascript"> |
---|
9 | //<![CDATA[ |
---|
10 | // Local references. |
---|
11 | var assert = CKEDITOR.test.assert; |
---|
12 | |
---|
13 | var mode = new Array(); |
---|
14 | mode[1] = 'wysiwyg'; |
---|
15 | mode[2] = 'wysiwyg'; |
---|
16 | mode[3] = 'source'; |
---|
17 | mode[4] = 'wysiwyg'; |
---|
18 | mode[5] = 'source'; |
---|
19 | |
---|
20 | var startupFocus = new Array(); |
---|
21 | startupFocus[1] = true; |
---|
22 | startupFocus[2] = false; |
---|
23 | startupFocus[3] = true; |
---|
24 | startupFocus[4] = true; |
---|
25 | startupFocus[5] = false; |
---|
26 | |
---|
27 | |
---|
28 | var testFocus = function( editor, n, forceFocus ) |
---|
29 | { |
---|
30 | /* |
---|
31 | if ( typeof console != 'undefined' ) |
---|
32 | console.log('test '+editor.name ); |
---|
33 | */ |
---|
34 | if ( startupFocus[n] || forceFocus ) // startupFocus set to true |
---|
35 | { |
---|
36 | assert.isTrue( ( editor.focusManager && editor.focusManager.hasFocus ) , 'HasFocus is false' ); |
---|
37 | assert.isTrue( !!CKEDITOR.currentInstance,' CurrentInstance is null' ); |
---|
38 | assert.areSame( CKEDITOR.currentInstance.name, editor.name,' CurrentInstance is wrong' ); |
---|
39 | } |
---|
40 | else |
---|
41 | { |
---|
42 | assert.isFalse( ( editor.focusManager.hasFocus ) , 'HasFocus is true' ); |
---|
43 | |
---|
44 | if ( CKEDITOR.currentInstance ) |
---|
45 | assert.areNotSame( CKEDITOR.currentInstance.name, editor.name, ' editor'+n+' = CKEDITOR.currentInstance' ); |
---|
46 | } |
---|
47 | }; |
---|
48 | /* |
---|
49 | if ( typeof console != 'undefined' ) |
---|
50 | { |
---|
51 | CKEDITOR.on( 'currentInstance', function() |
---|
52 | { |
---|
53 | if (CKEDITOR.currentInstance) |
---|
54 | console.log(' currentInstance: <b>'+ CKEDITOR.currentInstance.name+ '</b>'); |
---|
55 | else |
---|
56 | console.log(' currentInstance empty') |
---|
57 | }); |
---|
58 | } |
---|
59 | */ |
---|
60 | CKEDITOR.test.addTestCase( |
---|
61 | { |
---|
62 | test_config1 : function() |
---|
63 | { |
---|
64 | var testCase = this, |
---|
65 | testNum = 1; |
---|
66 | var editor = CKEDITOR.replace( 'editor' + testNum , { |
---|
67 | startupFocus: startupFocus[ testNum ], |
---|
68 | startupMode : mode[ testNum ], |
---|
69 | on: |
---|
70 | { |
---|
71 | instanceReady : function() |
---|
72 | { |
---|
73 | testCase.resume( function() |
---|
74 | { |
---|
75 | testFocus( editor, testNum ); |
---|
76 | } ); |
---|
77 | } |
---|
78 | } |
---|
79 | }); |
---|
80 | this.wait(); |
---|
81 | }, |
---|
82 | |
---|
83 | test_config2 : function() |
---|
84 | { |
---|
85 | var testCase = this, |
---|
86 | testNum = 2; |
---|
87 | var editor = CKEDITOR.replace( 'editor' + testNum , { |
---|
88 | startupFocus: startupFocus[ testNum ], |
---|
89 | startupMode : mode[ testNum ], |
---|
90 | on: |
---|
91 | { |
---|
92 | instanceReady : function() |
---|
93 | { |
---|
94 | testCase.resume( function() |
---|
95 | { |
---|
96 | testFocus( editor, testNum ); |
---|
97 | } ); |
---|
98 | } |
---|
99 | } |
---|
100 | }); |
---|
101 | |
---|
102 | this.wait(); |
---|
103 | }, |
---|
104 | |
---|
105 | test_config3 : function() |
---|
106 | { |
---|
107 | var testCase = this, |
---|
108 | testNum = 3; |
---|
109 | var editor = CKEDITOR.replace( 'editor' + testNum , { |
---|
110 | startupFocus: startupFocus[ testNum ], |
---|
111 | startupMode : mode[ testNum ], |
---|
112 | on: |
---|
113 | { |
---|
114 | instanceReady : function() |
---|
115 | { |
---|
116 | testCase.resume( function() |
---|
117 | { |
---|
118 | testFocus( editor, testNum ); |
---|
119 | } ); |
---|
120 | } |
---|
121 | } |
---|
122 | }); |
---|
123 | |
---|
124 | this.wait(); |
---|
125 | }, |
---|
126 | |
---|
127 | test_config4 : function() |
---|
128 | { |
---|
129 | var testCase = this, |
---|
130 | testNum = 4; |
---|
131 | var editor = CKEDITOR.replace( 'editor' + testNum , { |
---|
132 | startupFocus: startupFocus[ testNum ], |
---|
133 | startupMode : mode[ testNum ], |
---|
134 | on: |
---|
135 | { |
---|
136 | instanceReady : function() |
---|
137 | { |
---|
138 | testCase.resume( function() |
---|
139 | { |
---|
140 | testFocus( editor, testNum ); |
---|
141 | } ); |
---|
142 | } |
---|
143 | } |
---|
144 | }); |
---|
145 | |
---|
146 | this.wait(); |
---|
147 | }, |
---|
148 | |
---|
149 | test_config5 : function() |
---|
150 | { |
---|
151 | var testCase = this, |
---|
152 | testNum = 5; |
---|
153 | var editor = CKEDITOR.replace( 'editor' + testNum , { |
---|
154 | startupFocus: startupFocus[ testNum ], |
---|
155 | startupMode : mode[ testNum ], |
---|
156 | on: |
---|
157 | { |
---|
158 | instanceReady : function() |
---|
159 | { |
---|
160 | testCase.resume( function() |
---|
161 | { |
---|
162 | testFocus( editor, testNum ); |
---|
163 | } ); |
---|
164 | } |
---|
165 | } |
---|
166 | }); |
---|
167 | |
---|
168 | this.wait(); |
---|
169 | }, |
---|
170 | |
---|
171 | name :document.title |
---|
172 | } ); |
---|
173 | //]]> |
---|
174 | </script> |
---|
175 | |
---|
176 | |
---|
177 | </head> |
---|
178 | <body><br><br><br><br><br><br> |
---|
179 | <textarea id="editor1" name="editor1"></textarea> |
---|
180 | <textarea id="editor2" name="editor2"></textarea> |
---|
181 | <textarea id="editor3" name="editor3"></textarea> |
---|
182 | <textarea id="editor4" name="editor4"></textarea> |
---|
183 | <textarea id="editor5" name="editor5"></textarea> |
---|
184 | </body> |
---|
185 | </html> |
---|