-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
added tests for the tooltips module, back to 100% coverage
- Loading branch information
Showing
1 changed file
with
59 additions
and
0 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,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" | ||
} |