From 794a2085de51cf89c8e83ebca28913dee904e65e Mon Sep 17 00:00:00 2001 From: Kanezoh Date: Thu, 18 Nov 2021 11:13:30 +0900 Subject: [PATCH] add checkbox comment --- src/mechanize/file.cr | 2 +- src/mechanize/form/check_box.cr | 2 ++ src/mechanize/form/field.cr | 1 - src/mechanize/form/multi_select_list.cr | 8 +++++++- src/mechanize/form/option.cr | 1 + src/mechanize/form/radio_button.cr | 5 +++++ src/mechanize/form/select_list.cr | 1 + 7 files changed, 17 insertions(+), 3 deletions(-) diff --git a/src/mechanize/file.cr b/src/mechanize/file.cr index 900d239..9ec0b40 100644 --- a/src/mechanize/file.cr +++ b/src/mechanize/file.cr @@ -9,7 +9,7 @@ class Mechanize # returns http status code getter code : Int32 # returns page uri - getter uri : URI + getter uri : URI def initialize(uri : URI, response : ::HTTP::Client::Response, body : String, code : Int32) @uri = uri diff --git a/src/mechanize/form/check_box.cr b/src/mechanize/form/check_box.cr index e383441..b239cbf 100644 --- a/src/mechanize/form/check_box.cr +++ b/src/mechanize/form/check_box.cr @@ -1,4 +1,6 @@ +# This class represents class Mechanize::FormContent::CheckBox < Mechanize::FormContent::RadioButton + # set checkbox checked def check @checked = true end diff --git a/src/mechanize/form/field.cr b/src/mechanize/form/field.cr index 27f800e..f98ffee 100644 --- a/src/mechanize/form/field.cr +++ b/src/mechanize/form/field.cr @@ -1,6 +1,5 @@ # This class represents elements in the form. class Mechanize::FormContent::Field - # returns field's 'value' attribute property value : String? # returns field's 'name' attribute diff --git a/src/mechanize/form/multi_select_list.cr b/src/mechanize/form/multi_select_list.cr index f55f518..a960c72 100644 --- a/src/mechanize/form/multi_select_list.cr +++ b/src/mechanize/form/multi_select_list.cr @@ -1,5 +1,6 @@ require "./option" +# This class represents class Mechanize::FormContent::RadioButton < Mechanize::FormContent::Field property :checked, :form @@ -7,19 +8,23 @@ class Mechanize::FormContent::RadioButton < Mechanize::FormContent::Field super(node) end + # set radiobutton checked def check uncheck_peers @checked = true end + # set radiobutton checked def uncheck @checked = false end + # change radiobutton state checked or unchecked def click checked ? uncheck : check end + # returns radiobutton checked or not def checked? checked end diff --git a/src/mechanize/form/select_list.cr b/src/mechanize/form/select_list.cr index b3acde2..4670e08 100644 --- a/src/mechanize/form/select_list.cr +++ b/src/mechanize/form/select_list.cr @@ -1,5 +1,6 @@ require "./multi_select_list" +# This class represents