Skip to content

Commit

Permalink
added tests for the tooltips module, back to 100% coverage
Browse files Browse the repository at this point in the history
  • Loading branch information
volfpeter committed Jun 17, 2019
1 parent 3ceb8da commit 9f58ef7
Showing 1 changed file with 59 additions and 0 deletions.
59 changes: 59 additions & 0 deletions test/test_tooltips.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
from markyp_bootstrap4.tooltips import *

def test_enable_tooltips():
assert enable_tooltips.markup == "\n".join((
"<script >",
"$(function () { $('[data-toggle=\"tooltip\"]').tooltip() })",
"</script>"
))

def test_Placement():
assert Placement.TOP == "top"
assert Placement.BOTTOM == "bottom"
assert Placement.LEFT == "left"
assert Placement.RIGHT == "right"

def test_tooltip():
assert tooltip("Title") == {
"title": "Title",
"data-toggle": "tooltip",
"data-placement": "top"
}

assert tooltip("<h1>Title</h1>") == {
"title": "<h1>Title</h1>",
"data-toggle": "tooltip",
"data-placement": "top"
}

assert tooltip("Title", placement=Placement.TOP) == {
"title": "Title",
"data-toggle": "tooltip",
"data-placement": "top"
}

assert tooltip("Title", placement=Placement.BOTTOM) == {
"title": "Title",
"data-toggle": "tooltip",
"data-placement": "bottom"
}

assert tooltip("Title", placement=Placement.LEFT) == {
"title": "Title",
"data-toggle": "tooltip",
"data-placement": "left"
}

assert tooltip("Title", placement=Placement.RIGHT) == {
"title": "Title",
"data-toggle": "tooltip",
"data-placement": "right"
}

assert tooltip("Title", attr1=11, attr2=22) == {
"attr1": 11,
"attr2": 22,
"title": "Title",
"data-toggle": "tooltip",
"data-placement": "top"
}

0 comments on commit 9f58ef7

Please sign in to comment.