Module: PageObject::JavascriptFrameworkFacade
- Defined in:
- lib/page-object/javascript_framework_facade.rb
Overview
Provide hooks into different common Javascript Frameworks. Currently this module only supports jQuery and Prototype but it has the ability for you to plug your own framework into it and therefore have it work with this gem. You do this by calling the #add_framework method. The module you provide must implement the necessary methods. Please look at the jQuery or Prototype implementations to determine the necessary methods
Class Method Summary collapse
-
.add_framework(key, value) ⇒ Object
Add a framework and make it available to the system.
-
.framework ⇒ Object
Get the framework that will be used.
-
.framework=(framework) ⇒ Object
Set the framework to use.
-
.pending_requests ⇒ Object
get the javascript to determine number of pending requests.
- .script_builder ⇒ Object
Class Method Details
.add_framework(key, value) ⇒ Object
Add a framework and make it available to the system.
42 43 44 45 46 |
# File 'lib/page-object/javascript_framework_facade.rb', line 42 def add_framework(key, value) raise invalid_framework unless value.respond_to? :pending_requests initialize_script_builder unless @builder @builder[key] = value end |
.framework ⇒ Object
Get the framework that will be used
35 36 37 |
# File 'lib/page-object/javascript_framework_facade.rb', line 35 def framework @framework end |
.framework=(framework) ⇒ Object
Set the framework to use.
@param the framework to use. :jquery, :prototype, :yui, and :angularjs are supported
26 27 28 29 30 |
# File 'lib/page-object/javascript_framework_facade.rb', line 26 def framework=(framework) initialize_script_builder unless @builder raise unknown_framework(framework) unless @builder[framework] @framework = framework end |
.pending_requests ⇒ Object
get the javascript to determine number of pending requests
51 52 53 |
# File 'lib/page-object/javascript_framework_facade.rb', line 51 def pending_requests script_builder.pending_requests end |
.script_builder ⇒ Object
55 56 57 58 |
# File 'lib/page-object/javascript_framework_facade.rb', line 55 def script_builder initialize_script_builder unless @builder @builder[@framework] end |