本文整理汇总了Python中draftjs_exporter.dom.DOM.render_debug方法的典型用法代码示例。如果您正苦于以下问题:Python DOM.render_debug方法的具体用法?Python DOM.render_debug怎么用?Python DOM.render_debug使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类draftjs_exporter.dom.DOM
的用法示例。
在下文中一共展示了DOM.render_debug方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_append_child
# 需要导入模块: from draftjs_exporter.dom import DOM [as 别名]
# 或者: from draftjs_exporter.dom.DOM import render_debug [as 别名]
def test_append_child(self):
parent = DOM.create_element('p')
DOM.append_child(parent, DOM.create_element('span', {}, 'Test text'))
self.assertEqual(DOM.render_debug(parent), '<p><span>Test text</span></p>')
示例2: test_render_debug
# 需要导入模块: from draftjs_exporter.dom import DOM [as 别名]
# 或者: from draftjs_exporter.dom.DOM import render_debug [as 别名]
def test_render_debug(self):
self.assertEqual(DOM.render_debug(
DOM.create_element('a', {}, DOM.create_element('span', {'class': 'file-info icon-text'}, DOM.create_element('span', {'class': 'icon-text__text'}, 'Test test'), DOM.create_element('svg', {'class': 'icon'}, DOM.create_element('use', {'xlink:href': '#icon-test'}))))
), '<a><span class="file-info icon-text"><span class="icon-text__text">Test test</span><svg class="icon"><use xlink:href="#icon-test"></use></svg></span></a>')
示例3: test_create_element_entity
# 需要导入模块: from draftjs_exporter.dom import DOM [as 别名]
# 或者: from draftjs_exporter.dom.DOM import render_debug [as 别名]
def test_create_element_entity(self):
self.assertEqual(DOM.render_debug(DOM.create_element(icon, {'name': 'rocket'})), '<svg class="icon"><use xlink:href="#icon-rocket"></use></svg>')
示例4: test_parse_html
# 需要导入模块: from draftjs_exporter.dom import DOM [as 别名]
# 或者: from draftjs_exporter.dom.DOM import render_debug [as 别名]
def test_parse_html(self):
self.assertEqual(DOM.render_debug(DOM.parse_html('<p><span>Test text</span></p>')), '<p><span>Test text</span></p>')
示例5: test_create_element_empty
# 需要导入模块: from draftjs_exporter.dom import DOM [as 别名]
# 或者: from draftjs_exporter.dom.DOM import render_debug [as 别名]
def test_create_element_empty(self):
self.assertEqual(DOM.render_debug(DOM.create_element()), '<fragment></fragment>')
示例6: test_create_element_none
# 需要导入模块: from draftjs_exporter.dom import DOM [as 别名]
# 或者: from draftjs_exporter.dom.DOM import render_debug [as 别名]
def test_create_element_none(self):
self.assertEqual(DOM.render_debug(DOM.create_element('a', {}, None, DOM.create_element('span', {}, 'Test test'))), '<a><span>Test test</span></a>')
示例7: test_create_element_style_dict
# 需要导入模块: from draftjs_exporter.dom import DOM [as 别名]
# 或者: from draftjs_exporter.dom.DOM import render_debug [as 别名]
def test_create_element_style_dict(self):
self.assertEqual(DOM.render_debug(DOM.create_element('p', {'style': {'borderColor': 'red', 'textDecoration': 'underline'}}, 'Test test')), '<p style="border-color: red;text-decoration: underline;">Test test</p>')
示例8: test_create_element_style_str
# 需要导入模块: from draftjs_exporter.dom import DOM [as 别名]
# 或者: from draftjs_exporter.dom.DOM import render_debug [as 别名]
def test_create_element_style_str(self):
self.assertEqual(DOM.render_debug(DOM.create_element('p', {'style': 'border-color: red;text-decoration: underline;'}, 'Test test')), '<p style="border-color: red;text-decoration: underline;">Test test</p>')
示例9: test_render_code_block
# 需要导入模块: from draftjs_exporter.dom import DOM [as 别名]
# 或者: from draftjs_exporter.dom.DOM import render_debug [as 别名]
def test_render_code_block(self):
self.assertEqual(DOM.render_debug(code_block({'children': 'test'})), '<pre><code>test</code></pre>')
示例10: test_create_element
# 需要导入模块: from draftjs_exporter.dom import DOM [as 别名]
# 或者: from draftjs_exporter.dom.DOM import render_debug [as 别名]
def test_create_element(self):
self.assertEqual(DOM.render_debug(DOM.create_element('p', {'class': 'intro'}, 'Test test')), '<p class="intro">Test test</p>')
示例11: test_render_styles_component_multiple_invert
# 需要导入模块: from draftjs_exporter.dom import DOM [as 别名]
# 或者: from draftjs_exporter.dom.DOM import render_debug [as 别名]
def test_render_styles_component_multiple_invert(self):
self.style_state.apply(Command('start_inline_style', 0, 'SHOUT'))
self.style_state.apply(Command('start_inline_style', 0, 'IMPORTANT'))
self.assertEqual(DOM.render_debug(self.style_state.render_styles('Test text', {}, [])), '<strong style="color: red;"><span style="text-transform: uppercase;">Test text</span></strong>')
self.style_state.apply(Command('stop_inline_style', 9, 'SHOUT'))
self.style_state.apply(Command('stop_inline_style', 9, 'IMPORTANT'))
示例12: test_render_styles_component
# 需要导入模块: from draftjs_exporter.dom import DOM [as 别名]
# 或者: from draftjs_exporter.dom.DOM import render_debug [as 别名]
def test_render_styles_component(self):
self.style_state.apply(Command('start_inline_style', 0, 'IMPORTANT'))
self.assertEqual(DOM.render_debug(self.style_state.render_styles('Test text', {}, [])), '<strong style="color: red;">Test text</strong>')
self.style_state.apply(Command('stop_inline_style', 9, 'IMPORTANT'))
示例13: test_render_styles_attributes
# 需要导入模块: from draftjs_exporter.dom import DOM [as 别名]
# 或者: from draftjs_exporter.dom.DOM import render_debug [as 别名]
def test_render_styles_attributes(self):
self.style_state.apply(Command('start_inline_style', 0, 'KBD'))
self.assertEqual(DOM.render_debug(self.style_state.render_styles('Test text', {}, [])), '<kbd class="o-keyboard-shortcut">Test text</kbd>')
self.style_state.apply(Command('stop_inline_style', 9, 'KBD'))
示例14: test_render_styles_styled_multiple
# 需要导入模块: from draftjs_exporter.dom import DOM [as 别名]
# 或者: from draftjs_exporter.dom.DOM import render_debug [as 别名]
def test_render_styles_styled_multiple(self):
self.style_state.apply(Command('start_inline_style', 0, 'BOLD'))
self.style_state.apply(Command('start_inline_style', 0, 'ITALIC'))
self.assertEqual(DOM.render_debug(self.style_state.render_styles('Test text', {}, [])), '<strong><em>Test text</em></strong>')
示例15: test_render_styles_styled
# 需要导入模块: from draftjs_exporter.dom import DOM [as 别名]
# 或者: from draftjs_exporter.dom.DOM import render_debug [as 别名]
def test_render_styles_styled(self):
self.style_state.apply(Command('start_inline_style', 0, 'ITALIC'))
self.assertEqual(DOM.render_debug(self.style_state.render_styles('Test text', {}, [])), '<em>Test text</em>')
self.style_state.apply(Command('stop_inline_style', 9, 'ITALIC'))