Changeset 5685
- Timestamp:
- 11/16/08 16:24:18 (2 months ago)
- Files:
-
- branches/1.1/CHANGELOG.txt (modified) (1 diff)
- branches/1.1/turbogears/widgets/big_widgets.py (modified) (6 diffs)
- branches/1.1/turbogears/widgets/tests/test_widgets.py (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
branches/1.1/CHANGELOG.txt
r5673 r5685 39 39 templates (r5379, r5465, r5484). 40 40 * 'testutil.TGTest.tearDown' stops CherryPy server as well (r5461). 41 * The root element of the ``CalendarDatePicker``, ``AutoCompleteField`` and 42 ``AutoCompleteTextField`` widgets have been changed from ``DIV`` to ``SPAN`` 43 to allow them to be used inside elements, which can not contain other 44 block-level elements (e.g. ``SPAN``). A ``class`` attribute is added to the 45 ``SPAN`` element, to allow it to be target by CSS rules easily (r5685) 41 46 42 47 branches/1.1/turbogears/widgets/big_widgets.py
r5321 r5685 22 22 23 23 template = """ 24 < div xmlns:py="http://purl.org/kid/ns#">24 <span xmlns:py="http://purl.org/kid/ns#" class="${field_class}"> 25 25 <input type="text" id="${field_id}" class="${field_class}" name="${name}" value="${strdate}" py:attrs="attrs"/> 26 26 <input type="button" id="${field_id}_trigger" class="date_field_button" value="${button_text}"/> … … 33 33 }); 34 34 </script> 35 </ div>35 </span> 36 36 """ 37 37 params = ["attrs", "skin", "picker_shows_time", "button_text", … … 144 144 145 145 template = """ 146 < div xmlns:py="http://purl.org/kid/ns#" id="${field_id}">146 <span xmlns:py="http://purl.org/kid/ns#" id="${field_id}" class="${field_class}"> 147 147 <script language="JavaScript" type="text/JavaScript"> 148 148 AutoCompleteManager${field_id} = new AutoCompleteManager('${field_id}', … … 156 156 <img py:if="show_spinner" id="autoCompleteSpinner${field_id}" 157 157 src="${tg.url([tg.widgets, 'turbogears.widgets/spinnerstopped.png'])}" alt=""/> 158 < divclass="autoTextResults" id="autoCompleteResults${field_id}"/>158 <span class="autoTextResults" id="autoCompleteResults${field_id}"/> 159 159 ${hidden_field.display(value_for(hidden_field), **params_for(hidden_field))} 160 </ div>160 </span> 161 161 """ 162 162 … … 224 224 225 225 template = """ 226 < div xmlns:py="http://purl.org/kid/ns#">226 <span xmlns:py="http://purl.org/kid/ns#" class="${field_class}"> 227 227 <script language="JavaScript" type="text/JavaScript"> 228 228 AutoCompleteManager${field_id} = new AutoCompleteManager('${field_id}', '${field_id}', null, … … 236 236 <img py:if="show_spinner" id="autoCompleteSpinner${field_id}" 237 237 src="${tg.url([tg.widgets, 'turbogears.widgets/spinnerstopped.png'])}" alt=""/> 238 < divclass="autoTextResults" id="autoCompleteResults${field_id}"/>239 </ div>238 <span class="autoTextResults" id="autoCompleteResults${field_id}"/> 239 </span> 240 240 """ 241 241 branches/1.1/turbogears/widgets/tests/test_widgets.py
r5508 r5685 651 651 assert '<option value="java">' in output 652 652 assert '<option value="pascal">' in output 653 654 def test_calendardatepicker(): 655 """CalendarDatePicker widget is wrapped in a SPAN element with proper class 656 """ 657 w = widgets.CalendarDatePicker( 658 name = 'test_cdp', 659 field_class = 'my_cdp', 660 label='Test', 661 format='%m/%d/%Y', 662 validator = validators.DateConverter(format="mm/dd/yyyy") 663 ) 664 output = w.render(format='xhtml') 665 print output 666 assert '<span class="my_cdp">' in output 667 668 def test_calendardatepicker(): 669 """CalendarDatePicker widget is wrapped in SPAN element with proper class 670 """ 671 w = widgets.CalendarDatePicker( 672 name = 'test_cdp', 673 field_class = 'cdp', 674 label='Test', 675 format='%m/%d/%Y', 676 validator = validators.DateConverter(format="mm/dd/yyyy") 677 ) 678 output = w.render(format='xhtml') 679 assert '<span class="cdp">' in output 680 681 def test_autocompletefield(): 682 """AutoCompleteField widget is wrapped in SPAN element with proper class/id 683 """ 684 w = widgets.AutoCompleteField(name="my_acf", 685 field_class='acf', 686 search_controller="/search", 687 search_param="test", result_name="test") 688 output = w.render(format='xhtml') 689 assert '<span id="my_acf" class="acf">' in output 690 691 def test_autocompletetextfield(): 692 """AutoCompleteTextField widget is wrapped in SPAN element with proper class/id 693 """ 694 w = widgets.AutoCompleteTextField(name="my_actf", 695 field_class='actf', 696 search_controller="/search", 697 search_param="test", result_name="test") 698 output = w.render(format='xhtml') 699 assert '<span class="actf">' in output