Bug 1253989 Part 5 - Make contents become multiple lines in test_selectioncarets.html. r?mtseng draft
authorTing-Yu Lin <tlin@mozilla.com>
Tue, 08 Mar 2016 01:23:27 +0800
changeset 337424 ccac168f3a217144e70ac5a0d4da51733da4be9e
parent 337423 6b60e5b45e00c236d1728e74ea258cc6e69a6457
child 337425 6692e7600eb31dddc9ac532bf75a9a45e4f29ee2
push id12354
push usertlin@mozilla.com
push dateMon, 07 Mar 2016 17:24:46 +0000
reviewersmtseng
bugs1253989
milestone48.0a1
Bug 1253989 Part 5 - Make contents become multiple lines in test_selectioncarets.html. r?mtseng We now make test_minimum_select_one_character() cover multiple line tests. MozReview-Commit-ID: AK1SuxiEq5X
layout/base/tests/marionette/test_accessiblecaret_selection_mode.py
testing/marionette/harness/marionette/www/test_carets_selection.html
testing/marionette/harness/marionette/www/test_selectioncarets_multipleline.html
--- a/layout/base/tests/marionette/test_accessiblecaret_selection_mode.py
+++ b/layout/base/tests/marionette/test_accessiblecaret_selection_mode.py
@@ -23,19 +23,17 @@ def skip_if_not_rotatable(target):
 
 class AccessibleCaretSelectionModeTestCase(MarionetteTestCase):
     '''Test cases for AccessibleCaret under selection mode.'''
     _input_id = 'input'
     _textarea_id = 'textarea'
     _textarea2_id = 'textarea2'
     _textarea_rtl_id = 'textarea-rtl'
     _contenteditable_id = 'contenteditable'
-    _contenteditable2_id = 'contenteditable2'
     _content_id = 'content'
-    _content2_id = 'content2'
     _non_selectable_id = 'non-selectable'
 
     def setUp(self):
         # Code to execute before every test is running.
         super(AccessibleCaretSelectionModeTestCase, self).setUp()
         self.carets_tested_pref = 'layout.accessiblecaret.enabled'
         self.prefs = {
             'layout.word_select.eat_space_to_next_word': False,
@@ -44,20 +42,16 @@ class AccessibleCaretSelectionModeTestCa
         }
         self.marionette.set_prefs(self.prefs)
         self.actions = Actions(self.marionette)
 
     def open_test_html(self):
         test_html = self.marionette.absolute_url('test_carets_selection.html')
         self.marionette.navigate(test_html)
 
-    def open_test_html2(self):
-        test_html2 = self.marionette.absolute_url('test_selectioncarets_multipleline.html')
-        self.marionette.navigate(test_html2)
-
     def open_test_html_multirange(self):
         test_html = self.marionette.absolute_url('test_carets_multiplerange.html')
         self.marionette.navigate(test_html)
 
     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
         spaces = tokens[0::2]                     # collect spaces at odd indices
@@ -202,32 +196,25 @@ class AccessibleCaretSelectionModeTestCa
 
         # Drag the first caret to the previous position of the second caret.
         self.actions.flick(el, caret1_x, caret1_y, caret2_x, caret2_y).perform()
 
         self.assertEqual(target_content, sel.selected_content)
 
     @parameterized(_input_id, el_id=_input_id)
     @parameterized(_textarea_id, el_id=_textarea_id)
+    @parameterized(_textarea2_id, el_id=_textarea2_id)
     @parameterized(_textarea_rtl_id, el_id=_textarea_rtl_id)
     @parameterized(_contenteditable_id, el_id=_contenteditable_id)
     @parameterized(_content_id, el_id=_content_id)
     def test_minimum_select_one_character(self, el_id):
         self.open_test_html()
         el = self.marionette.find_element(By.ID, el_id)
         self._test_minimum_select_one_character(el)
 
-    @parameterized(_textarea2_id, el_id=_textarea2_id)
-    @parameterized(_contenteditable2_id, el_id=_contenteditable2_id)
-    @parameterized(_content2_id, el_id=_content2_id)
-    def test_minimum_select_one_character2(self, el_id):
-        self.open_test_html2()
-        el = self.marionette.find_element(By.ID, el_id)
-        self._test_minimum_select_one_character(el)
-
     def _test_minimum_select_one_character(self, el, x=None, y=None):
         sel = SelectionManager(el)
         original_content = sel.content
         words = original_content.split()
         self.assertTrue(len(words) >= 1, 'Expect at least one word in the content.')
 
         # Get the location of the selection carets at the end of the content for
         # later use.
--- a/testing/marionette/harness/marionette/www/test_carets_selection.html
+++ b/testing/marionette/harness/marionette/www/test_carets_selection.html
@@ -2,31 +2,34 @@
    - 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">
   <head>
     <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
     <title>Marionette tests for AccessibleCaret in selection mode</title>
+    <style>
+    .block {
+      width: 10em;
+      height: 6em;
+      word-wrap: break-word;
+      overflow: auto;
+    }
+    </style>
   </head>
   <body>
-  <style>
-  div.block {
-    width: 10em;
-    height: 4em;
-    word-wrap: break-word;
-    overflow: auto;
-  }
-  </style>
     <div><input id="input" value="ABC DEF GHI"></div>
-    <br />
-    <div><textarea id="textarea" rows="4" cols="8">ABC DEF GHI JKL MNO PQR</textarea></div>
-    <br />
+    <br>
+    <div>
+      <textarea id="textarea" rows="4" cols="8">ABC DEF GHI JKL MNO PQR</textarea>
+      <textarea class="block" id="textarea2">First Line&#13;&#10;&#13;&#10;Second Line&#13;&#10;&#13;&#10;Third Line</textarea>
+    </div>
+    <br>
     <div><textarea dir="rtl" id="textarea-rtl" rows="8" cols="8">موزيلا فيرفكس موزيلا فيرفكس</textarea></div>
-    <br />
-    <div class="block" contenteditable="true" id="contenteditable">ABC DEF GHI</div>
-    <br />
-    <div class="block" id="content">ABC DEF GHI</div>
-    <br />
+    <br>
+    <div class="block" contenteditable="true" id="contenteditable">First Line<br><br>Second Line<br><br>Third Line</div>
+    <br>
+    <div class="block" id="content">First Line<br><br>Second Line<br><br>Third Line</div>
+    <br>
     <div style="-moz-user-select: none;" id="non-selectable">Non-selectable</div>
   </body>
 </html>
deleted file mode 100644
--- a/testing/marionette/harness/marionette/www/test_selectioncarets_multipleline.html
+++ /dev/null
@@ -1,24 +0,0 @@
-<!-- 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">
-  <head>
-    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
-    <title>Bug 1019441: Marionette tests for selection carets (multiple lines)</title>
-  </head>
-  <body>
-  <style>
-    *
-    {
-      -moz-user-select:none;
-    }
-  </style>
-    <div><textarea id="textarea2" style="width: 10em; height: 6em; overflow: auto;">First Line&#13;&#10;&#13;&#10;Second Line&#13;&#10;&#13;&#10;Third Line</textarea></div>
-    <br />
-    <div style="width: 10em; height: 6em; overflow: auto; -moz-user-select:text" id="contenteditable2" contenteditable="true">First Line<br></br>Second Line<br></br>Third Line</div>
-    <br />
-    <div style="width: 10em; height: 6em; overflow: auto; -moz-user-select:text" id="content2">First Line<br></br>Second Line<br></br>Third Line</div>
-  </body>
-</html>