Commits

Brendan McCollam  committed 6482ef9

Adding another test

  • Participants
  • Parent commits 1554909

Comments (0)

Files changed (1)

File tests/test_extract_values.py

 from punky.browster import PunkyError
 
 
-def test_value_checked_selected():
+def test_value_checked_selected_by_css():
     """Do the value(), checked() and selected() methods return the expected
     values?
     """
     eq_(browser.selected('form option:first-child'), False)
     eq_(browser.selected('form option:nth-child(3)'), True)
 
+def test_value_checked_selected_by_element():
+    """Do the value(), checked() and selected() methods return the expected
+    values when called directly on elements?
+    """
+    browser.load('tests/pages/test_extract_values.html')
+
+    elem1 = browser.first('form input[type=text]')
+    eq_(browser.value(elem1), 'antelope')
+
+    elem2 = browser.first('form textarea')
+    eq_(browser.value(elem2), 'banana')
+
+    elem3 = browser.first('form input[type=checkbox]')
+    eq_(browser.checked(elem3), True)
+
+    elem4 = browser.first('form input[type=radio]')
+    eq_(browser.checked(elem4), False)
+
+    elem5 = browser.first('form option:first-child')
+    eq_(browser.selected(elem5), False)
+
+    elem6 = browser.first('form option:nth-child(3)')
+    eq_(browser.selected(elem6), True)
+
 
 def test_value_checked_selected_with_exceptions():
     """Do the value(), checked() and selected() methods raise the expected