From ed828a228bd3c8366a232fad04852b8374d7f1ab Mon Sep 17 00:00:00 2001 From: Rimian Perkins Date: Mon, 13 Feb 2017 15:31:31 +1100 Subject: [PATCH] a response happened and there is a test --- .../discourse/controllers/user-choice.js.es6 | 6 ++++++ .../javascripts/discourse/templates/user/choice.hbs | 8 ++++++++ .../javascripts/acceptance/choice-discourse-test.es6 | 12 +++++++++++- 3 files changed, 25 insertions(+), 1 deletion(-) diff --git a/assets/javascripts/discourse/controllers/user-choice.js.es6 b/assets/javascripts/discourse/controllers/user-choice.js.es6 index e2a30bf..2c83645 100644 --- a/assets/javascripts/discourse/controllers/user-choice.js.es6 +++ b/assets/javascripts/discourse/controllers/user-choice.js.es6 @@ -2,4 +2,10 @@ export default Ember.Controller.extend({ user: Ember.inject.controller(), username: Ember.computed.alias('user.model.username_lower'), email: Ember.computed.alias('user.model.email'), + + actions: { + choiceTest: function() { + this.set('saved', true); + } + } }); diff --git a/assets/javascripts/discourse/templates/user/choice.hbs b/assets/javascripts/discourse/templates/user/choice.hbs index e8862bf..05ab7e8 100644 --- a/assets/javascripts/discourse/templates/user/choice.hbs +++ b/assets/javascripts/discourse/templates/user/choice.hbs @@ -1,3 +1,11 @@
{{username}}
+ + + +{{#if saved}} +
Response happens
+{{/if}} diff --git a/test/javascripts/acceptance/choice-discourse-test.es6 b/test/javascripts/acceptance/choice-discourse-test.es6 index f0bf4ee..a4c15d9 100644 --- a/test/javascripts/acceptance/choice-discourse-test.es6 +++ b/test/javascripts/acceptance/choice-discourse-test.es6 @@ -6,6 +6,16 @@ test('Choice Page Exists', () => { andThen(() => { ok(exists('h1'), 'Heading exists'); - ok($.trim($('.payments').text()) == 'eviltrout', 'eviltrout'); + ok($.trim($('.payments').text()) == 'eviltrout', 'username is present on page'); + }); +}); + +test('Choice Page response happens', () => { + visit('/users/eviltrout/choice'); + + click('.choice-btn'); + + andThen(() => { + ok(exists('.choice-response'), 'Response happens'); }); });