コード例 #1
0
ファイル: form.py プロジェクト: ra2003/python-htmlgen
 def test_set_selected_option__deselect_others(self):
     select = Select()
     option1 = select.create_option("L1", selected=True)
     option2 = select.create_option("L2")
     select.selected_option = option2
     assert_false(option1.selected)
     assert_is(option2, select.selected_option)
コード例 #2
0
ファイル: form.py プロジェクト: srittau/python-htmlgen
 def test_set_selected_option__deselect_others(self):
     select = Select()
     option1 = select.create_option("L1", selected=True)
     option2 = select.create_option("L2")
     select.selected_option = option2
     assert_false(option1.selected)
     assert_is(option2, select.selected_option)
コード例 #3
0
ファイル: form.py プロジェクト: srittau/python-htmlgen
 def test_set_selected_option(self):
     select = Select()
     select.create_option("L1")
     option = select.create_option("L2")
     select.create_option("L3")
     select.selected_option = option
     assert_true(option.selected)
     assert_is(option, select.selected_option)
コード例 #4
0
ファイル: form.py プロジェクト: ra2003/python-htmlgen
 def test_set_selected_option(self):
     select = Select()
     select.create_option("L1")
     option = select.create_option("L2")
     select.create_option("L3")
     select.selected_option = option
     assert_true(option.selected)
     assert_is(option, select.selected_option)
コード例 #5
0
ファイル: form.py プロジェクト: ra2003/python-htmlgen
 def test_set_selected_value(self):
     select = Select()
     select.create_option("L1", "v1")
     option = select.create_option("L2", "v2")
     select.create_option("L3", "v3")
     select.selected_value = "v2"
     assert_equal("v2", select.selected_value)
     assert_is(option, select.selected_option)
     assert_true(option.selected)
コード例 #6
0
ファイル: form.py プロジェクト: srittau/python-htmlgen
 def test_set_selected_value(self):
     select = Select()
     select.create_option("L1", "v1")
     option = select.create_option("L2", "v2")
     select.create_option("L3", "v3")
     select.selected_value = "v2"
     assert_equal("v2", select.selected_value)
     assert_is(option, select.selected_option)
     assert_true(option.selected)
コード例 #7
0
ファイル: form.py プロジェクト: srittau/python-htmlgen
 def test_create_option__option_object(self):
     select = Select()
     option = select.create_option("Option Label", "test-value",
                                   selected=True)
     assert_equal("option", option.element_name)
     assert_equal("test-value", option.value)
     assert_true(option.selected)
コード例 #8
0
ファイル: form.py プロジェクト: ra2003/python-htmlgen
 def test_create_option__option_object(self):
     select = Select()
     option = select.create_option(
         "Option Label", "test-value", selected=True
     )
     assert_equal("option", option.element_name)
     assert_equal("test-value", option.value)
     assert_true(option.selected)
コード例 #9
0
ファイル: form.py プロジェクト: takluyver/python-htmlgen
 def test_create_option__selected(self):
     select = Select()
     option = select.create_option("Option Label",
                                   "test-value",
                                   selected=True)
     assert_is(option, select.selected_option)
     assert_equal(
         '<select><option selected="selected" value="test-value">'
         'Option Label</option></select>', str(select))
コード例 #10
0
ファイル: form.py プロジェクト: srittau/python-htmlgen
 def test_create_option__selected(self):
     select = Select()
     option = select.create_option("Option Label", "test-value",
                                   selected=True)
     assert_is(option, select.selected_option)
     assert_equal(
         '<select><option selected="selected" value="test-value">'
         'Option Label</option></select>',
         str(select))
コード例 #11
0
ファイル: form.py プロジェクト: ra2003/python-htmlgen
 def test_set_selected_option__string_children(self):
     select = Select()
     select.append("String Content")
     option = select.create_option("L1")
     select.selected_option = option
コード例 #12
0
ファイル: form.py プロジェクト: srittau/python-htmlgen
 def test_create_option__option_object__default_value(self):
     select = Select()
     option = select.create_option("Option Label")
     assert_equal("Option Label", option.value)
コード例 #13
0
ファイル: form.py プロジェクト: srittau/python-htmlgen
 def test_create_option__selected_deselect_others(self):
     select = Select()
     option = select.create_option("L1", selected=True)
     select.create_option("L2", selected=True)
     assert_false(option.selected)
