[libweasel-perl] 15/24: * Add clear() API for input elements
Robert James Clay
jame at rocasa.us
Tue Aug 15 19:16:08 UTC 2017
This is an automated email from the git hooks/post-receive script.
jame-guest pushed a commit to tag v0.02
in repository libweasel-perl.
commit 2023fb584bd041d20089fe552ef39adef8e330d6
Author: Erik Huelsmann <ehuels at gmail.com>
Date: Sat Jun 18 14:12:29 2016 +0200
* Add clear() API for input elements
---
lib/Weasel/DriverRole.pm | 11 +++++++++++
lib/Weasel/Session.pm | 10 ++++++++++
lib/Weasel/Widgets/HTML/Input.pm | 10 ++++++++++
3 files changed, 31 insertions(+)
diff --git a/lib/Weasel/DriverRole.pm b/lib/Weasel/DriverRole.pm
index c7dc40e..24fb003 100644
--- a/lib/Weasel/DriverRole.pm
+++ b/lib/Weasel/DriverRole.pm
@@ -113,6 +113,17 @@ sub wait_for {
}
+=item clear($element_id)
+
+Clicks on an element if an element id is provided, or on the current
+mouse location otherwise.
+
+=cut
+
+sub clear {
+ croak "Abstract interface method 'clear' called";
+}
+
=item click( [ $element_id ] )
Clicks on an element if an element id is provided, or on the current
diff --git a/lib/Weasel/Session.pm b/lib/Weasel/Session.pm
index 0c2559f..ce54475 100644
--- a/lib/Weasel/Session.pm
+++ b/lib/Weasel/Session.pm
@@ -104,6 +104,16 @@ sub _page_builder {
=over
+=item clear($element)
+
+=cut
+
+sub clear {
+ my ($self, $element) = @_;
+
+ $self->driver->clear($element->_id);
+}
+
=item click([$element])
=cut
diff --git a/lib/Weasel/Widgets/HTML/Input.pm b/lib/Weasel/Widgets/HTML/Input.pm
index 253faf9..487b7c0 100644
--- a/lib/Weasel/Widgets/HTML/Input.pm
+++ b/lib/Weasel/Widgets/HTML/Input.pm
@@ -45,6 +45,16 @@ register_widget_handler(
=over
+=item clear()
+
+=cut
+
+sub clear {
+ my ($self) = @_;
+
+ $self->session->clear($self);
+}
+
=item value([$value])
Gets the 'value' attribute; if C<$value> is provided, it is used to set the
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-perl/packages/libweasel-perl.git
More information about the Pkg-perl-cvs-commits
mailing list