Commits

Anonymous committed 2f2c6a0

[svn] o more appropriate radio_button selected test
o submit tests, additional form test

Comments (0)

Files changed (1)

tests/test_form_tag.py

             form(url="http://www.example.com", method='GET'),
             '<form action="http://www.example.com" method="GET">'
         )
+        self.assertEqual(
+            form(url('/test/edit/1')),
+            '<form action="/test/edit/1" method="POST">'
+        )
 
     def test_form_multipart(self):
         self.assertEqual(
         )
 
         self.assertEqual(
-            radio_button("num_people", 5, selected=True),
-            '<input id="num_people_5" name="num_people" selected="True" type="radio" value="5" />'
+            radio_button("num_people", 5, checked=True),
+            '<input checked="checked" id="num_people_5" name="num_people" type="radio" value="5" />'
         )
 
     def test_select(self):
             '<select id="people" name="people"><option>justin</option></select>'
         )
 
+    def test_submit(self):
+        self.assertEqual(
+            '<input name="commit" type="submit" value="Save changes" />',
+            submit()
+        )
+        self.assertEqual(
+            '<input name="commit" onclick="return confirm(\'Are you sure?\');" type="submit" value="Save" />',
+            submit("Save", confirm='Are you sure?')
+        )
+        self.assertEqual(
+            '<input name="commit" onclick="alert(\'Clicked!\');return confirm(\'Are you sure?\');" type="submit" value="Save" />',
+            submit("Save", onclick="alert('Clicked!')", confirm='Are you sure?')
+        )
+        self.assertEqual(
+            '<input name="commit" onclick="alert(\'Clicked!\');return confirm(\'Are you sure?\');" type="submit" value="Save" />',
+            submit("Save", onclick="alert('Clicked!');", confirm='Are you sure?')
+        )
+        self.assertEqual(
+            '<input name="commit" onclick="this.disabled=true;this.value=\'Saving...\';this.form.submit();alert(\'hello!\')" type="submit" value="Save" />',
+            submit("Save", disable_with="Saving...", onclick="alert('hello!')")
+        )
+
     def test_text_area(self):
         self.assertEqual(
             text_area("aa", ""),
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.