def test_css_with(self): css = CSS() with css.selector(".home") as selector: selector.append(Style("a", "b")) selector.append(Style("c", "d")) self.assertEqual(css.render(), self.rendered_css)
def test_css_getattr(self): css = CSS() with css.selector(".home") as selector: selector.append(Style("a", "b")) selector.append(Style("c", "d")) self.assertEqual(css.cls_home.styles[0], Style("a", "b"))
def test_css_auto_add_different_selector_name_error(self): css = CSS() DARWCSS_AUTO = True DARWCSS_SELECTOR = "test" with css.selector(".home") as selector: with self.assertRaises(NameError): Style("a", "b")
def test_css_auto_add(self): css = CSS() DARWCSS_AUTO = True with css.selector(".home") as selector: Style("a", "b") Style("c", "d") self.assertEqual(css.render(), self.rendered_css)
def test_css_auto_add_different_selector(self): css = CSS() DARWCSS_AUTO = True DARWCSS_SELECTOR = "test" with css.selector(".home") as test: Style("a", "b") Style("c", "d") self.assertEqual(css.render(), self.rendered_css)
def test_conf_inheritance_selector(self): css = CSS({"darwcss_auto": True}) with css.selector('.home') as selector: self.assertEqual(selector.meta_cfg, {"darwcss_auto": True})