PageRenderTime 65ms CodeModel.GetById 36ms RepoModel.GetById 0ms app.codeStats 0ms

/public/javascripts/tinymce/tests/plugins/fullpage.html

https://github.com/ElectronicaGitHub/qqwe
HTML | 112 lines | 95 code | 17 blank | 0 comment | 0 complexity | 3d004e746dbad9a243304439b2326313 MD5 | raw file
Possible License(s): MIT, Apache-2.0, BSD-3-Clause
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <title>Fullpage plugin tests</title>
  5. <link rel="stylesheet" href="http://code.jquery.com/qunit/qunit-git.css" type="text/css" />
  6. <script src="http://code.jquery.com/qunit/qunit-git.js"></script>
  7. <script src="../js/qunit/reporter.js"></script>
  8. <script src="../js/utils.js"></script>
  9. <script src="../js/tinymce_loader.js"></script>
  10. <script>
  11. var editor;
  12. QUnit.config.reorder = false;
  13. QUnit.config.autostart = false;
  14. module("Fullpage plugin", {
  15. autostart: false,
  16. teardown: function() {
  17. editor.getBody().dir = 'ltr';
  18. }
  19. });
  20. function normalizeHTML(html) {
  21. return html.replace(/\s/g, '');
  22. }
  23. test('Keep header/footer intact', function() {
  24. expect(2);
  25. editor.setContent('<html><body><p>Test</p>');
  26. equal(normalizeHTML(editor.getContent()), '<html><body><p>Test</p>', 'Invalid HTML content is still editable.');
  27. editor.setContent('<html><body><p>Test</p></body></html>');
  28. equal(normalizeHTML(editor.getContent()), '<html><body><p>Test</p></body></html>', 'Header/footer is intact.');
  29. });
  30. test('Default header/footer', function() {
  31. expect(1);
  32. editor.setContent('<p>Test</p>');
  33. equal(editor.getContent(), '<!DOCTYPE html>\n<html>\n<head>\n</head>\n<body>\n<p>Test</p>\n</body>\n</html>', 'Invalid HTML content is still editable.');
  34. });
  35. test('Parse body attributes', function() {
  36. expect(9);
  37. editor.setContent('<html><body><p>Test</p></body></html>');
  38. equal(editor.getBody().style.color, '', 'No color on body.');
  39. equal(editor.getBody().dir, '', 'No dir on body.');
  40. equal(editor.dom.getStyle(editor.getBody().firstChild, 'display', true), 'block', 'No styles added to iframe document');
  41. editor.setContent('<html><body style="color:#FF0000"><p>Test</p></body></html>');
  42. ok(editor.getBody().style.color.length > 0, 'Color added to body');
  43. editor.setContent('<html><body dir="rtl"><p>Test</p></body></html>');
  44. equal(editor.getBody().dir, 'rtl', 'Dir added to body');
  45. editor.setContent('<html><head><style>p {text-align:right}</style></head><body dir="rtl"><p>Test</p></body></html>');
  46. equal(editor.dom.getStyle(editor.getBody().firstChild, 'text-align', true), 'right', 'Styles added to iframe document');
  47. editor.setContent('<html><body><p>Test</p></body></html>');
  48. equal(editor.getBody().style.color, '', 'No color on body.');
  49. equal(editor.getBody().dir, '', 'No dir on body.');
  50. equal(editor.dom.getStyle(editor.getBody().firstChild, 'display', true), 'block', 'No styles added to iframe document');
  51. });
  52. test('fullpage_hide_in_source_view: false', function() {
  53. editor.settings.fullpage_hide_in_source_view = false;
  54. editor.setContent('<html><body><p>1</p></body></html>');
  55. equal(editor.getContent({source_view: true}), '<html><body>\n<p>1</p>\n</body></html>');
  56. });
  57. test('fullpage_hide_in_source_view: false', function() {
  58. editor.settings.fullpage_hide_in_source_view = true;
  59. editor.setContent('<html><body><p>1</p></body></html>');
  60. equal(editor.getContent({source_view: true}), '<p>1</p>');
  61. });
  62. tinymce.init({
  63. mode : "exact",
  64. elements : "elm1",
  65. plugins : "fullpage",
  66. add_unload_trigger : false,
  67. valid_styles : {
  68. '*' : 'text-align,padding-left,color,font-size,font-family,background-color,font-weight,font-style,text-decoration,float,margin,margin-top,margin-right,margin-bottom,margin-left,display'
  69. },
  70. indent : 0,
  71. setup: function(ed) {
  72. ed.on('NodeChange', false);
  73. },
  74. init_instance_callback : function(ed) {
  75. editor = ed;
  76. QUnit.start();
  77. }
  78. });
  79. </script>
  80. </head>
  81. <body>
  82. <h1 id="qunit-header">Fullpage plugin tests</h1>
  83. <h2 id="qunit-banner"></h2>
  84. <div id="qunit-testrunner-toolbar"></div>
  85. <h2 id="qunit-userAgent"></h2>
  86. <ol id="qunit-tests"></ol>
  87. <div id="content">
  88. <textarea id="elm1" name="elm1"></textarea>
  89. <div>
  90. <a href="javascript:alert(tinymce.EditorManager.get('elm1').getContent({format : 'raw'}));">[getRawContents]</a>
  91. <a href="javascript:alert(tinymce.EditorManager.get('elm1').getContent());">[getContents]</a>
  92. </div>
  93. </div>
  94. </body>
  95. </html>