Skip to content

Commit

Permalink
Merge pull request #18 from mvdwg/default-container
Browse files Browse the repository at this point in the history
Set default container
  • Loading branch information
san650 authored Sep 12, 2016
2 parents 7dd0d97 + 1d56053 commit df5a275
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
8 changes: 4 additions & 4 deletions addon/animation.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ import Ember from 'ember';

const { $, RSVP } = Ember;

// 100px in 1000ms
const SPEED = 100 / 400;
// 100px in 300ms
const SPEED = 100 / 300;

const SCROLL_SPEED = 2000;

Expand All @@ -17,11 +17,11 @@ function sleep(milliseconds) {

function clickEffectBefore() {
pointer('#ember-testing').addClass('tsClick');
return sleep(300);
return sleep(200);
}

function clickEffectAfter() {
return sleep(1000).then(() => pointer('#ember-testing').removeClass('tsClick'));
return sleep(500).then(() => pointer('#ember-testing').removeClass('tsClick'));
}

function distance(a,b) {
Expand Down
8 changes: 6 additions & 2 deletions addon/page-object-execution-context.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import { buildSelector } from 'ember-cli-page-object';
import Animation from './animation';

const defaultContainer = '#ember-testing';

export default function TellingStoriesContext(pageObjectNode) {
this.pageObjectNode = pageObjectNode;
}
Expand All @@ -27,7 +29,7 @@ TellingStoriesContext.prototype = {
click(selector, container) {
/* global wait */
wait()
.then(Animation.movePointerTo(selector, container))
.then(Animation.movePointerTo(selector, container || defaultContainer))
.then(Animation.clickEffectBefore());

/* global click */
Expand All @@ -38,7 +40,9 @@ TellingStoriesContext.prototype = {

fillIn(selector, container, text) {
/* global wait */
wait().then(Animation.movePointerTo(selector, container));
wait()
.then(Animation.movePointerTo(selector, container || defaultContainer))
.then(Animation.clickEffectBefore());

/* global fillIn */
if (container) {
Expand Down

0 comments on commit df5a275

Please sign in to comment.