Module: EDSL::PageObject::JavascriptFrameworkFacade

Defined in:
lib/edsl/page_object/ajax_support.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

Class Method Details

.add_framework(key, value) ⇒ Object

Add a framework and make it available to the system.



41
42
43
44
45
# File 'lib/edsl/page_object/ajax_support.rb', line 41

def add_framework(key, value)
  raise invalid_framework unless value.respond_to? :pending_requests
  initialize_script_builder unless @builder
  @builder[key] = value
end

.frameworkObject

Get the framework that will be used



34
35
36
# File 'lib/edsl/page_object/ajax_support.rb', line 34

def framework
  @framework
end

.framework=(framework) ⇒ Object

Set the framework to use.

@param the framework to use. :jquery, :prototype, :yui, and :angularjs are supported



25
26
27
28
29
# File 'lib/edsl/page_object/ajax_support.rb', line 25

def framework=(framework)
  initialize_script_builder unless @builder
  raise unknown_framework(framework) unless @builder[framework]
  @framework = framework
end

.pending_requestsObject

get the javascript to determine number of pending requests



50
51
52
# File 'lib/edsl/page_object/ajax_support.rb', line 50

def pending_requests
  script_builder.pending_requests
end

.script_builderObject



54
55
56
57
# File 'lib/edsl/page_object/ajax_support.rb', line 54

def script_builder
  initialize_script_builder unless @builder
  @builder[@framework]
end