mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1206545 - Add a marionette test case. r=roc
Test AccessibleCaretEventHub is properly initialized if <html> has "display: none" initially.
This commit is contained in:
parent
621c636afa
commit
cdf85d3b0f
@ -79,6 +79,14 @@ class CommonCaretsTestCase(object):
|
||||
|
||||
self._iframe = self.marionette.find_element(By.ID, 'frame')
|
||||
|
||||
def open_test_html_display_none(self):
|
||||
'Open html for testing html with display: none.'
|
||||
test_html = self.marionette.absolute_url('test_carets_display_none.html')
|
||||
self.marionette.navigate(test_html)
|
||||
|
||||
self._html = self.marionette.find_element(By.ID, 'html')
|
||||
self._content = self.marionette.find_element(By.ID, 'content')
|
||||
|
||||
def word_offset(self, text, ordinal):
|
||||
'Get the character offset of the ordinal-th word in text.'
|
||||
tokens = re.split(r'(\S+)', text) # both words and spaces
|
||||
@ -437,6 +445,23 @@ class CommonCaretsTestCase(object):
|
||||
|
||||
self.assertNotEqual(self.to_unix_line_ending(sel.selected_content), '')
|
||||
|
||||
def test_carets_initialized_in_display_none(self):
|
||||
'''Test AccessibleCaretEventHub is properly initialized on a <html> with
|
||||
display: none.
|
||||
|
||||
'''
|
||||
self.open_test_html_display_none()
|
||||
|
||||
# Remove 'display: none' from <html>
|
||||
self.marionette.execute_script(
|
||||
'arguments[0].style.display = "unset";',
|
||||
script_args=[self._html]
|
||||
)
|
||||
|
||||
# If AccessibleCaretEventHub is initialized successfully, select a word
|
||||
# should work.
|
||||
self._test_long_press_to_select_a_word(self._content, self.assertEqual)
|
||||
|
||||
########################################################################
|
||||
# <input> test cases with selection carets enabled
|
||||
########################################################################
|
||||
|
@ -0,0 +1,10 @@
|
||||
<!-- This Source Code Form is subject to the terms of the Mozilla Public
|
||||
- License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
- file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
|
||||
|
||||
<!DOCTYPE html>
|
||||
<html id="html" style="display: none">
|
||||
<body>
|
||||
<div id="content">ABC DEF GHI</div>
|
||||
</body>
|
||||
</html>
|
Loading…
Reference in New Issue
Block a user