diff --git a/.watchmanconfig b/.watchmanconfig
new file mode 100644
index 00000000..5e9462c2
--- /dev/null
+++ b/.watchmanconfig
@@ -0,0 +1,3 @@
+{
+ "ignore_dirs": ["tmp"]
+}
diff --git a/Brocfile.js b/Brocfile.js
deleted file mode 100644
index 26496a84..00000000
--- a/Brocfile.js
+++ /dev/null
@@ -1,26 +0,0 @@
-/* jshint node: true */
-/* global require, module */
-
-var EmberAddon = require('ember-cli/lib/broccoli/ember-addon');
-
-var app = new EmberAddon();
-app.import('bower_components/bootstrap-sass/assets/javascripts/bootstrap.js');
-app.import("bower_components/zeroclipboard/dist/ZeroClipboard.js");
-app.import("bower_components/zeroclipboard/dist/ZeroClipboard.swf", {
- destDir: "assets"
-});
-
-// Use `app.import` to add additional libraries to the generated
-// output files.
-//
-// If you need to use different assets in different
-// environments, specify an object as the first parameter. That
-// object's keys should be the environment name and the values
-// should be the asset to use in that environment.
-//
-// If the library that you are including contains AMD or ES6
-// modules that you would like to import into your application
-// please specify an object with the list of modules as keys
-// along with the exports of each module as its value.
-
-module.exports = app.toTree();
diff --git a/README.md b/README.md
index 50d306c9..03a816fc 100644
--- a/README.md
+++ b/README.md
@@ -22,8 +22,4 @@ This README outlines the details of collaborating on this Ember addon.
* `ember build`
-## Releasing
-
-* `ember release`
-
For more information on using ember-cli, visit [http://www.ember-cli.com/](http://www.ember-cli.com/).
diff --git a/app/components/click-to-copy/component.js b/app/components/click-to-copy/component.js
index 7a4e17b9..2646a049 100644
--- a/app/components/click-to-copy/component.js
+++ b/app/components/click-to-copy/component.js
@@ -1,29 +1,47 @@
-/*global ZeroClipboard*/
+/*global Clipboard*/
import Ember from 'ember';
export default Ember.Component.extend({
+ actionLabel: 'Copy',
+ classNames: ['click-to-copy'],
+ Clipboard: Clipboard,
+ errorMessage: 'Press ⌘+C to copy',
+ isTooltipped: false,
+ message: null,
+ successMessage: 'Copied!',
tagName: 'span',
- copied: false,
text: null,
- title: "Click to copy",
- 'data-clipboard-text': Ember.computed.alias('text'),
+ dataClipboardText: Ember.computed.alias('text'),
- attributeBindings: ['data-clipboard-text', 'title'],
+ attributeBindings: ['dataClipboardText:data-clipboard-text',
+ 'message:data-message'],
+
+ classNameBindings: ['isTooltipped:tooltipped'],
setupClipboard: Ember.on('didInsertElement', function(){
- this.clipboard = new ZeroClipboard( this.$() );
- this.clipboard.on('aftercopy', Ember.run.bind(this, 'afterCopy'));
+ this.clipboard = new this.Clipboard('#' + this.elementId);
+ this.clipboard.on('success', Ember.run.bind(this, 'success'));
+ this.clipboard.on('error', Ember.run.bind(this, 'error'));
}),
- afterCopy: function(){
- this.set('copied', true);
- Ember.run.later(this, 'set', 'copied', false, 1500);
+ success: function(){
+ this.set('message', this.successMessage);
+ this.showMessage();
+ },
+
+ error: function(){
+ this.set('message', this.errorMessage);
+ this.showMessage();
},
- teardownClipboard: Ember.on('willDestroyElement', function(){
- if (this.clipboard) {
- this.clipboard.destroy();
- }
- })
+ showMessage: function() {
+ this.set('isTooltipped', true);
+
+ Ember.run.later(() => {
+ if (!this.isDestroying && !this.isDestroyed) {
+ this.set('isTooltipped', false);
+ }
+ });
+ }
});
diff --git a/app/styles/_global.scss b/app/styles/_global.scss
index 887bc2c5..ec8b5c73 100644
--- a/app/styles/_global.scss
+++ b/app/styles/_global.scss
@@ -94,4 +94,4 @@ pre.code,
.instructions-section {
margin: 0 0 15px;
}
-}
\ No newline at end of file
+}
diff --git a/app/styles/aptible.scss b/app/styles/aptible.scss
index 871bcbbe..b3cc9546 100644
--- a/app/styles/aptible.scss
+++ b/app/styles/aptible.scss
@@ -13,3 +13,4 @@
@import "layout";
@import "panels";
@import "sidebar";
+@import "components/click-to-copy";
diff --git a/app/styles/components/_click-to-copy.scss b/app/styles/components/_click-to-copy.scss
new file mode 100644
index 00000000..119c8890
--- /dev/null
+++ b/app/styles/components/_click-to-copy.scss
@@ -0,0 +1,54 @@
+// Click To Copy Component
+// See also
+// - app/templates/components/click-to-copy.hbs
+// - app/components/click-to-copy/component.js
+// Styles a span tag with expected attributes
+// `Copy`
+.click-to-copy {
+ color: $color-bright-blue;
+ cursor: pointer;
+ &:hover {
+ text-decoration: underline;
+ }
+ &.tooltipped {
+ position: relative;
+ // This is the tooltip bubble
+ &:after {
+ -webkit-font-smoothing: subpixel-antialiased;
+ background-color: rgba(0,0,0,0.75);
+ border-radius: 3px;
+ color: white;
+ content: attr(data-message);
+ display: inline-block;
+ font: normal normal 11px/1.5;
+ letter-spacing: normal;
+ margin-top: 5px;
+ padding: 5px 8px;
+ pointer-events: none;
+ position: absolute;
+ right: 50%;
+ text-align: center;
+ top: 100%;
+ transform: translateX(50%);
+ white-space: pre;
+ z-index: 1000000;
+ }
+ // This is the tooltip arrow
+ &:before {
+ border: 5px solid transparent;
+ border-bottom-color: rgba(0,0,0,0.75);
+ bottom: -5px;
+ color: rgba(0,0,0,0.75);
+ content: "";
+ display: inline-block;
+ height: 0;
+ margin-right: -5px;
+ pointer-events: none;
+ position: absolute;
+ right: 50%;
+ top: auto;
+ width: 0;
+ z-index: 1000001;
+ }
+ }
+}
diff --git a/app/templates/components/click-to-copy.hbs b/app/templates/components/click-to-copy.hbs
index 84bbe6fb..1ba41e83 100644
--- a/app/templates/components/click-to-copy.hbs
+++ b/app/templates/components/click-to-copy.hbs
@@ -1 +1 @@
-{{yield copied}}
+{{actionLabel}}
diff --git a/blueprints/ember-cli-aptible-shared/index.js b/blueprints/ember-cli-aptible-shared/index.js
index 3417924c..14766177 100644
--- a/blueprints/ember-cli-aptible-shared/index.js
+++ b/blueprints/ember-cli-aptible-shared/index.js
@@ -4,7 +4,7 @@ module.exports = {
return this.addBowerPackagesToProject([
{ name: 'animate', source: 'daneden/animate.css' },
{ name: 'bootstrap-sass', source: 'twbs/bootstrap-sass' },
- { name: 'zeroclipboard', target: '~2.2.0' }
+ { name: 'clipboard', target: '~1.3.1' }
]);
}
-};
\ No newline at end of file
+};
diff --git a/bower.json b/bower.json
index 3e4710ab..232bb779 100644
--- a/bower.json
+++ b/bower.json
@@ -1,19 +1,19 @@
{
"name": "ember-cli-aptible-shared",
"dependencies": {
- "ember": "1.12.0",
+ "ember": "1.13.10",
"ember-data": "1.0.0-beta.18",
- "ember-resolver": "~0.1.15",
+ "ember-resolver": "~0.1.18",
"ember-cli-shims": "ember-cli/ember-cli-shims#0.0.3",
"ember-cli-test-loader": "ember-cli-test-loader#0.1.3",
- "ember-load-initializers": "ember-cli/ember-load-initializers#0.1.4",
- "ember-qunit": "0.3.1",
+ "ember-load-initializers": "ember-cli/ember-load-initializers#0.1.5",
+ "ember-qunit": "0.4.13",
"ember-qunit-notifications": "0.0.7",
"jquery": "^1.11.1",
"loader.js": "ember-cli/loader.js#3.2.0",
"pretender": "~0.6.0",
- "qunit": "~1.17.1",
- "zeroclipboard": "~2.2.0",
+ "qunit": "~1.19.0",
+ "clipboard": "~1.3.1",
"JavaScript-MD5": "~1.1.0",
"bootstrap-sass": "twbs/bootstrap-sass#~3.3.5"
}
diff --git a/ember-cli-build.js b/ember-cli-build.js
new file mode 100644
index 00000000..c35524af
--- /dev/null
+++ b/ember-cli-build.js
@@ -0,0 +1,22 @@
+/* jshint node: true */
+/* global require, module */
+
+var EmberAddon = require('ember-cli/lib/broccoli/ember-addon');
+
+module.exports = function(defaults) {
+ var addon = new EmberAddon(defaults, {
+ // Add options here
+ });
+
+ /*
+ This build file specifes the options for the dummy test app of this
+ addon, located in `/tests/dummy`
+ This build file does *not* influence how the addon or the app using it
+ behave. You most likely want to be modifying `./index.js` or app's build file
+ */
+
+ addon.import('bower_components/bootstrap-sass/assets/javascripts/bootstrap.js');
+ addon.import("bower_components/clipboard/dist/clipboard.js");
+
+ return addon.toTree();
+}
diff --git a/package.json b/package.json
index 33228a10..6d6483ee 100644
--- a/package.json
+++ b/package.json
@@ -7,8 +7,8 @@
"test": "tests"
},
"scripts": {
- "start": "ember server",
"build": "ember build",
+ "start": "ember server",
"test": "ember try:testall"
},
"repository": "https://github.com/aptible/ember-cli-aptible-shared",
@@ -18,34 +18,34 @@
"author": "Aptible",
"license": "MIT",
"devDependencies": {
- "broccoli-asset-rev": "^2.0.2",
- "ember-cli": "0.2.5",
- "ember-cli-app-version": "0.3.3",
- "ember-cli-dependency-checker": "^1.0.0",
+ "broccoli-asset-rev": "^2.1.2",
+ "ember-cli": "1.13.8",
+ "ember-cli-app-version": "0.5.0",
+ "ember-cli-dependency-checker": "^1.0.1",
"ember-cli-fake-server": "^0.2.1",
"ember-cli-gravatar": "^1.2.1",
- "ember-cli-htmlbars": "0.7.6",
- "ember-cli-ic-ajax": "0.1.1",
- "ember-cli-inject-live-reload": "^1.3.0",
- "ember-cli-qunit": "0.3.13",
- "ember-cli-release": "0.2.5",
- "ember-cli-uglify": "^1.0.1",
+ "ember-cli-htmlbars": "^1.0.0",
+ "ember-cli-htmlbars-inline-precompile": "^0.2.0",
+ "ember-cli-ic-ajax": "0.2.1",
+ "ember-cli-inject-live-reload": "^1.3.1",
+ "ember-cli-qunit": "^1.0.0",
+ "ember-cli-release": "^0.2.5",
+ "ember-cli-uglify": "^1.2.0",
"ember-data": "1.0.0-beta.18",
"ember-data-hal-9000": "0.1.7",
- "ember-disable-prototype-extensions": "^1.0.0",
- "ember-disable-proxy-controllers": "^0.7.0",
- "ember-export-application-global": "^1.0.2",
- "ember-try": "0.0.4",
- "ember-validations": "^2.0.0-alpha.1",
+ "ember-disable-proxy-controllers": "^1.0.0",
+ "ember-export-application-global": "^1.0.3",
+ "ember-try": "0.0.8",
+ "ember-validations": "^2.0.0-alpha.3",
"express": "^4.8.5",
"glob": "^4.4.5",
"torii": "^0.6.0-beta.4"
},
"dependencies": {
- "ember-cli-babel": "^5.0.0",
- "ember-cli-pretender": "0.3.2",
+ "ember-cli-babel": "^5.1.3",
+ "ember-cli-pretender": "^0.3.1",
"ember-inflector": "^1.6.2"
- },
+ } ,
"keywords": [
"ember-addon"
],
@@ -55,4 +55,4 @@
"lib/bootstrap-sass"
]
}
-}
\ No newline at end of file
+}
diff --git a/tests/.jshintrc b/tests/.jshintrc
index f761f6e6..4a55d195 100644
--- a/tests/.jshintrc
+++ b/tests/.jshintrc
@@ -87,5 +87,6 @@
"strict": false,
"white": false,
"eqnull": true,
- "esnext": true
+ "esnext": true,
+ "unused": true
}
diff --git a/tests/dummy/app/app.js b/tests/dummy/app/app.js
index 757df389..8d66b958 100644
--- a/tests/dummy/app/app.js
+++ b/tests/dummy/app/app.js
@@ -3,9 +3,11 @@ import Resolver from 'ember/resolver';
import loadInitializers from 'ember/load-initializers';
import config from './config/environment';
+var App;
+
Ember.MODEL_FACTORY_INJECTIONS = true;
-var App = Ember.Application.extend({
+App = Ember.Application.extend({
modulePrefix: config.modulePrefix,
podModulePrefix: config.podModulePrefix,
Resolver: Resolver
diff --git a/tests/dummy/app/templates/application.hbs b/tests/dummy/app/templates/application.hbs
index 05eb936c..f8bc38e7 100644
--- a/tests/dummy/app/templates/application.hbs
+++ b/tests/dummy/app/templates/application.hbs
@@ -1,3 +1,3 @@
-
Welcome to Ember.js
+Welcome to Ember
{{outlet}}
diff --git a/tests/helpers/start-app.js b/tests/helpers/start-app.js
index bb16a61c..bc34fb95 100644
--- a/tests/helpers/start-app.js
+++ b/tests/helpers/start-app.js
@@ -1,6 +1,5 @@
import Ember from 'ember';
import Application from '../../app';
-import Router from '../../router';
import config from '../../config/environment';
// registers test helpers for injection
diff --git a/tests/integration/components/click-to-copy-test.js b/tests/integration/components/click-to-copy-test.js
new file mode 100644
index 00000000..683b2e0c
--- /dev/null
+++ b/tests/integration/components/click-to-copy-test.js
@@ -0,0 +1,55 @@
+import hbs from 'htmlbars-inline-precompile';
+import { moduleForComponent, test } from 'ember-qunit';
+
+// Clipboard Mock
+let clipboardInstance;
+function mockClipboard() {
+ clipboardInstance = this;
+}
+mockClipboard.prototype.on = function(eventType, callback) {
+ mockClipboard[eventType] = callback;
+};
+
+moduleForComponent('click-to-copy', {
+ integration: true
+});
+
+test('basic attributes are set', function(assert) {
+ this.set('mockClipboard', mockClipboard);
+ this.render(
+ hbs('{{click-to-copy text="copy this" Clipboard=mockClipboard}}')
+ );
+
+ let clickToCopy = this.$('.click-to-copy');
+
+ assert.equal(clickToCopy.attr('data-clipboard-text'), 'copy this');
+ assert.equal(clickToCopy.text().trim(), 'Copy');
+ assert.ok(clickToCopy.hasClass('click-to-copy'));
+
+ mockClipboard.success();
+ assert.equal(clickToCopy.attr('data-message'), 'Copied!');
+ assert.ok(clickToCopy.hasClass('tooltipped'));
+
+ mockClipboard.error();
+ assert.equal(clickToCopy.attr('data-message'), 'Press ⌘+C to copy');
+ assert.ok(clickToCopy.hasClass('tooltipped'));
+});
+
+test('can set mutable attributes', function(assert) {
+ this.set('mockClipboard', mockClipboard);
+ this.render(
+ hbs`{{click-to-copy text="copy this" Clipboard=mockClipboard
+ actionLabel="Click Me!" successMessage="Yay!" errorMessage="Boo!"}}`
+ );
+
+ let clickToCopy = this.$('.click-to-copy');
+ assert.equal(clickToCopy.text().trim(), 'Click Me!');
+
+ mockClipboard.success();
+ assert.equal(clickToCopy.attr('data-message'), 'Yay!');
+ assert.ok(clickToCopy.hasClass('tooltipped'));
+
+ mockClipboard.error();
+ assert.equal(clickToCopy.attr('data-message'), 'Boo!');
+ assert.ok(clickToCopy.hasClass('tooltipped'));
+});
diff --git a/tests/unit/adapters/app-adapter.js b/tests/unit/adapters/app-adapter.js
index f443fbc4..4d545da3 100644
--- a/tests/unit/adapters/app-adapter.js
+++ b/tests/unit/adapters/app-adapter.js
@@ -2,12 +2,11 @@ import {
test,
moduleFor
} from 'ember-qunit';
-import DS from "ember-data";
import Ember from "ember";
import { stubRequest } from 'ember-cli-fake-server';
import modelDeps from '../../support/common-model-dependencies';
-var container, store;
+var store;
moduleFor('adapter:app', 'AppAdapter', {
needs: modelDeps.concat([
@@ -15,8 +14,7 @@ moduleFor('adapter:app', 'AppAdapter', {
'serializer:application'
]),
setup: function(){
- var container = this.container;
- store = container.lookup('store:application');
+ store = this.container.lookup('store:application');
}
});
diff --git a/tests/unit/adapters/application-test.js b/tests/unit/adapters/application-test.js
index f97c4d93..c358b941 100644
--- a/tests/unit/adapters/application-test.js
+++ b/tests/unit/adapters/application-test.js
@@ -8,7 +8,7 @@ import { stubRequest } from 'ember-cli-fake-server';
var Moose = DS.Model.extend();
-var container, store;
+var store;
moduleFor('adapter:application', 'ApplicationAdapter', {
needs: ['store:application', 'serializer:application'],
diff --git a/tests/unit/adapters/database-test.js b/tests/unit/adapters/database-test.js
index f99bee18..8d47f243 100644
--- a/tests/unit/adapters/database-test.js
+++ b/tests/unit/adapters/database-test.js
@@ -2,12 +2,11 @@ import {
test,
moduleFor
} from 'ember-qunit';
-import DS from "ember-data";
import Ember from "ember";
import { stubRequest } from 'ember-cli-fake-server';
import modelDeps from '../../support/common-model-dependencies';
-var container, store;
+var store;
moduleFor('adapter:database', 'DatabaseAdapter', {
needs: modelDeps.concat([
diff --git a/tests/unit/components/with-active-class/component-test.js b/tests/unit/components/with-active-class/component-test.js
index d06708b4..826e40fc 100644
--- a/tests/unit/components/with-active-class/component-test.js
+++ b/tests/unit/components/with-active-class/component-test.js
@@ -7,7 +7,7 @@ import Ember from "ember";
moduleForComponent('with-active-class', 'WithActiveClassComponent');
test('it renders active when within', function(assert) {
- var component = this.subject({
+ this.subject({
route: 'apps',
applicationController: Ember.Object.create({currentPath: 'apps.new'})
});
@@ -16,7 +16,7 @@ test('it renders active when within', function(assert) {
});
test('it does not render active with not within', function(assert) {
- var component = this.subject({
+ this.subject({
route: 'databases',
applicationController: Ember.Object.create({currentPath: 'apps.new'})
});
diff --git a/tests/unit/models/app-test.js b/tests/unit/models/app-test.js
index 26d56869..9a22745f 100644
--- a/tests/unit/models/app-test.js
+++ b/tests/unit/models/app-test.js
@@ -19,7 +19,7 @@ test('finding uses correct url', function(assert){
let appId = 'my-app-id';
- stubRequest('get', `/apps/${appId}`, function(request){
+ stubRequest('get', `/apps/${appId}`, function(){
assert.ok(true, 'calls with correct URL');
return this.success({
@@ -48,7 +48,7 @@ test('reloading app with stack uses correct url', function(assert){
let app = Ember.run(store, 'push', 'app', {id:'app1'});
let stack = Ember.run(store, 'push', 'stack', {id:'stack1'});
- stubRequest('get', `/apps/app1`, function(request){
+ stubRequest('get', `/apps/app1`, function(){
assert.ok(true, 'gets correct url');
return this.success({id:'app1'});
});
@@ -69,7 +69,7 @@ test('creating POSTs to correct url', function(assert) {
app = store.createRecord('app', {handle:'my-cool-app', stack:stack});
});
- stubRequest('post', '/accounts/1/apps', function(request){
+ stubRequest('post', '/accounts/1/apps', function(){
assert.ok(true, 'calls with correct URL');
return this.success(201, {
diff --git a/tests/unit/models/certificate-test.js b/tests/unit/models/certificate-test.js
index fba56cd7..ca62faf1 100644
--- a/tests/unit/models/certificate-test.js
+++ b/tests/unit/models/certificate-test.js
@@ -18,7 +18,7 @@ test('finding uses correct url', function(assert){
let certificateId = 'my-cert-id';
- stubRequest('get', `/certificates/${certificateId}`, function(request){
+ stubRequest('get', `/certificates/${certificateId}`, function(){
assert.ok(true, 'calls with correct URL');
return this.success({
@@ -48,7 +48,7 @@ test('reloading certificate with stack uses correct url', function(assert){
let certificate = Ember.run(store, 'push', 'certificate', {id:'c1'});
let stack = Ember.run(store, 'push', 'stack', {id:'stack1'});
- stubRequest('get', `/certificates/c1`, function(request){
+ stubRequest('get', `/certificates/c1`, function(){
assert.ok(true, 'gets correct url');
return this.success({id:'c1'});
});
@@ -71,7 +71,7 @@ test('creating POSTs to correct url', function(assert) {
certificate = store.createRecord('certificate', {body:'cert', stack:stack});
});
- stubRequest('post', '/accounts/1/certificates', function(request){
+ stubRequest('post', '/accounts/1/certificates', function(){
assert.ok(true, 'calls with correct URL');
return this.success(201, {
@@ -85,4 +85,4 @@ test('creating POSTs to correct url', function(assert) {
assert.ok(true, 'certificate did save');
}).finally(done);
});
-});
\ No newline at end of file
+});
diff --git a/tests/unit/models/database-test.js b/tests/unit/models/database-test.js
index f0d44134..6581b8bb 100644
--- a/tests/unit/models/database-test.js
+++ b/tests/unit/models/database-test.js
@@ -21,7 +21,7 @@ test('finding uses correct url', function(assert) {
assert.expect(2);
var dbId = 'my-db-id';
- stubRequest('get', '/databases/' + dbId, function(request){
+ stubRequest('get', '/databases/' + dbId, function(){
assert.ok(true, 'calls with correct URL');
return this.success({
@@ -51,7 +51,7 @@ test('reloading uses correct url', function(assert){
let db = Ember.run(store, 'push', 'database', {id:dbId});
let stack = Ember.run(store, 'push', 'stack', {id:'stackid'});
- stubRequest('get', `/databases/${dbId}`, function(request){
+ stubRequest('get', `/databases/${dbId}`, function(){
assert.ok(true, 'calls with correct URL');
return this.success({id: dbId});
});
@@ -72,7 +72,7 @@ test('creating POSTs to correct url', function(assert) {
db = store.createRecord('database', {handle:'my-cool-db', stack:stack});
});
- stubRequest('post', '/accounts/1/databases', function(request){
+ stubRequest('post', '/accounts/1/databases', function(){
assert.ok(true, 'calls with correct URL');
return this.success(201, {
@@ -95,7 +95,7 @@ test('reloads while provisioning', function(assert){
let store = this.store();
let dbId = 'db-id';
- stubRequest('get', `/databases/${dbId}`, function(request) {
+ stubRequest('get', `/databases/${dbId}`, function() {
assert.ok(true, 'calls with correct URL');
return this.success({id: dbId, status: 'provisioning'});
@@ -111,7 +111,7 @@ test('reloads while provisioning', function(assert){
db.set('_reloadRetryDelay', TEST_RELOAD_RETRY_DELAY);
});
- stubRequest('get', `/databases/${dbId}`, function(request) {
+ stubRequest('get', `/databases/${dbId}`, function() {
assert.ok(true, 'calls with correct URL');
done();
diff --git a/tests/unit/models/invitation-test.js b/tests/unit/models/invitation-test.js
index e89dabba..d6025f85 100644
--- a/tests/unit/models/invitation-test.js
+++ b/tests/unit/models/invitation-test.js
@@ -23,7 +23,7 @@ test('creating POSTS to a url prefixed with roles/:id', function(assert) {
let model = Ember.run(store, 'createRecord', 'invitation', {role});
let url = `/roles/${roleId}/invitations`;
- stubRequest('post', url, function(request){
+ stubRequest('post', url, function(){
assert.ok(true, `posts to "${url}`);
return this.success();
});
@@ -44,7 +44,7 @@ test('deletes by DELETEing to /invitations/:id', function(assert){
invitation = store.push('invitation',{id:'i1', role});
});
- stubRequest('delete', '/invitations/i1', function(request){
+ stubRequest('delete', '/invitations/i1', function(){
assert.ok(true);
return this.noContent();
});
diff --git a/tests/unit/models/log-drain-test.js b/tests/unit/models/log-drain-test.js
index e8badf7f..c7c0837b 100644
--- a/tests/unit/models/log-drain-test.js
+++ b/tests/unit/models/log-drain-test.js
@@ -22,7 +22,7 @@ test('posts to /accounts/:stack_id/log_drains', function(assert){
stack = store.push('stack',{id:'s1'});
});
- stubRequest('post', '/accounts/s1/log_drains', function(request){
+ stubRequest('post', '/accounts/s1/log_drains', function(){
assert.ok(true, 'posts to correct url');
return this.success({id:'ld1'});
});
@@ -32,4 +32,3 @@ test('posts to /accounts/:stack_id/log_drains', function(assert){
drain.save().finally(done);
});
});
-
diff --git a/tests/unit/models/membership-test.js b/tests/unit/models/membership-test.js
index 346c3636..bf9b1ea4 100644
--- a/tests/unit/models/membership-test.js
+++ b/tests/unit/models/membership-test.js
@@ -43,7 +43,7 @@ test('destroy DELETEs to /memberships/:id', function(assert){
membership = store.push('membership', {id:'m1', role});
});
- stubRequest('delete', `/memberships/m1`, function(request){
+ stubRequest('delete', `/memberships/m1`, function(){
assert.ok(true, 'deletes to correct url');
return this.noContent();
});
diff --git a/tests/unit/models/operation-test.js b/tests/unit/models/operation-test.js
index 2d6385ea..53536149 100644
--- a/tests/unit/models/operation-test.js
+++ b/tests/unit/models/operation-test.js
@@ -39,7 +39,7 @@ test('when creating an operation for a db, POSTs to /databases/:id/operations',
});
return Ember.run(function(){
- return op.save().then(function(_op){
+ return op.save().then(function(){
assert.ok(true, 'operation saved');
});
});
@@ -165,7 +165,7 @@ test(`when creating an operation for a vhost, POSTs to ${vhostOperationURL}`, fu
});
return Ember.run(function(){
- return op.save().then(function(_op){
+ return op.save().then(function(){
assert.ok(true, 'operation saved');
});
});
@@ -197,7 +197,7 @@ test(`creating an operation for a log drain POSTS to ${logDrainOperationURL}`, f
});
return Ember.run(function(){
- return op.save().then(function(_op){
+ return op.save().then(function(){
assert.ok(true, 'operation saved');
});
});
@@ -229,7 +229,7 @@ test(`creating an operation for a service POSTS to ${serviceOperationURL}`, func
});
return Ember.run(function(){
- return op.save().then(function(_op){
+ return op.save().then(function(){
assert.ok(true, 'operation saved');
});
});
diff --git a/tests/unit/models/organization-test.js b/tests/unit/models/organization-test.js
index d760d5c9..f634a288 100644
--- a/tests/unit/models/organization-test.js
+++ b/tests/unit/models/organization-test.js
@@ -3,7 +3,6 @@ import {
test
} from 'ember-qunit';
import modelDeps from '../../support/common-model-dependencies';
-import Ember from "ember";
moduleForModel('organization', 'model:organization', {
// Specify the other units that are required for this test.
diff --git a/tests/unit/models/permission-test.js b/tests/unit/models/permission-test.js
index f5da9131..396a929d 100644
--- a/tests/unit/models/permission-test.js
+++ b/tests/unit/models/permission-test.js
@@ -26,7 +26,7 @@ test('to create, it POSTs to /accounts/:id/permissions', function(assert){
});
});
- stubRequest('post', `/accounts/${stackId}/permissions`, function(request){
+ stubRequest('post', `/accounts/${stackId}/permissions`, function(){
assert.ok(true, 'posts to correct url');
return this.noContent();
});
@@ -47,7 +47,7 @@ test('deletes by DELETEing to /permissions/:id', function(assert){
permission = store.push('permission',{id:'p1', stack});
});
- stubRequest('delete', '/permissions/p1', function(request){
+ stubRequest('delete', '/permissions/p1', function(){
assert.ok(true);
return this.noContent();
});
diff --git a/tests/unit/models/reset-test.js b/tests/unit/models/reset-test.js
index 41fa9d47..ac8b3ea2 100644
--- a/tests/unit/models/reset-test.js
+++ b/tests/unit/models/reset-test.js
@@ -18,7 +18,6 @@ test('posts to /resets when there is an invitation', function(assert){
let done = assert.async();
let invitationId = 'invite1';
- let store = this.store();
let model = this.subject({
type: 'invitation',
invitationId
diff --git a/tests/unit/models/role-test.js b/tests/unit/models/role-test.js
index cd8ccaaf..3f24a3d3 100644
--- a/tests/unit/models/role-test.js
+++ b/tests/unit/models/role-test.js
@@ -21,7 +21,7 @@ test('creates by POSTing to /organizations/:org_id/roles', function(assert){
let store = this.store();
let organization = Ember.run(store, 'push', 'organization', {id:orgId});
- stubRequest('post', `/organizations/${orgId}/roles`, function(request){
+ stubRequest('post', `/organizations/${orgId}/roles`, function(){
assert.ok(true, 'posts to correct url');
return this.noContent();
});
@@ -69,7 +69,7 @@ test('destroy DELETEs to /roles/:id', function(assert){
role = store.push('role', {id:'r1', organization});
});
- stubRequest('delete', `/roles/r1`, function(request){
+ stubRequest('delete', `/roles/r1`, function(){
assert.ok(true, 'deletes to correct url');
return this.noContent();
});
diff --git a/tests/unit/models/ssh-key-test.js b/tests/unit/models/ssh-key-test.js
index 3712928a..bf3a9a6a 100644
--- a/tests/unit/models/ssh-key-test.js
+++ b/tests/unit/models/ssh-key-test.js
@@ -22,7 +22,7 @@ test('posts to /users/:id/ssh_keys', function(assert){
user = store.push('user',{id:'u1'});
});
- stubRequest('post', '/users/u1/ssh_keys', function(request){
+ stubRequest('post', '/users/u1/ssh_keys', function(){
assert.ok(true, 'posts to correct url');
return this.success({id:'k1'});
});
@@ -43,7 +43,7 @@ test('deletes to /ssh_keys/:id', function(assert){
key = store.push('ssh-key',{id:'k1',user});
});
- stubRequest('delete', '/ssh_keys/k1', function(request){
+ stubRequest('delete', '/ssh_keys/k1', function(){
assert.ok(true, 'deletes to correct url');
return this.noContent();
});
diff --git a/tests/unit/models/stack-test.js b/tests/unit/models/stack-test.js
index 4a4ad810..9636dbf6 100644
--- a/tests/unit/models/stack-test.js
+++ b/tests/unit/models/stack-test.js
@@ -14,7 +14,7 @@ moduleForModel('stack', 'model:stack', {
test('findAll works', function(assert) {
var store = this.store();
- stubRequest('get', '/accounts', function(request){
+ stubRequest('get', '/accounts', function(){
return this.success({
_links: {
self: { href: '/accounts' },
diff --git a/tests/unit/models/subscription-test.js b/tests/unit/models/subscription-test.js
index ba59db03..e9221b83 100644
--- a/tests/unit/models/subscription-test.js
+++ b/tests/unit/models/subscription-test.js
@@ -38,7 +38,7 @@ test('data is posted upon save', function(assert) {
plan: 'development'
});
- return Ember.run(subscription, 'save').then(function(s){
+ return Ember.run(subscription, 'save').then(function(){
assert.ok(true, 'subscription was saved');
});
});
diff --git a/tests/unit/models/user-test.js b/tests/unit/models/user-test.js
index e846b1ad..bf015d57 100644
--- a/tests/unit/models/user-test.js
+++ b/tests/unit/models/user-test.js
@@ -19,9 +19,9 @@ test('DELETEs to /organizations/:org_id/users/:id', function(assert) {
let store = this.store();
let user = Ember.run(store, 'push', 'user', {id:'userId'});
- let organization = Ember.run(store, 'push', 'organization', {id:'orgId'});
+ Ember.run(store, 'push', 'organization', {id:'orgId'});
- stubRequest('delete', '/organizations/orgId/users/userId', function(request){
+ stubRequest('delete', '/organizations/orgId/users/userId', function(){
assert.ok(true, 'deletes to correct url');
return this.noContent();
});
diff --git a/tests/unit/models/vhost-test.js b/tests/unit/models/vhost-test.js
index 4f7113f4..52401a48 100644
--- a/tests/unit/models/vhost-test.js
+++ b/tests/unit/models/vhost-test.js
@@ -28,7 +28,7 @@ test('creating POSTs to correct url', function(assert) {
vhost = store.createRecord('vhost', {status:'provisioned', service:service});
});
- stubRequest('post', '/services/1/vhosts', function(request){
+ stubRequest('post', '/services/1/vhosts', function(){
assert.ok(true, 'calls with correct URL');
return this.noContent();
@@ -52,7 +52,7 @@ test('updating PUTs to correct url', function(assert) {
vhost = store.push('vhost', {id: vhostId, status:'provisioned', service:service});
});
- stubRequest('put', `/vhosts/${vhostId}`, function(request){
+ stubRequest('put', `/vhosts/${vhostId}`, function(){
assert.ok(true, 'calls with correct URL');
return this.success({
@@ -75,7 +75,7 @@ test('reloads while provisioning', function(assert) {
let vhost, service;
let vhostId = 'vhost-id';
- stubRequest('get', `/vhosts/${vhostId}`, function(request){
+ stubRequest('get', `/vhosts/${vhostId}`, function(){
assert.ok(true, 'calls with correct URL');
return this.success({
@@ -95,7 +95,7 @@ test('reloads while provisioning', function(assert) {
vhost.set('_reloadRetryDelay', TEST_RELOAD_RETRY_DELAY);
});
- stubRequest('get', `/vhosts/${vhostId}`, function(request){
+ stubRequest('get', `/vhosts/${vhostId}`, function(){
assert.ok(true, 'calls with correct URL');
done();
diff --git a/tests/unit/stores/application_test.js b/tests/unit/stores/application_test.js
index cbd15db8..be97f938 100644
--- a/tests/unit/stores/application_test.js
+++ b/tests/unit/stores/application_test.js
@@ -28,7 +28,7 @@ test('#findStacksBy', function(assert) {
var organization = service.getById('organization', '111');
- stubRequest('get', `/accounts`, function(request){
+ stubRequest('get', `/accounts`, function(){
assert.ok(true, 'posts to correct url');
return this.success({
_embedded: {
diff --git a/tests/unit/torii-adapters/application-test.js b/tests/unit/torii-adapters/application-test.js
index e577a422..88540b38 100644
--- a/tests/unit/torii-adapters/application-test.js
+++ b/tests/unit/torii-adapters/application-test.js
@@ -6,7 +6,6 @@ import config from "../../../config/environment";
import { getAccessToken, setAccessToken } from '../../../adapters/application';
import storage from 'dummy/utils/storage';
import { stubRequest } from 'ember-cli-fake-server';
-import DS from "ember-data";
import Ember from "ember";
import modelDeps from '../../support/common-model-dependencies';
@@ -21,7 +20,6 @@ moduleFor('torii-adapter:application', 'Torii Adapter: Aptible', {
needs: modelDeps,
setup: function(){
- DS._setupContainer(this.container);
originalWrite = storage.write;
originalRead = storage.read;
},
@@ -29,21 +27,15 @@ moduleFor('torii-adapter:application', 'Torii Adapter: Aptible', {
storage.write = originalWrite;
storage.read = originalRead;
setAccessToken(null);
- },
- subject: function() {
- var store = this.container.lookup('store:main');
- var klass = this.container.lookupFactory(this.subjectName);
- return klass.create({
- store: store,
- analytics: new MockAnalytics()
- });
}
});
test('#close destroys token, storage', function(assert){
assert.expect(4);
const done = assert.async();
- var adapter = this.subject();
+ var adapter = this.subject({
+ analytics: new MockAnalytics()
+ });
var tokenId = 'some-token-id';
var removedKey;
@@ -75,7 +67,9 @@ test('#open stores payload, set currentUser', function(assert){
const done = assert.async();
assert.expect();
- var adapter = this.subject();
+ var adapter = this.subject({
+ analytics: new MockAnalytics()
+ });
var token = 'some-token';
var tokenId = 'some-token-id';
var userId = 'some-user-id';
@@ -120,7 +114,9 @@ test('#fetch fetches current_token, stores payload, set currentUser', function(a
const done = assert.async();
assert.expect(6);
- var adapter = this.subject();
+ var adapter = this.subject({
+ analytics: new MockAnalytics()
+ });
var token = 'some-token';
var tokenId = 'some-token-id';
var userId = 'some-user-id';
diff --git a/tests/unit/utils/can-test.js b/tests/unit/utils/can-test.js
index f121dbd4..a2eae039 100644
--- a/tests/unit/utils/can-test.js
+++ b/tests/unit/utils/can-test.js
@@ -4,7 +4,6 @@ import {
} from 'ember-qunit';
import { stubRequest } from 'ember-cli-fake-server';
import modelDeps from '../../support/common-model-dependencies';
-import DS from "ember-data";
import Ember from "ember";
import can from "dummy/utils/can";
@@ -222,7 +221,7 @@ test('stack has multiple permissions, some match user\'s role', function(assert)
role: '/roles/r2'
}
});
- var otherRole = store.push('role', {id:'r2'});
+ store.push('role', {id:'r2'});
});
return Ember.run(function(){
@@ -445,4 +444,4 @@ test('when user is not verified, cannot manage', (assert) => {
assert.ok(!res, 'user cannot manage stack');
});
});
-});
\ No newline at end of file
+});
diff --git a/tests/unit/utils/changeset-test.js b/tests/unit/utils/changeset-test.js
index be31353f..d5077e19 100644
--- a/tests/unit/utils/changeset-test.js
+++ b/tests/unit/utils/changeset-test.js
@@ -14,7 +14,7 @@ module('Unit: Changeset', {
key(keyData) {
return JSON.stringify(keyData);
},
- initialValue(keyData) {
+ initialValue() {
return false;
}
});
@@ -62,7 +62,7 @@ test('value can change from true to false', (assert) => {
key(keyData) {
return JSON.stringify(keyData);
},
- initialValue(keyData) {
+ initialValue() {
return true;
}
});
@@ -163,19 +163,17 @@ test('initialValue hook is called with keyData when read', (assert) => {
});
test('forEachValue returns values that are read but not set', (assert) => {
- let passedKeyData;
-
changeset = Changeset.create({
key(keyData) {
return JSON.stringify(keyData);
},
- initialValue(keyData) {
+ initialValue() {
return false;
}
});
let keyData = {};
- let result = changeset.value(keyData);
+ changeset.value(keyData);
changeset.forEachValue((_keyData) => {
assert.equal(_keyData, keyData, 'forEachValue yields for the keyData that was read');
diff --git a/tests/unit/utils/fetch-all-pages-test.js b/tests/unit/utils/fetch-all-pages-test.js
index 699125b5..9943f95b 100644
--- a/tests/unit/utils/fetch-all-pages-test.js
+++ b/tests/unit/utils/fetch-all-pages-test.js
@@ -2,9 +2,7 @@ import {
moduleForModel,
test
} from 'ember-qunit';
-import { skip } from 'qunit';
import { stubRequest } from 'ember-cli-fake-server';
-import DS from "ember-data";
import Ember from "ember";
import fetchAllPages from "dummy/utils/fetch-all-pages";
@@ -55,7 +53,7 @@ function buildAppPage(page, {perPage, totalCount }) {
}
function stubAccounts() {
- stubRequest('get', '/accounts', function(request){
+ stubRequest('get', '/accounts', function(){
return this.success({
_links: {},
_embedded: {
diff --git a/tests/unit/validators/uniqueness-test.js b/tests/unit/validators/uniqueness-test.js
index 6e744ec6..4c8728e2 100644
--- a/tests/unit/validators/uniqueness-test.js
+++ b/tests/unit/validators/uniqueness-test.js
@@ -21,7 +21,7 @@ test('A valid response should add no error messages', function(assert) {
let validator;
let done = assert.async();
- stubRequest('post', claimUrl, function(request) {
+ stubRequest('post', claimUrl, function() {
assert.ok(true, 'request was made');
return [204, {}, ''];
});
@@ -46,7 +46,7 @@ test('An error response should add an error message', function(assert) {
let validator;
let done = assert.async();
- stubRequest('post', claimUrl, function(request) {
+ stubRequest('post', claimUrl, function() {
assert.ok(true, 'request was made');
return [400, {}, ''];
});