Module: DocumentWidget

Includes:
PageObject
Defined in:
lib/sakai-oae-test-api/widgets.rb

Overview

Methods associated with documents that use the TinyMCE Editor.

Instance Method Summary collapse

Methods included from PageObject

#method_missing, #name_li, #name_link

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class PageObject

Instance Method Details

#add_content=(text) ⇒ Object

Appends the specified string to the contents of the TinyMCE Editor.



67
68
69
70
# File 'lib/sakai-oae-test-api/widgets.rb', line 67

def add_content=(text)
  self.frame(:id=>"elm1_ifr").body(:id=>"tinymce").fire_event("onclick")
  self.frame(:id=>"elm1_ifr").send_keys(text)
end

#insert_textObject

Clicks the Text Box of the TinyMCE Editor so that the edit cursor will become active in the Editor.



79
80
81
# File 'lib/sakai-oae-test-api/widgets.rb', line 79

def insert_text
  self.frame(:id=>"elm1_ifr").body(:id=>"tinymce").fire_event("onclick")
end

#saveObject

Clicks the Save button. Waits for Ajax calls to fall off.



52
53
54
55
56
# File 'lib/sakai-oae-test-api/widgets.rb', line 52

def save
  self.save_button
  sleep 1
  self.wait_for_ajax
end

#select_allObject

Selects all the contents of the TinyMCE Editor



73
74
75
# File 'lib/sakai-oae-test-api/widgets.rb', line 73

def select_all
  self.frame(:id=>"elm1_ifr").send_keys( [:command, 'a'] )
end

#set_content=(text) ⇒ Object

Erases the entire contents of the TinyMCE Editor, then enters the specified string into the Editor.



60
61
62
63
64
# File 'lib/sakai-oae-test-api/widgets.rb', line 60

def set_content=(text)
  self.frame(:id=>"elm1_ifr").body(:id=>"tinymce").fire_event("onclick")
  self.frame(:id=>"elm1_ifr").send_keys( [:command, 'a'] )
  self.frame(:id=>"elm1_ifr").send_keys(text)
end