TabsManager.py Added unit tests + documentation
This commit is contained in:
@@ -1,12 +1,10 @@
|
||||
import pytest
|
||||
from fastcore.basics import NotStr
|
||||
from fasthtml.components import *
|
||||
|
||||
from myfasthtml.controls.helpers import mk
|
||||
from myfasthtml.core.commands import Command
|
||||
from myfasthtml.icons.fluent_p3 import add20_regular
|
||||
from myfasthtml.test.matcher import matches, StartsWith, Contains, DoesNotContain, Empty, ErrorOutput, \
|
||||
ErrorComparisonOutput, AttributeForbidden, AnyValue, NoChildren, TestObject, Skip, DoNotCheck, TestIcon, HasHtmx
|
||||
from myfasthtml.test.matcher import *
|
||||
from myfasthtml.test.testclient import MyFT
|
||||
|
||||
|
||||
@@ -468,3 +466,16 @@ class TestPredicates:
|
||||
c = Command("c", "testing has_htmx", None)
|
||||
c.bind_ft(div)
|
||||
assert HasHtmx(command=c).validate(div)
|
||||
|
||||
def test_i_can_use_and(self):
|
||||
contains1 = Contains("value1")
|
||||
contains2 = Contains("value2")
|
||||
not_contains1 = DoesNotContain("value1")
|
||||
not_contains2 = DoesNotContain("value2")
|
||||
|
||||
assert And(contains1, contains2).validate("value1 value2")
|
||||
assert And(contains1, not_contains2).validate("value1")
|
||||
assert And(not_contains1, contains2).validate("value2")
|
||||
assert And(not_contains1, not_contains2).validate("value3")
|
||||
|
||||
assert not And(contains1, not_contains2).validate("value2")
|
||||
|
||||
Reference in New Issue
Block a user