[Zope3-checkins] CVS: Zope3/src/zope/app/browser/form/tests - test_vocabularywidget.py:1.1.2.15

Fred L. Drake, Jr. fred@zope.com
Tue, 6 May 2003 15:49:28 -0400


Update of /cvs-repository/Zope3/src/zope/app/browser/form/tests
In directory cvs.zope.org:/tmp/cvs-serv26286

Modified Files:
      Tag: schema-vocabulary-branch
	test_vocabularywidget.py 
Log Message:
- MultiSelectionTests.test_edit_with_form_value():  make sure
  vocabulary term that isn't part of the field value isn't included
- made spelling of the support code trivially more consistent


=== Zope3/src/zope/app/browser/form/tests/test_vocabularywidget.py 1.1.2.14 => 1.1.2.15 ===
--- Zope3/src/zope/app/browser/form/tests/test_vocabularywidget.py:1.1.2.14	Tue May  6 15:40:58 2003
+++ Zope3/src/zope/app/browser/form/tests/test_vocabularywidget.py	Tue May  6 15:49:27 2003
@@ -170,8 +170,7 @@
         self.assertEqual(w(), "foobar")
 
     def test_edit(self):
-        vocab = BasicVocabulary(["splat", "foobar"])
-        bound = self.makeField(vocab)
+        bound = self.makeField(BasicVocabulary(["splat", "foobar"]))
         w = getView(bound, "edit", TestRequest())
         self.assert_(not w.haveData())
         self.verifyResult(w(), [
@@ -334,7 +333,7 @@
         self.assert_(s3.find('selected') < 0)
 
     def test_edit_with_form_value(self):
-        bound = self.makeField(BasicVocabulary(["splat", "foobar"]))
+        bound = self.makeField(BasicVocabulary(["splat", "foobar", "frob"]))
         request = TestRequest(
             QUERY_STRING='field.f:list=foobar&field.f:list=splat')
         request.processInputs()
@@ -343,13 +342,15 @@
         L = w._showData()
         L.sort()
         self.assertEqual(L, ["foobar", "splat"])
-        self.verifyResult(w.hidden(), [
+        s = w.hidden()
+        self.verifyResult(s, [
             '<input',
             'type="hidden"',
             'name="field.f:list"',
             'value="foobar"',
             'value="splat"',
             ])
+        self.assert_(s.find("frob") < 0)
 
 
 def test_suite():