diff --git a/test/editor_commands_test.js b/test/editor_commands_test.js
index c26ad93..19a4ec4 100644
--- a/test/editor_commands_test.js
+++ b/test/editor_commands_test.js
@@ -252,6 +252,86 @@ if (wysihtml5.browser.supported()) {
});
});
+ asyncTest("Create link with class", function() {
+ expect(1);
+
+ var that = this,
+ text = "text",
+ editor = new wysihtml5.Editor(this.editableArea1,
+ {
+ parserRules: {
+ classes: { 'mytxtlink': 1 },
+ tags: { 'a':
+ { 'set_class': 'mytxtlink' }
+ }
+ }
+ });
+
+ editor.on("load", function() {
+ var editableElement = that.editableArea1;
+ editor.setValue(text, true);
+ editor.composer.selection.selectNode(editor.editableElement);
+ // Create
+ editor.composer.commands.exec('createLink', {
+ "href": "http://test.com", "title": "test"
+ });
+ that.equal(editableElement.innerHTML.toLowerCase(), '' + text + '', "Link added with class correctly");
+
+ start();
+ });
+ });
+
+
+
+ // insertImage
+ asyncTest("Insert image", function() {
+ expect(1);
+
+ var that = this,
+ editor = new wysihtml5.Editor(this.editableArea1);
+
+ editor.on("load", function() {
+ var editableElement = that.editableArea1;
+ editor.setValue('', true);
+ editor.composer.selection.selectNode(editor.editableElement);
+ // Create
+ editor.composer.commands.exec('insertImage', {
+ "src": "http://test.com/test.png"
+ });
+ that.equal(editableElement.innerHTML.toLowerCase(), '
', "Image added correctly");
+
+ start();
+ });
+ });
+
+ asyncTest("Insert image with class", function() {
+ expect(1);
+
+ var that = this,
+ editor = new wysihtml5.Editor(this.editableArea1,
+ {
+ parserRules: {
+ classes: { 'mytxtimg': 1 },
+ tags: { 'img':
+ { 'set_class': 'mytxtimg' }
+ }
+ }
+ });
+
+ editor.on("load", function() {
+ var editableElement = that.editableArea1;
+ editor.setValue('', true);
+ editor.composer.selection.selectNode(editor.editableElement);
+ // Create
+ editor.composer.commands.exec('insertImage', "http://test.com/test.png");
+ that.equal(editableElement.innerHTML.toLowerCase(), '
', "Image added with class correctly");
+
+ start();
+ });
+ });
+
+
+
// create table
asyncTest("Create table", function() {
expect(1);
@@ -379,4 +459,4 @@ if (wysihtml5.browser.supported()) {
-}
\ No newline at end of file
+}