def test_has_css_class(self): element = Element("div") element.add_css_classes("foo") assert_false(element.has_css_class("bar")) element.add_css_classes("bar") assert_true(element.has_css_class("bar")) element.remove_css_classes("bar") assert_false(element.has_css_class("bar"))
def test_add_multiple_css_classes(self): element = Element("div") element.add_css_classes("foo", "bar", "baz") element.add_css_classes("bar") matches = re.search(r'class="(.*)"', str(element)) css_classes = matches.group(1).split(" ") css_classes.sort() assert_equal(["bar", "baz", "foo"], css_classes)
def test_add_multiple_css_classes(self): element = Element("div") element.add_css_classes("foo", "bar", "baz") element.add_css_classes("bar") matches = re.search(r'class="(.*)"', str(element)) assert matches is not None css_classes = matches.group(1).split(" ") assert_equal(["bar", "baz", "foo"], css_classes)
def test_remove_css_classes(self): element = Element("div") element.add_css_classes("foo", "bar", "baz") element.remove_css_classes("bar", "xxx") matches = re.search(r'class="(.*)"', str(element)) css_classes = matches.group(1).split(" ") css_classes.sort() assert_equal(["baz", "foo"], css_classes)
def test_remove_css_classes(self): element = Element("div") element.add_css_classes("foo", "bar", "baz") element.remove_css_classes("bar", "xxx") matches = re.search(r'class="(.*)"', str(element)) assert matches is not None css_classes = matches.group(1).split(" ") css_classes.sort() assert_equal(["baz", "foo"], css_classes)
def test_add_one_css_classes(self): element = Element("div") element.add_css_classes("foo") assert_equal([b'<div class="foo">', b"</div>"], list(iter(element)))
def test_add_one_css_classes(self): element = Element("div") element.add_css_classes("foo") assert_equal([b'<div class="foo">', b'</div>'], list(iter(element)))