Skip to content

Commit

Permalink
Remove ember-window-mock dependency
Browse files Browse the repository at this point in the history
  • Loading branch information
RobbieTheWagner committed Jan 14, 2018
1 parent 16a5bdb commit 46aaa97
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 25 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
We will list changes, especially breaking changes, between versions here.

### **3.1.0**
* Removed `ember-window-mock` dependency

### **3.0.0**
* Removed `autoStart`, so this is a breaking change if you were relying on the tour to start itself.

Expand Down
6 changes: 2 additions & 4 deletions addon/services/tour.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import { get, observer, set } from '@ember/object';
import { isEmpty, isPresent } from '@ember/utils';
import Service, { inject as service } from '@ember/service';
import Service from '@ember/service';
import Evented from '@ember/object/evented';
import { run } from '@ember/runloop';
import {
Expand All @@ -14,8 +14,6 @@ import {
} from '../utils';

export default Service.extend(Evented, {
window: service(),

// Configuration Options
confirmCancel: false,
confirmCancelMessage: null,
Expand Down Expand Up @@ -228,7 +226,7 @@ export default Service.extend(Evented, {
const cancelMessage = confirmCancelMessage || 'Are you sure you want to stop the tour?';

const newCancelFunction = () => {
const stopTour = get(this, 'window').confirm(cancelMessage);
const stopTour = window.confirm(cancelMessage);
if (stopTour) {
cancelFunction();
}
Expand Down
1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@
"ember-cli-babel": "^6.6.0",
"ember-cli-node-assets": "0.2.2",
"ember-tether": "1.0.0-beta.0",
"ember-window-mock": "^0.2.1",
"fastboot-transform": "^0.1.2",
"tether-shepherd": "1.8.1"
},
Expand Down
7 changes: 2 additions & 5 deletions tests/acceptance/ember-shepherd-test.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { click, find, findAll } from 'ember-native-dom-helpers';
import { module, test } from 'qunit';
import { visit } from '@ember/test-helpers';
import { lookupWindow } from 'ember-window-mock';
import { setupApplicationTest } from 'ember-qunit';
import sinonTest from 'ember-sinon-qunit/test-support/test';
import steps from '../data';
Expand Down Expand Up @@ -124,9 +123,7 @@ module('Acceptance | Tour functionality tests', function(hooks) {
}
}];

const window = lookupWindow(this);
const stub = this.stub(window, 'confirm');
stub.returns(true);
const spy = this.spy(window, 'confirm');

await visit('/');

Expand All @@ -139,7 +136,7 @@ module('Acceptance | Tour functionality tests', function(hooks) {

await click('.shepherd-open a.shepherd-cancel-link', document.documentElement);

assert.ok(stub.calledOnce);
assert.ok(spy.calledOnce);
});

test('Modal page contents', async function(assert) {
Expand Down
5 changes: 0 additions & 5 deletions tests/unit/services/tour-test.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { module, test } from 'qunit';
import { setupTest } from 'ember-qunit';
import EmberObject from '@ember/object';
import { mockWindow } from 'ember-window-mock';
import { run } from '@ember/runloop';
import { getElementPosition, setPositionForHighlightElement } from 'ember-shepherd/utils';

Expand Down Expand Up @@ -37,10 +36,6 @@ const steps = [
module('Unit | Service | tour', function(hooks) {
setupTest(hooks);

hooks.beforeEach(function() {
mockWindow(this);
});

test('it starts the tour when the `start` event is triggered', function(assert) {
assert.expect(1);

Expand Down
13 changes: 3 additions & 10 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2347,9 +2347,9 @@ electron-to-chromium@^1.3.30:
dependencies:
electron-releases "^2.1.0"

ember-assign-polyfill@2.1.0:
version "2.1.0"
resolved "https://registry.yarnpkg.com/ember-assign-polyfill/-/ember-assign-polyfill-2.1.0.tgz#0d339284617548d1564c02cf7490ad9c021715fc"
ember-assign-polyfill@2.2.0:
version "2.2.0"
resolved "https://registry.yarnpkg.com/ember-assign-polyfill/-/ember-assign-polyfill-2.2.0.tgz#7953836e5ccd4da05b2493423d3efc00df80ca74"
dependencies:
ember-cli-babel "^6.8.2"
ember-cli-version-checker "^2.0.0"
Expand Down Expand Up @@ -2956,13 +2956,6 @@ ember-try@^0.2.15:
rsvp "^3.0.17"
semver "^5.1.0"

ember-window-mock@^0.2.1:
version "0.2.1"
resolved "https://registry.yarnpkg.com/ember-window-mock/-/ember-window-mock-0.2.1.tgz#3b6a59f667f84ef2d019068d799322d424211132"
dependencies:
broccoli-funnel "^2.0.1"
ember-cli-babel "^6.6.0"

encodeurl@~1.0.1:
version "1.0.1"
resolved "https://registry.yarnpkg.com/encodeurl/-/encodeurl-1.0.1.tgz#79e3d58655346909fe6f0f45a5de68103b294d20"
Expand Down

0 comments on commit 46aaa97

Please sign in to comment.