From b0ce9e74f83202674fb397a688cb610702516ad0 Mon Sep 17 00:00:00 2001 From: zinyando Date: Mon, 30 May 2016 20:22:09 +0200 Subject: [PATCH] Stub user notifications component --- app/tests/.jshintrc | 3 ++- app/tests/helpers/module-for-acceptance.js | 1 + app/tests/helpers/start-app.js | 1 + app/tests/helpers/stub-user-notification.js | 23 +++++++++++++++++++++ 4 files changed, 27 insertions(+), 1 deletion(-) create mode 100644 app/tests/helpers/stub-user-notification.js diff --git a/app/tests/.jshintrc b/app/tests/.jshintrc index 551f69f0..861b980d 100644 --- a/app/tests/.jshintrc +++ b/app/tests/.jshintrc @@ -27,7 +27,8 @@ "stubAudit", "pauseTest", "userLogin", - "skip" + "skip", + "waitToAppear" ], "node": false, "browser": false, diff --git a/app/tests/helpers/module-for-acceptance.js b/app/tests/helpers/module-for-acceptance.js index 292ebf5d..6d6818e0 100644 --- a/app/tests/helpers/module-for-acceptance.js +++ b/app/tests/helpers/module-for-acceptance.js @@ -8,6 +8,7 @@ export default function(name, options = {}) { this.application = startApp(); stubAudit(this); stubSession(this); + stubUserNotification(this); if (options.beforeEach) { options.beforeEach.apply(this, arguments); diff --git a/app/tests/helpers/start-app.js b/app/tests/helpers/start-app.js index bb66ea3a..3c0d1486 100644 --- a/app/tests/helpers/start-app.js +++ b/app/tests/helpers/start-app.js @@ -6,6 +6,7 @@ import './stub-audit'; import './user-login'; import './allow-anonymous-access'; import './wait-to-appear'; +import './stub-user-notification'; export default function startApp(attrs) { let application; diff --git a/app/tests/helpers/stub-user-notification.js b/app/tests/helpers/stub-user-notification.js new file mode 100644 index 00000000..1e464340 --- /dev/null +++ b/app/tests/helpers/stub-user-notification.js @@ -0,0 +1,23 @@ +import Ember from 'ember'; +import miscUtil from 'documize/utils/misc'; + +const userNotification = Ember.Component.extend({ + notifications: [], + + didInsertElement() { + // this.eventBus.subscribe('notifyUser', this, 'showNotification'); + }, + + willDestroyElement() { + // this.eventBus.unsubscribe('notifyUser'); + }, + + showNotification(msg) { + // console.log(msg); + } +}); + + +export default Ember.Test.registerAsyncHelper('stubUserNotification', function(app, test, attrs={}) { + test.register('component:userNotification', userNotification.extend(attrs)); +});