forked from hockic/bootstrap-wysihtml5
-
Notifications
You must be signed in to change notification settings - Fork 111
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Updated tests to wysihtml5 0.4.9. Fixes #57
- Loading branch information
1 parent
137bf14
commit 852e4e0
Showing
9 changed files
with
234 additions
and
25 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
module("wysihtml5.dom.domNode", { | ||
setup: function() { | ||
this.container = document.createElement("div"); | ||
} | ||
}); | ||
|
||
test("Simple .prev() test", function() { | ||
this.container.innerHTML = "<span></span><div></div>"; | ||
var lastItem = this.container.querySelector("div"), | ||
firstItem = this.container.querySelector("span"); | ||
equal(wysihtml5.dom.domNode(lastItem).prev(), firstItem); | ||
}); | ||
|
||
test(".prev() test with textnode in between", function() { | ||
this.container.innerHTML = "<span></span> confusing text node <div></div>"; | ||
var lastItem = this.container.querySelector("div"), | ||
firstItem = this.container.querySelector("span"); | ||
equal(wysihtml5.dom.domNode(lastItem).prev({nodeTypes: [1]}), firstItem); | ||
}); | ||
|
||
test(".prev() test if no prev element exists", function() { | ||
this.container.innerHTML = "<div></div>"; | ||
var lastItem = this.container.querySelector("div"); | ||
equal(wysihtml5.dom.domNode(lastItem).prev(), null); | ||
}); | ||
|
||
test(".prev() test if no prev element exists with textnode", function() { | ||
this.container.innerHTML = "confusing text node <div></div>"; | ||
var lastItem = this.container.querySelector("div"); | ||
equal(wysihtml5.dom.domNode(lastItem).prev({nodeTypes: [1]}), null); | ||
}); | ||
|
||
test(".prev() test with empty textnode in between and ignoreBlankTexts", function() { | ||
this.container.innerHTML = "<span></span> <div></div>"; | ||
var lastItem = this.container.querySelector("div"), | ||
firstItem = this.container.querySelector("span"); | ||
equal(wysihtml5.dom.domNode(lastItem).prev({ignoreBlankTexts: true}), firstItem); | ||
}); | ||
|
||
test("Simple .next() test", function() { | ||
this.container.innerHTML = "<div></div><span></span>"; | ||
var firstItem = this.container.querySelector("div"), | ||
lastItem = this.container.querySelector("span"); | ||
equal(wysihtml5.dom.domNode(firstItem).next(), lastItem); | ||
}); | ||
|
||
test(".next() test with textnode in between", function() { | ||
this.container.innerHTML = "<div></div> confusing text node <span></span>"; | ||
var firstItem = this.container.querySelector("div"), | ||
lastItem = this.container.querySelector("span"); | ||
equal(wysihtml5.dom.domNode(firstItem).next({nodeTypes: [1]}), lastItem); | ||
}); | ||
|
||
test(".next() test if no next element exists", function() { | ||
this.container.innerHTML = "<div></div>"; | ||
var lastItem = this.container.querySelector("div"); | ||
equal(wysihtml5.dom.domNode(lastItem).next(), null); | ||
}); | ||
|
||
test(".next() test if no next element exists with textnode", function() { | ||
this.container.innerHTML = "<div></div> confusing text node "; | ||
var lastItem = this.container.querySelector("div"); | ||
equal(wysihtml5.dom.domNode(lastItem).next({nodeTypes: [1]}), null); | ||
}); | ||
|
||
test(".next() test with empty textnode in between and ignoreBlankTexts", function() { | ||
this.container.innerHTML = "<div></div> <span></span>"; | ||
var firstItem = this.container.querySelector("div"), | ||
lastItem = this.container.querySelector("span"); | ||
equal(wysihtml5.dom.domNode(firstItem).next({ignoreBlankTexts: true}), lastItem); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
module("wysihtml5.dom.unwrap", { | ||
setup: function() { | ||
this.inner = "<span>test</span><p>tes2</p>"; | ||
this.container = document.createElement("div"); | ||
this.containerInner = document.createElement("div"); | ||
this.containerInner.innerHTML = this.inner; | ||
this.container.appendChild(this.containerInner); | ||
} | ||
}); | ||
|
||
test("Basic test", function() { | ||
wysihtml5.dom.unwrap(this.containerInner); | ||
equal(this.container.innerHTML, this.inner, "Unwrapping element works splendid."); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters