Вход Регистрация
Файл: module-assets/admin/wysihtml5/test/incompatible_test.js
Строк: 91
<?php
module
("wysihtml5 - Incompatible", {
  
setup: function() {
    
this.originalSupportCheck wysihtml5.browser.supported;
    
wysihtml5.browser.supported = function() { return false; };

    
this.textareaElement document.createElement("textarea");
    
document.body.appendChild(this.textareaElement);
  },

  
teardown: function() {
    
wysihtml5.browser.supported this.originalSupportCheck;
    
this.textareaElement.parentNode.removeChild(this.textareaElement);
  }
});


asyncTest("Basic test", function() {
  
expect(12);

  var 
that this;

  var 
oldIframesLength document.getElementsByTagName("iframe").length;

  var 
oldInputsLength document.getElementsByTagName("input").length;

  
// var editor = new wysihtml5.Editor(this.textareaElement);
  
$(this.textareaElement).wysihtml5({ linkfalseimagefalse });
  var 
editor = $(this.textareaElement).data('wysihtml5').editor;

  
editor.observe("load", function() {
    
ok(true"'load' event correctly triggered");
    
ok(!wysihtml5.dom.hasClass(document.body"wysihtml5-supported"), "<body> didn't receive the 'wysihtml5-supported' class");
    
ok(!editor.isCompatible(), "isCompatible returns false when rich text editing is not correctly supported in the current browser");
    
equal(that.textareaElement.style.display"""Textarea is visible");
    
ok(!editor.composer"Composer not initialized");

    
equal(document.getElementsByTagName("iframe").lengtholdIframesLength"No hidden field has been inserted into the dom");
    
equal(document.getElementsByTagName("input").length,  oldInputsLength,  "Composer not initialized");

    var 
html "foobar<br>";
    
editor.setValue(html);
    
equal(that.textareaElement.valuehtml);
    
equal(editor.getValue(), html);
    
editor.clear();
    
equal(that.textareaElement.value"");

    
editor.observe("focus", function() {
      
ok(true"Generic 'focus' event fired");
    });

    
editor.observe("focus:textarea", function() {
      
ok(true"Specific 'focus:textarea' event fired");
    });

    
editor.observe("focus:composer", function() {
      
ok(false"Specific 'focus:composer' event fired, and that's wrong, there shouldn't be a composer element/view");
    });

    
QUnit.triggerEvent(that.textareaElementwysihtml5.browser.supportsEvent("focusin") ? "focusin" "focus");

    
start();
  });
});
?>
Онлайн: 2
Реклама