2 // " Vim settings |
2 // " Vim settings |
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 long_text = ''; |
|
8 |
|
9 for (var i = 20; i--;) |
|
10 long_text += 'Contenu du troisième texte.<br/>Sur <b>plusieurs</b> lignes<br/>'; |
|
11 |
|
12 const ctexts = [ |
|
13 { |
|
14 '#id_title': 'Text One Sopinspace-Test éléguant', |
|
15 '#id_format': 'markdown', |
|
16 '#id_content': 'Contenu du premier texte.\nSur plusieurs lignes\nPour tester un cas réaliste', |
|
17 '#id_tags': 'test_text, Text Premier' |
|
18 }, |
|
19 { |
|
20 '#id_title': 'Text Two Sopinspace-Test éléguant', |
|
21 '#id_format': 'rst', |
|
22 '#id_content': 'Contenu du deuxième texte.\nSur plusieurs lignes aussi\nPour tester un cas réaliste', |
|
23 '#id_tags': 'test_text, Text Second' |
|
24 }, |
|
25 { |
|
26 '#id_title': 'Text Three Sopinspace-Test éléguant', |
|
27 '#id_format': 'html', |
|
28 '#id_content': long_text, |
|
29 '#id_tags': 'test_text, Text Troisième' |
|
30 } |
|
31 ]; |
|
32 |
7 |
33 suite ('comt admin text list', function () { |
8 suite ('comt admin text list', function () { |
34 |
9 |
35 this.timeout(200000); |
10 this.timeout(200000); |
36 |
11 |
47 }); |
22 }); |
48 |
23 |
49 suite ('create texts', function () { |
24 suite ('create texts', function () { |
50 for (var j=4; j--;) |
25 for (var j=4; j--;) |
51 for (var i=3; i--;) |
26 for (var i=3; i--;) |
52 test_comt_create_text (ctexts[i]); |
27 test_comt_create_text (C.TEXTS[i]); |
53 }); |
28 }); |
54 |
29 |
55 suite ('texts list page conformity', function () { |
30 suite ('texts list page conformity', function () { |
56 test_page_loading ('/text/', 'Texts\n - '+C['#id_workspace_name']); |
31 test_page_loading ('/text/', 'Texts\n - '+C['#id_workspace_name']); |
57 test_comt_logged_header (C.W.USER_ADMIN); |
32 test_comt_logged_header (C.W.USER_ADMIN); |
79 test_page_loading ('/text/?tag_selected=Text+Troisième', 'Texts\n - '+C['#id_workspace_name']); |
54 test_page_loading ('/text/?tag_selected=Text+Troisième', 'Texts\n - '+C['#id_workspace_name']); |
80 test_count ('#texts_form :input', 4 + 3); |
55 test_count ('#texts_form :input', 4 + 3); |
81 test_match ('#paginator', /\s1-4 of 4\s/m); |
56 test_match ('#paginator', /\s1-4 of 4\s/m); |
82 |
57 |
83 for (var i=4; i--;) { |
58 for (var i=4; i--;) { |
84 test_text ('a.main_object_title:eq('+i+')', ctexts[2]['#id_title']); |
59 test_text ('a.main_object_title:eq('+i+')', C.TEXTS[2]['#id_title']); |
85 test_match ('.tag_list:eq('+i+')', /tags: test_text Text Troisième /); |
60 test_match ('.tag_list:eq('+i+')', /tags: test_text Text Troisième /); |
86 test_text ('.tag_list:eq('+i+') a:eq(0)[href="?tag_selected=test_text"]', 'test_text'); |
61 test_text ('.tag_list:eq('+i+') a:eq(0)[href="?tag_selected=test_text"]', 'test_text'); |
87 test_text ('.tag_list:eq('+i+') a:eq(1)[href="?tag_selected=Text+Troisi%C3%A8me"]','Text Troisième'); |
62 test_text ('.tag_list:eq('+i+') a:eq(1)[href="?tag_selected=Text+Troisi%C3%A8me"]','Text Troisième'); |
88 test_text ('#text .hidden-text-actions:eq('+i+') a:eq(0)[href^="/text/"][href$="/view/"]', 'View'); |
63 test_text ('#text .hidden-text-actions:eq('+i+') a:eq(0)[href^="/text/"][href$="/view/"]', 'View'); |
89 test_text ('#text .hidden-text-actions:eq('+i+') a:eq(1)[href^="/text/"][href$="/edit/"]', 'Edit'); |
64 test_text ('#text .hidden-text-actions:eq('+i+') a:eq(1)[href^="/text/"][href$="/edit/"]', 'Edit'); |