141 |
141 |
'fieldb': True,
|
142 |
142 |
'fieldc': '2020-09-28',
|
143 |
143 |
'fieldd': {'filename': 'file.pdf', 'url': 'http://127.0.0.1:8999/download?f=42'},
|
144 |
|
'fielde': 'lorem<strong>ipsum\n\nhello world',
|
|
144 |
'fielde': "lorem<strong>ipsum\n\nhello'world",
|
145 |
145 |
'fieldf': 'lorem<strong>ipsum\n\nhello world',
|
146 |
146 |
'fieldg': 'test@localhost',
|
147 |
147 |
'fieldh': 'https://www.example.net/',
|
... | ... | |
2553 |
2553 |
)
|
2554 |
2554 |
assert (
|
2555 |
2555 |
PyQuery(result).find('.label:contains("Field E") + .value p:last-child').text().strip()
|
2556 |
|
== 'hello world'
|
|
2556 |
== "hello'world"
|
2557 |
2557 |
)
|
2558 |
2558 |
|
2559 |
2559 |
# field F is put in a <pre>
|
... | ... | |
2719 |
2719 |
}
|
2720 |
2720 |
cell.save()
|
2721 |
2721 |
result = cell.render(context)
|
|
2722 |
# check multiline text field is rendered with multiple paragraphs
|
|
2723 |
# (first line "lorem<strong>ipsum" and last line ("hello'world")
|
|
2724 |
# and the content is kept properly escaped.
|
2722 |
2725 |
assert PyQuery(result).find('.label').text() == 'Field E'
|
2723 |
2726 |
assert PyQuery(result).find('.value p:first-child').text().strip() == 'lorem<strong>ipsum'
|
2724 |
|
assert PyQuery(result).find('.value p:last-child').text().strip() == 'hello world'
|
|
2727 |
assert PyQuery(result).find('.value p:last-child').text().strip() == "hello'world"
|
2725 |
2728 |
|
2726 |
2729 |
cell.custom_schema['cells'][0] = {
|
2727 |
2730 |
'varname': 'fieldf',
|
... | ... | |
2861 |
2864 |
carddef_reference='default:card_model_1',
|
2862 |
2865 |
custom_schema={
|
2863 |
2866 |
'cells': [
|
2864 |
|
{'varname': '@custom@', 'template': '<b>Foo</b> bar baz', 'display_mode': 'title'},
|
|
2867 |
{
|
|
2868 |
'varname': '@custom@',
|
|
2869 |
'template': "<b>Foo</b> bar'baz {{ card.fields.fielde }}",
|
|
2870 |
'display_mode': 'title',
|
|
2871 |
},
|
2865 |
2872 |
]
|
2866 |
2873 |
},
|
2867 |
2874 |
)
|
... | ... | |
2874 |
2881 |
|
2875 |
2882 |
result = cell.render(context)
|
2876 |
2883 |
assert '<b>Foo</b>' in result
|
2877 |
|
assert PyQuery(result).find('h3').text() == '<b>Foo</b> bar baz'
|
|
2884 |
assert PyQuery(result).find('h3').text() == "<b>Foo</b> bar'baz lorem<strong>ipsum hello'world"
|
2878 |
2885 |
|
2879 |
2886 |
# test context
|
2880 |
2887 |
cell.custom_schema['cells'][0][
|
2881 |
|
-
|