diff options
author | Jacob Thornton <jacobthornton@gmail.com> | 2012-04-05 01:58:04 +0400 |
---|---|---|
committer | Jacob Thornton <jacobthornton@gmail.com> | 2012-04-05 01:58:04 +0400 |
commit | 4bd611884a5f1dd02878f73bccd51d85c1e49186 (patch) | |
tree | 524cdf0b5618f1e8de7c878129d754af63ebf243 /js/tests/unit/bootstrap-tooltip.js | |
parent | 2dc979a2029d909945011a8e6dac3543aa9f0198 (diff) |
detect if title in tooltip is text or html. if text - use `text` method to prevent xss.
all add a few notes to js readme about updated event
Diffstat (limited to 'js/tests/unit/bootstrap-tooltip.js')
-rw-r--r-- | js/tests/unit/bootstrap-tooltip.js | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/js/tests/unit/bootstrap-tooltip.js b/js/tests/unit/bootstrap-tooltip.js index 8543162c6a..f6e00089b1 100644 --- a/js/tests/unit/bootstrap-tooltip.js +++ b/js/tests/unit/bootstrap-tooltip.js @@ -59,4 +59,28 @@ $(function () { ok(!$(".tooltip").length, 'tooltip removed') }) + test("should detect if title string is html or text: foo", function () { + ok(!$.fn.tooltip.Constructor.prototype.isHTML('foo'), 'correctly detected html') + }) + + test("should detect if title string is html or text: &lt;foo&gt;", function () { + ok(!$.fn.tooltip.Constructor.prototype.isHTML('<foo>'), 'correctly detected html') + }) + + test("should detect if title string is html or text: <div>foo</div>", function () { + ok($.fn.tooltip.Constructor.prototype.isHTML('<div>foo</div>'), 'correctly detected html') + }) + + test("should detect if title string is html or text: asdfa<div>foo</div>asdfasdf", function () { + ok($.fn.tooltip.Constructor.prototype.isHTML('asdfa<div>foo</div>asdfasdf'), 'correctly detected html') + }) + + test("should detect if title string is html or text: document.createElement('div')", function () { + ok($.fn.tooltip.Constructor.prototype.isHTML(document.createElement('div')), 'correctly detected html') + }) + + test("should detect if title string is html or text: $('<div />)", function () { + ok($.fn.tooltip.Constructor.prototype.isHTML($('<div></div>')), 'correctly detected html') + }) + })
\ No newline at end of file |