autosubmit.js 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. /**
  2. * Created by wangrui10 on 14-6-4.
  3. */
  4. module('plugins.autosubmit');
  5. test("自动提交",function(){
  6. var form = document.body.appendChild(document.createElement('form'));
  7. form.id = 'formid';
  8. form.action = './';
  9. form.method = "post";
  10. form.target = '_blank';
  11. var text = document.createElement('input');
  12. text.type = 'text';
  13. form.appendChild(text);
  14. var btn = document.createElement('input');
  15. btn.type = 'submit';
  16. form.appendChild(btn);
  17. var div = form.appendChild(document.createElement('div'));
  18. div.id = 'ue';
  19. var editor = UE.getEditor('ue');
  20. editor.ready(function(){
  21. editor.body.innerHTML='123123';
  22. editor.focus();
  23. editor.execCommand('autosubmit');
  24. form = domUtils.findParentByTagName(this.iframe,"form", false);
  25. setTimeout(function(){
  26. equal(editor.textarea.value,'123123','检查editor中准备同步的内容');
  27. var d = $('#'+form.id).context.forms.formid[2].value;
  28. equal(d,'123123','editor中的内容同步到textarea中');
  29. start();
  30. },100);
  31. });
  32. stop();
  33. });