コード例 #14
0
ファイル: form.py プロジェクト: ra2003/python-htmlgen
 def test_get_selected_option__no_selected_elements(self):
     select = Select()
     select.create_option("L1", "v1")
     select.create_option("L2", "v2")
     select.create_option("L3", "v3")
     assert_is_none(select.selected_option)
コード例 #15
0
ファイル: form.py プロジェクト: ra2003/python-htmlgen
 def test_get_selected_option(self):
     select = Select()
     select.create_option("L1", "v1")
     option = select.create_option("L2", "v2", selected=True)
     select.create_option("L3", "v3")
     assert_is(option, select.selected_option)
コード例 #16
0
ファイル: form.py プロジェクト: ra2003/python-htmlgen
 def test_create_option__selected_deselect_others(self):
     select = Select()
     option = select.create_option("L1", selected=True)
     select.create_option("L2", selected=True)
     assert_false(option.selected)
コード例 #17
0
ファイル: form.py プロジェクト: ra2003/python-htmlgen
 def test_create_option__option_object__default_value(self):
     select = Select()
     option = select.create_option("Option Label")
     assert_equal("Option Label", option.value)
コード例 #18
0
ファイル: form.py プロジェクト: srittau/python-htmlgen
 def test_get_selected_option(self):
     select = Select()
     select.create_option("L1", "v1")
     option = select.create_option("L2", "v2", selected=True)
     select.create_option("L3", "v3")
     assert_is(option, select.selected_option)
コード例 #19
0
ファイル: form.py プロジェクト: ra2003/python-htmlgen
 def test_create_option(self):
     select = Select()
     select.create_option("Option Label")
     assert_equal(
         "<select><option>Option Label</option></select>", str(select)
     )
コード例 #20
0
ファイル: form.py プロジェクト: srittau/python-htmlgen
 def test_get_selected_option__no_selected_elements(self):
     select = Select()
     select.create_option("L1", "v1")
     select.create_option("L2", "v2")
     select.create_option("L3", "v3")
     assert_is_none(select.selected_option)
コード例 #21
0
ファイル: form.py プロジェクト: ra2003/python-htmlgen
 def test_get_selected_value__implicit_value(self):
     select = Select()
     select.create_option("L1")
     select.create_option("L2", selected=True)
     assert_equal("L2", select.selected_value)
コード例 #22
0
ファイル: form.py プロジェクト: srittau/python-htmlgen
 def test_get_selected_value__no_selected(self):
     select = Select()
     select.create_option("L1", "v1")
     assert_is_none(select.selected_value)
コード例 #23
0
ファイル: form.py プロジェクト: srittau/python-htmlgen
 def test_get_selected_value__implicit_value(self):
     select = Select()
     select.create_option("L1")
     select.create_option("L2", selected=True)
     assert_equal("L2", select.selected_value)
コード例 #24
0
ファイル: form.py プロジェクト: srittau/python-htmlgen
 def test_set_selected_option__string_children(self):
     select = Select()
     select.append("String Content")
     option = select.create_option("L1")
     select.selected_option = option
コード例 #25
0
ファイル: form.py プロジェクト: ra2003/python-htmlgen
 def test_get_selected_value__no_selected(self):
     select = Select()
     select.create_option("L1", "v1")
     assert_is_none(select.selected_value)
コード例 #26
0
ファイル: form.py プロジェクト: srittau/python-htmlgen
 def test_set_selected_value__value_not_found(self):
     select = Select()
     select.create_option("L1", "v1")
     select.create_option("L2", "v2")
     with assert_raises(ValueError):
         select.selected_value = "not-found"
コード例 #27
0
ファイル: form.py プロジェクト: ra2003/python-htmlgen
 def test_set_selected_value__value_not_found(self):
     select = Select()
     select.create_option("L1", "v1")
     select.create_option("L2", "v2")
     with assert_raises(ValueError):
         select.selected_value = "not-found"
コード例 #28
0
ファイル: form.py プロジェクト: srittau/python-htmlgen
 def test_create_option(self):
     select = Select()
     select.create_option("Option Label")
     assert_equal('<select><option>Option Label</option></select>',
                  str(select))