3 // set tabstop=4 " number of spaces in a tab |
3 // set tabstop=4 " number of spaces in a tab |
4 // set softtabstop=4 " as above |
4 // set softtabstop=4 " as above |
5 // set shiftwidth=4 " as above |
5 // set shiftwidth=4 " as above |
6 |
6 |
7 var w = __karma__.config.w, |
7 var w = __karma__.config.w, |
8 t = {'text_nb': 12, 'user_nb': 4}, |
8 t = {'text_nb': 0, 'user_nb': 4}, |
9 long_text = ''; |
9 long_text = ''; |
10 |
10 |
11 for (var i = 20; i--;) |
11 for (var i = 20; i--;) |
12 long_text += 'Contenu du troisième texte.<br/>Sur <b>plusieurs</b> lignes<br/>'; |
12 long_text += 'Contenu du troisième texte.<br/>Sur <b>plusieurs</b> lignes<br/>'; |
13 |
13 |
101 test_text ('table.dash_table:eq(3) a:eq(1)[href="?span=day"]', '24 hours'); |
101 test_text ('table.dash_table:eq(3) a:eq(1)[href="?span=day"]', '24 hours'); |
102 test_text ('table.dash_table th:eq(4) span.em', 'Activities'); |
102 test_text ('table.dash_table th:eq(4) span.em', 'Activities'); |
103 test_unlogged_footer (); |
103 test_unlogged_footer (); |
104 }); |
104 }); |
105 |
105 |
106 suite.skip ('empty texts list page conformity', function () { |
106 suite ('empty texts list page conformity', function () { |
107 test_page_loading ('/text/', 'Texts\n - '+c['#id_workspace_name']); |
107 test_page_loading ('/text/', 'Texts\n - '+c['#id_workspace_name']); |
108 test_logged_header (w.USER_ADMIN); |
108 test_logged_header (w.USER_ADMIN); |
109 test_default_tabs (t.text_nb, t.user_nb); |
109 test_default_tabs (t.text_nb, t.user_nb); |
110 test_count ('#text ul.sub_list:eq(0) a', 3); |
110 test_count ('#text ul.sub_list:eq(0) a', 3); |
111 test_text ('#text ul.sub_list:eq(0) a:eq(0)[href="/create/content/"]', 'Create a text'); |
111 test_text ('#text ul.sub_list:eq(0) a:eq(0)[href="/create/content/"]', 'Create a text'); |
185 test_count ('div.help_text span.error-text', 1); |
185 test_count ('div.help_text span.error-text', 1); |
186 test_field ('text div.error', 'id_file', 'file', 0, 'Upload XML file', true); |
186 test_field ('text div.error', 'id_file', 'file', 0, 'Upload XML file', true); |
187 test_match ('#text div.help_text:eq(0) span.error-text:eq(0)', /You should specify a file to upload/m); |
187 test_match ('#text div.help_text:eq(0) span.error-text:eq(0)', /You should specify a file to upload/m); |
188 }); |
188 }); |
189 |
189 |
190 suite.skip ('create texts', function () { |
190 suite ('create texts', function () { |
191 /* for (var j=4; j--;) |
191 for (var j=4; j--;) |
192 for (var i=3; i--;) |
192 for (var i=3; i--;) |
193 create_text (i);*/ |
193 create_text (i); |
194 }); |
194 }); |
195 |
195 |
196 // check that public texts still worwhile unlogged |
196 // check that public texts still worwhile unlogged |
197 // check that non public texts are unavailable |
197 // check that non public texts are unavailable |
198 // Are the public texts displayed in the login page ? |
198 // Are the public texts displayed in the login page ? |
205 // tester l'affichage d'un texte |
205 // tester l'affichage d'un texte |
206 // tester que : #textcontainer.custom h1 font: Test_Sopinspace_custom_titles_font |
206 // tester que : #textcontainer.custom h1 font: Test_Sopinspace_custom_titles_font |
207 // tester que si Text preferences -> custom -> #textcontainer.custom font: Test_Sopinspace_custom_font |
207 // tester que si Text preferences -> custom -> #textcontainer.custom font: Test_Sopinspace_custom_font |
208 // #textcontainer #add_comment_btn span -> #textcontainer font-family: Test_Sopinspace |
208 // #textcontainer #add_comment_btn span -> #textcontainer font-family: Test_Sopinspace |
209 |
209 |
210 suite ('texts list page conformity', function () { |
210 suite.skip ('texts list page conformity', function () { |
211 test_page_loading ('/text/', 'Texts\n - '+c['#id_workspace_name']); |
211 test_page_loading ('/text/', 'Texts\n - '+c['#id_workspace_name']); |
212 test_logged_header (w.USER_ADMIN); |
212 test_logged_header (w.USER_ADMIN); |
213 test_default_tabs (t.text_nb, t.user_nb); |
213 test_default_tabs (t.text_nb, t.user_nb); |
214 test_count ('#text ul.sub_list:eq(0) a', 3); |
214 test_count ('#text ul.sub_list:eq(0) a', 3); |
215 test_text ('#text ul.sub_list:eq(0) a:eq(0)[href="/create/content/"]', 'Create a text'); |
215 test_text ('#text ul.sub_list:eq(0) a:eq(0)[href="/create/content/"]', 'Create a text'); |
250 test_match ('#paginator', /\s\(paginate\)\s/m); |
250 test_match ('#paginator', /\s\(paginate\)\s/m); |
251 test_count ('#texts_form :input', t.text_nb + 3); |
251 test_count ('#texts_form :input', t.text_nb + 3); |
252 test_click ('#paginator a:eq(0)[href="?paginate=&page=1"]'); |
252 test_click ('#paginator a:eq(0)[href="?paginate=&page=1"]'); |
253 test_count ('#texts_form :input', (t.text_nb < 10 ? t.text_nb : 10) + 3); |
253 test_count ('#texts_form :input', (t.text_nb < 10 ? t.text_nb : 10) + 3); |
254 test_match ('#paginator', new RegExp ('\\s1-10 of '+t.text_nb+'\\s','m')); |
254 test_match ('#paginator', new RegExp ('\\s1-10 of '+t.text_nb+'\\s','m')); |
255 |
|
256 // TOTEST : Bulk Actions -> Apply does enable |
|
257 // TOTEST : unitary delete |
|
258 test_page_loading ('/text/', 'Texts\n - '+c['#id_workspace_name']); |
255 test_page_loading ('/text/', 'Texts\n - '+c['#id_workspace_name']); |
259 test_text ('select#bulk_actions option:eq(0)[selected][value="-1"]', 'Bulk Actions', non_visible); |
256 test_text ('select#bulk_actions option:eq(0)[selected][value="-1"]', 'Bulk Actions', non_visible); |
260 test_text ('select#bulk_actions option:eq(1)[value="delete"]', 'Delete', non_visible); |
257 test_text ('select#bulk_actions option:eq(1)[value="delete"]', 'Delete', non_visible); |
261 test_val ('form#texts_form input#apply[type=button][disabled]', 'Apply'); |
258 test_val ('form#texts_form input#apply[type=button][disabled]', 'Apply'); |
262 test_count ('table.large_table:eq(1) th', 6); |
259 test_count ('table.large_table:eq(1) th', 6); |
264 test_text ('table.large_table:eq(1) th:eq(1) a[href="?order=title"]', 'Text'); |
261 test_text ('table.large_table:eq(1) th:eq(1) a[href="?order=title"]', 'Text'); |
265 test_text ('table.large_table:eq(1) th:eq(2)', 'Author'); |
262 test_text ('table.large_table:eq(1) th:eq(2)', 'Author'); |
266 test_text ('table.large_table:eq(1) th:eq(3) a[href="?order=-modified"]', 'Modified'); |
263 test_text ('table.large_table:eq(1) th:eq(3) a[href="?order=-modified"]', 'Modified'); |
267 test_text ('table.large_table:eq(1) th:eq(4)', '# comments'); |
264 test_text ('table.large_table:eq(1) th:eq(4)', '# comments'); |
268 test_text ('table.large_table:eq(1) th:eq(5)', 'Last week activity'); |
265 test_text ('table.large_table:eq(1) th:eq(5)', 'Last week activity'); |
|
266 test_page_loading ('/text/?page=2', 'Texts\n - '+c['#id_workspace_name']); |
|
267 test ('choose bulk action Delete', dsl(function () { input ('#bulk_actions').option ('delete'); })); |
|
268 test_click ('#all_check'); |
|
269 test_count ('form#texts_form input:checked', t.text_nb % 10 + 1); |
|
270 test_val ('form#texts_form input#apply[type=button]:not([disabled])', 'Apply'); |
|
271 // test_click ('#texts_form #apply'); |
|
272 test ('submit #texts_form without confirm dialog', dsl(function(){form("#texts_form").submit();})); |
|
273 test_page_loading ('/text/', 'Texts\n - '+c['#id_workspace_name']); |
|
274 // t.text_nb -= 2; |
|
275 test_count ('form#texts_form :input', t.text_nb + 3); |
|
276 test_match ('#paginator', new RegExp ('\\s1-10 of '+t.text_nb+'\\s','m')); |
|
277 // TOTEST : unitary delete |
|
278 |
269 test_unlogged_footer (); |
279 test_unlogged_footer (); |
270 }); |
280 }); |
271 |
281 |
272 suite ('edit profile page conformity', function () { |
282 suite ('edit profile page conformity', function () { |
273 test_page_loading ('/profile/', 'Your profile [(]'+w.USER_ADMIN+'[)]\n - '+c['#id_workspace_name']); |
283 test_page_loading ('/profile/', 'Your profile [(]'+w.USER_ADMIN+'[)]\n - '+c['#id_workspace_name']); |