Skip to content

Commit

Permalink
add test data
Browse files Browse the repository at this point in the history
  • Loading branch information
2silver committed Jun 24, 2019
1 parent 16fe1f6 commit b7bddb2
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/yafowil/yaml/parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ def fetch_value(widget=None, data=None):
return eval(value[5:],
{'context': self.context, 'widget': widget,
'data': data}, {})
return fetch_value()
return fetch_value
if value.startswith('i18n:'):
parts = value.split(":")
if len(parts) > 3:
Expand Down
26 changes: 22 additions & 4 deletions src/yafowil/yaml/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,11 @@ def tearDown(self):
label: i18n:First Field
description: I am the description
required: I am required
data:
flat: I am a flat data-attribute
i18n: i18n:nested_firstfield:i18n Nested First Field
nested:
nested-i18n: i18n:nested_firstfield:i18n Nested First Field
- secondfield:
factory: field:label:*custom_stuff:error:select
value: ['a', 'b']
Expand Down Expand Up @@ -108,7 +113,14 @@ def test_load_yaml(self):
'props': {
'description': 'I am the description',
'label': 'i18n:First Field',
'required': 'I am required'
'required': 'I am required',
"data": {
"flat": "I am a flat data-attribute",
"i18n": "i18n:nested_firstfield:i18n Nested First Field",
"nested": {
"nested-i18n": "i18n:nested_firstfield:i18n Nested First Field"
}
}
}
}
}, {
Expand Down Expand Up @@ -234,9 +246,15 @@ def test_parse_from_yaml(self):
id="form-demoform" method="post" novalidate="novalidate">
<div class="field" id="field-demoform-firstfield">
<label for="input-demoform-firstfield">First Field</label>
<input class="required text" id="input-demoform-firstfield"
name="demoform.firstfield" required="required"
type="text" value="First value"/>
<input class="required text"
data-flat="I am a flat data-attribute"
data-i18n="i18n Nested First Field"
data-nested="{&quot;nested-i18n&quot;: &quot;i18n Nested First Field&quot;}"
id="input-demoform-firstfield"
name="demoform.firstfield"
required="required"
type="text"
value="First value"/>
</div>
<div class="field" id="field-demoform-secondfield">
<label for="input-demoform-secondfield"
Expand Down

0 comments on commit b7bddb2

Please sign in to comment.