本文整理汇总了Python中blowdrycss.breakpointparser.BreakpointParser.css_for_only方法的典型用法代码示例。如果您正苦于以下问题:Python BreakpointParser.css_for_only方法的具体用法?Python BreakpointParser.css_for_only怎么用?Python BreakpointParser.css_for_only使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类blowdrycss.breakpointparser.BreakpointParser
的用法示例。
在下文中一共展示了BreakpointParser.css_for_only方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_css_for_only_wrong_limit_key
# 需要导入模块: from blowdrycss.breakpointparser import BreakpointParser [as 别名]
# 或者: from blowdrycss.breakpointparser.BreakpointParser import css_for_only [as 别名]
def test_css_for_only_wrong_limit_key(self):
css_class = 'padding-100-large-only'
name = 'padding'
value = px_to_em('100')
expected = ''
css_property = Property(name=name, value=value, priority='')
breakpoint_parser = BreakpointParser(css_class=css_class, css_property=css_property)
breakpoint_parser.limit_key = '-up' # Change to WRONG LIMIT KEY
css = breakpoint_parser.css_for_only()
self.assertEqual(css, expected)
示例2: test_css_for_only_general_usage
# 需要导入模块: from blowdrycss.breakpointparser import BreakpointParser [as 别名]
# 或者: from blowdrycss.breakpointparser.BreakpointParser import css_for_only [as 别名]
def test_css_for_only_general_usage(self):
css_class = 'padding-100-large-only'
name = 'padding'
value = px_to_em('100')
expected = (
'@media only screen and (min-width: 45.0625em) and (max-width: 64.0em) {\n' +
'\t.padding-100-large-only {\n' +
'\t\tpadding: 6.25em;\n' +
'\t}\n' +
'}\n\n'
)
css_property = Property(name=name, value=value, priority='')
breakpoint_parser = BreakpointParser(css_class=css_class, css_property=css_property)
css = breakpoint_parser.css_for_only()
self.assertEqual(css, expected)
示例3: test_css_for_only_display_shorthand
# 需要导入模块: from blowdrycss.breakpointparser import BreakpointParser [as 别名]
# 或者: from blowdrycss.breakpointparser.BreakpointParser import css_for_only [as 别名]
def test_css_for_only_display_shorthand(self):
css_class = 'large-only'
name = 'display'
value = 'none'
expected = (
'@media only screen and (max-width: 45.0625em) {\n' +
'\t.large-only {\n' +
'\t\tdisplay: none;\n' +
'\t}\n' +
'}\n\n' +
'@media only screen and (min-width: 64.0em) {\n' +
'\t.large-only {\n' +
'\t\tdisplay: none;\n' +
'\t}\n' +
'}\n\n'
)
css_property = Property(name=name, value=value, priority='')
breakpoint_parser = BreakpointParser(css_class=css_class, css_property=css_property)
css = breakpoint_parser.css_for_only()
self.assertEqual(css, expected)