Skip to content

Commit

Permalink
Fixed tests
Browse files Browse the repository at this point in the history
  • Loading branch information
vincentfretin committed Sep 27, 2009
1 parent 80e7d83 commit 5a7d56c
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 41 deletions.
16 changes: 7 additions & 9 deletions src/z3c/form/browser/multi.txt
Original file line number Diff line number Diff line change
Expand Up @@ -523,6 +523,8 @@ as input for our internal (sub) widget.
<span class="required">*</span>
</label>
</div>
<div class="error">The entered value is not a valid integer
literal.</div>
<div class="widget">
<div class="multi-widget-checkbox">
<input type="checkbox" value="1"
Expand All @@ -535,10 +537,6 @@ as input for our internal (sub) widget.
class="text-widget required int-field" value="bad" />
</div>
</div>
<div class="error">
<div class="error">The entered value is not a valid integer
literal.</div>
</div>
</div>
<div class="buttons">
<input type="submit" id="widget-name-buttons-add"
Expand Down Expand Up @@ -773,7 +771,7 @@ We can now render the widget:

>>> widget.update()
>>> print widget.render()
<span class="multi-widget" id="widget-id"></span>
<div class="multi-widget" id="widget-id"></div>

As you can see the widget is empty and doesn't provide values. This is because
the widget does not know what sub-widgets to display. So let's register a
Expand All @@ -788,7 +786,7 @@ Let's now update the widget and check it again.

>>> widget.update()
>>> print widget.render()
<span class="multi-widget" id="widget-id"></span>
<div class="multi-widget" id="widget-id"></div>

It's still the same. Since the widget doesn't provide a field nothing useful
gets rendered. Now let's define a field for this widget and check it again:
Expand All @@ -800,7 +798,7 @@ gets rendered. Now let's define a field for this widget and check it again:
>>> widget.field = field
>>> widget.update()
>>> print widget.render()
<span class="multi-widget" id="widget-id"></span>
<div class="multi-widget" id="widget-id"></div>

As you can see, there is still no input value. Let's provide some values for
this widget. Before we can do that, we will need to register a data converter
Expand All @@ -809,7 +807,7 @@ for our multi widget and the data converter dispatcher adapter:
>>> widget.update()
>>> widget.value = [u'42', u'43']
>>> print widget.render()
<span class="multi-widget" id="widget-id">
<div class="multi-widget" id="widget-id">
<div class="row" id="widget-id-0-row">
<div class="label">
<label for="widget-id-0">
Expand All @@ -836,7 +834,7 @@ for our multi widget and the data converter dispatcher adapter:
</div>
</div>
</div>
</span>
</div>


