Skip to content

Commit

Permalink
Merge 379d0e4 into 7ab64b3
Browse files Browse the repository at this point in the history
  • Loading branch information
digitronik committed May 13, 2019
2 parents 7ab64b3 + 379d0e4 commit ce7e7d8
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/widgetastic/widget/checkbox.py
Expand Up @@ -31,3 +31,8 @@ def fill(self, value):
# TODO: More verbose here
raise WidgetOperationFailed('Failed to set the checkbox to requested value.')
return True

@property
def is_enabled(self):
# TODO: This property can be implement globally.
return self.browser.element(self).is_enabled()
1 change: 1 addition & 0 deletions testing/html/testing_page.html
Expand Up @@ -32,6 +32,7 @@ <h2 style="display: none;" id="invisible">This is invisible</h2>
<h3>test test</h3>
<input name="input1" type="text" />
<input id="input2" type="checkbox" />
<input id="input_disabled" type="checkbox" disabled/>
</form>
<hr/>
<table id="with-thead">
Expand Down
4 changes: 4 additions & 0 deletions testing/test_basic_widgets.py
Expand Up @@ -16,6 +16,7 @@ class TestForm(View):
input1 = TextInput(name='input1')
input2 = Checkbox(id='input2')
input3 = ColourInput(id='colourinput')
input4 = Checkbox(id='input_disabled')
fileinput = FileInput(id='fileinput')

class AFillable(Fillable):
Expand Down Expand Up @@ -60,6 +61,9 @@ def as_fill_value(self):
with pytest.raises(DoNotReadThisWidget):
form.fileinput.read()

assert form.input2.is_enabled
assert not form.input4.is_enabled


def test_nested_views_read_fill(browser):
class TestForm(View):
Expand Down

0 comments on commit ce7e7d8

Please sign in to comment.