예제 #1
0
    def _test_minimum_select_one_character_by_selection(self, el, assertFunc):
        sel = SelectionManager(el)
        el.tap()
        sel.select_all()

        # Move the right caret to the position of the left caret. Since the
        # minimum selection range by selection carets is one character, the
        # first character should be selected.
        (caret1_x, caret1_y), (caret2_x, caret2_y) = sel.selection_carets_location()
        self.actions.flick(el, caret2_x, caret2_y, caret1_x, caret1_y).perform()

        cmd = sel.js_selection_cmd() +\
            '''return (sel.anchorNode == sel.focusNode) &&
                      (sel.focusOffset - sel.anchorOffset == 1);'''
        result = self.marionette.execute_script(cmd, script_args=[el])

        assertFunc(result)