Permalink
Browse files

Fix focus issues for IE9 and add support for initUIEvent

  • Loading branch information...
1 parent a8ea0ea commit 8ceccde1e0571617f6ddd924f6b188b75ac26db7 Hugh McGowan committed Jan 17, 2012
Showing with 13 additions and 9 deletions.
  1. +1 −1 spec/implementation.rb
  2. +1 −1 spec/watirspec
  3. +4 −0 watir/lib/watir/element.rb
  4. +7 −7 watir/lib/watir/input_elements.rb
View
@@ -11,7 +11,7 @@
imp.browser_class = FireWatir::Firefox
browser = :firefox
else
- WatirSpec.persistent_browser = true
+ WatirSpec.persistent_browser = false
imp.browser_class = Watir::IE
browser = :ie
end
@@ -416,6 +416,10 @@ def create_event(event)
event_name = :initEvent
event_type = 'HTMLEvents'
event_args = [event, true, true]
+ when 'select'
+ event_name = :initUIEvent
+ event_type = 'UIEvent'
+ event_args = [event, true, true, @container.page_container.document.parentWindow.window,0]
when 'keydown', 'keypress', 'keyup'
event_name = :initKeyboardEvent
event_type = 'KeyboardEvent'
@@ -237,8 +237,8 @@ def drag_contents_to(destination_how, destination_what)
raise UnknownObjectException, "Unable to locate destination using #{destination_how } and #{destination_what } "
end
- @o.focus
- @o.select
+ @o.focus(0)
+ @o.select(0)
value = self.value
dispatch_event("onSelect")
@@ -265,8 +265,8 @@ def clear
highlight(:set)
@o.scrollIntoView
- @o.focus
- @o.select
+ @o.focus(0)
+ @o.select(0)
dispatch_event("onSelect")
@o.value = ""
dispatch_event("onKeyPress")
@@ -286,7 +286,7 @@ def append(value)
highlight(:set)
@o.scrollIntoView
- @o.focus
+ @o.focus(0)
type_by_character(value)
highlight(:clear)
end
@@ -303,8 +303,8 @@ def set(value)
highlight(:set)
@o.scrollIntoView
if type_keys
- @o.focus
- @o.select
+ @o.focus(0)
+ @o.select(0)
dispatch_event("onSelect")
dispatch_event("onKeyPress")
@o.value = ""

0 comments on commit 8ceccde

Please sign in to comment.