==========
TextWidget
==========

The widget can render a input field for a text line:

  >>> from zope.interface.verify import verifyClass
  >>> from zope.app.form.interfaces import IInputWidget
  >>> from z3c.form import interfaces
  >>> from z3c.form.browser import text

The TextWidget is a widget:

 >>> verifyClass(interfaces.IWidget, text.TextWidget)
  True

The widget can render a input field only by adapting a request:

  >>> from z3c.form.testing import TestRequest
  >>> request = TestRequest()
  >>> widget = text.TextWidget(request)

Such a field provides IWidget:

 >>> interfaces.IWidget.providedBy(widget)
  True

We also need to register the template for at least the widget and request:

  >>> import os.path
  >>> import zope.interface
  >>> from zope.publisher.interfaces.browser import IDefaultBrowserLayer
  >>> from zope.pagetemplate.interfaces import IPageTemplate
  >>> import z3c.form.browser
  >>> import z3c.form.widget
  >>> template = os.path.join(os.path.dirname(z3c.form.browser.__file__),
  ...     'text_input.pt')
  >>> factory = z3c.form.widget.WidgetTemplateFactory(template)
  >>> zope.component.provideAdapter(factory,
  ...     (zope.interface.Interface, IDefaultBrowserLayer, None, None, None),
  ...     IPageTemplate, name='input')

If we render the widget we get the HTML:

  >>> widget.render()
  u'<input type="text" id="" name="" class="textWidget" value="" />\n'
