Skip to content

Commit

Permalink
marionette test
Browse files Browse the repository at this point in the history
  • Loading branch information
cctuan committed Nov 3, 2014
1 parent ab50579 commit 54b6c18
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 41 deletions.
47 changes: 7 additions & 40 deletions apps/system/test/marionette/lib/faketextselectionapp.js
Original file line number Diff line number Diff line change
Expand Up @@ -79,45 +79,12 @@ FakeTextSelectionApp.prototype = {
* @param {String} ele query string of dom element.
*/
press: function(target) {
var boxInfo = this.client.executeScript(
function(ele) {
var activeDom = document.querySelector(ele);
activeDom.click();
var defaultPosition = activeDom.getBoundingClientRect();
return {
top: defaultPosition.top,
left: defaultPosition.left,
right: defaultPosition.right,
bottom: defaultPosition.bottom
};
}, [FakeTextSelectionApp.Selector[target]]);
// TextSelection dialog exists in system app scope.
this.client.switchToFrame();
this.client.executeScript(function(boxInfoTop, boxInfoBottom,
boxInfoLeft, boxInfoRight) {
window.dispatchEvent(new CustomEvent('mozChromeEvent', {
detail: {
type: 'selectionchange',
detail: {
commands: {
canPaste: true,
canCut: true,
canCopy: true,
canSelectAll: true
},
offsetY: 0,
offsetX: 0,
zoomFactor: 1,
rect: {
top: boxInfoTop,
bottom: boxInfoBottom,
left: boxInfoLeft,
right: boxInfoRight
},
reasons: ['mouseup']
}
}
}));
}, [boxInfo.top, boxInfo.bottom, boxInfo.left, boxInfo.right]);
console.log(target);
console.log(FakeTextSelectionApp.Selector[target]);
var ele = this.client.helper.waitForElement(
FakeTextSelectionApp.Selector[target]);
this.actions.longPress(ele, 2).perform();

this.client.helper.wait(50000);
}
};
5 changes: 4 additions & 1 deletion apps/system/test/marionette/text_selection_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,10 @@ marionette('Text selection >', function() {
var client = marionette.client({
apps: apps,
prefs: {
'dom.w3c_touch_events.enabled': 1
'dom.w3c_touch_events.enabled': 1,
'selectioncaret.enabled': true,
'dom.mozInputMethod.enabled': false,
'docshell.device_size_is_page_size': true
},
settings: {
'ftu.manifestURL': null,
Expand Down

0 comments on commit 54b6c18

Please sign in to comment.