Hidden mode
Expand Down
16 changes: 4 additions & 12 deletions src/z3c/form/browser/object.txt
Original file line number Diff line number Diff line change
Expand Up @@ -352,9 +352,7 @@ I'm tempted to leave it out as no widgets seem to do this.
# <span>My dear bar</span>
# </label>
# </div>
# <div class="error">
# <div class="error">The entered value is not a valid integer literal.</div>
# </div>
# <div class="error">The entered value is not a valid integer literal.</div>
# <div class="widget">
# <input class="text-widget int-field"
# id="subobject-widgets-barfield"
Expand Down Expand Up @@ -814,9 +812,7 @@ it has to appear at the field itself and at the top of the form:
<span>My dear bar</span>
</label>
</div>
<div class="error">
<div class="error">The entered value is not a valid integer literal.</div>
</div>
<div class="error">The entered value is not a valid integer literal.</div>
<div class="widget">
<input class="text-widget int-field"
id="form-widgets-subobject-widgets-barfield"
Expand Down Expand Up @@ -887,9 +883,7 @@ Both errors must appear at the top of the form:
<span class="required">*</span>
</label>
</div>
<div class="error">
<div class="error">Value is too big</div>
</div>
<div class="error">Value is too big</div>
<div class="widget">
<input class="text-widget required int-field"
id="form-widgets-subobject-widgets-foofield"
Expand All @@ -901,9 +895,7 @@ Both errors must appear at the top of the form:
<span>My dear bar</span>
</label>
</div>
<div class="error">
<div class="error">The entered value is not a valid integer literal.</div>
</div>
<div class="error">The entered value is not a valid integer literal.</div>
<div class="widget">
<input class="text-widget int-field"
id="form-widgets-subobject-widgets-barfield"
Expand Down
28 changes: 8 additions & 20 deletions src/z3c/form/browser/objectmulti.txt
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,7 @@ just cry about it in the HTML:
<span class="required">*</span>
</label>
</div>
<div class="error">Wrong contained type</div>
<div class="widget">
<div class="multi-widget-checkbox">
<input id="foo-0-remove" name="foo.0.remove"
Expand All @@ -209,9 +210,7 @@ just cry about it in the HTML:
<span class="required">*</span>
</label>
</div>
<div class="error">
<div class="error">Required input is missing.</div>
</div>
<div class="error">Required input is missing.</div>
<div class="widget">
<input id="foo-0-widgets-foofield" name="foo.0.widgets.foofield"
class="text-widget required int-field" type="text" />
Expand All @@ -229,9 +228,6 @@ just cry about it in the HTML:
</div>
</div>
</div>
<div class="error">
<div class="error">Wrong contained type</div>
</div>
</div>
<div class="buttons">
<input id="foo-buttons-add" name="foo.buttons.add"
Expand Down Expand Up @@ -884,6 +880,7 @@ as input for our internal (sub) widget.
<span class="required">*</span>
</label>
</div>
<div class="error">Object is of wrong type.</div>
<div class="widget">
<div class="multi-widget-checkbox">
<input class="multi-widget-checkbox checkbox-widget" id="foo-1-remove" name="foo.1.remove" type="checkbox" value="1">
Expand All @@ -896,9 +893,7 @@ as input for our internal (sub) widget.
<span class="required">*</span>
</label>
</div>
<div class="error">
<div class="error">The entered value is not a valid integer literal.</div>
</div>
<div class="error">The entered value is not a valid integer literal.</div>
<div class="widget">
<input class="text-widget required int-field" id="foo-1-widgets-foofield" name="foo.1.widgets.foofield" type="text" value="bad">
</div>
Expand All @@ -914,9 +909,6 @@ as input for our internal (sub) widget.
</div>
</div>
</div>
<div class="error">
<div class="error">Object is of wrong type.</div>
</div>
</div>
<div class="buttons">
<input class="submit-widget button-field" id="foo-buttons-add" name="foo.buttons.add" type="submit" value="Add">
Expand Down Expand Up @@ -1610,6 +1602,7 @@ it has to appear at the field itself and at the top of the form:
<span class="required">*</span>
</label>
</div>
<div class="error">Object is of wrong type.</div>
<div class="widget">
<div class="multi-widget-checkbox">
<input class="multi-widget-checkbox checkbox-widget"
Expand All @@ -1636,9 +1629,7 @@ it has to appear at the field itself and at the top of the form:
<span>My dear bar</span>
</label>
</div>
<div class="error">
<div class="error">The entered value is not a valid integer literal.</div>
</div>
<div class="error">The entered value is not a valid integer literal.</div>
<div class="widget">
<input class="text-widget int-field"
id="form-widgets-listOfObject-0-widgets-barfield"
Expand All @@ -1649,9 +1640,6 @@ it has to appear at the field itself and at the top of the form:
</div>
</div>
</div>
<div class="error">
<div class="error">Object is of wrong type.</div>
</div>
</div>
<div class="buttons">
<input class="submit-widget button-field"
Expand Down Expand Up @@ -1701,7 +1689,7 @@ Simple but often used use-case is the display form:
<form action=".">
<div class="row">
<label for="form-widgets-listOfObject">My list field</label>
<span class="multi-widget required" id="form-widgets-listOfObject">
<div class="multi-widget required" id="form-widgets-listOfObject">
<div class="row" id="form-widgets-listOfObject-0-row">
<div class="label">
<label for="form-widgets-listOfObject-0">
Expand Down Expand Up @@ -1735,7 +1723,7 @@ Simple but often used use-case is the display form:
</div>
</div>
</div>
</span>
</div>
</div>
<div class="row">
<label for="form-widgets-name">name</label>
Expand Down

0 comments on commit 5a7d56c

Please sign in to comment.