Permalink
Browse files

Faster Feedback

  • Loading branch information...
toranb committed Feb 21, 2017
1 parent fa08412 commit e18016b96b2b8e62e7d7bbb62671355e65b92d61
Showing with 17 additions and 2 deletions.
  1. +1 −1 app/components/welp-list/component.js
  2. +16 −1 tests/integration/components/welp-list-test.js
@@ -25,7 +25,7 @@ var WelpListComponent = Ember.Component.extend({
<div class="result-review">
<p>
{{result.reviews.0.comment}}
- <a href="javascript:void(0);">read more</a>
+ {{#link-to "results.detail" result.id}}read more{{/link-to}}
</p>
</div>
</li>
@@ -51,7 +51,19 @@ test('should include average star rating', function(assert) {
assert.equal(trim(this.$().find('ul.search-results-list .result-review:eq(0)').text().trim()), 'yup read more');
});
-test('clicking read more will redirect to detail route', function(assert) {
+test('toran clicking read more will redirect to detail route', function(assert) {
+ assert.expect(3);
+
+ let transitions = [];
+ let FakeRoutingService = Ember.Service.extend({
+ generateURL: () => { return; },
+ transitionTo: (name, args) => {
+ transitions.push({name: name, args: args});
+ }
+ });
+ this.registry.register('service:-routing', FakeRoutingService);
+ this.inject.service('-routing');
+
this.set('results', {
1: {
id: 1, name: 'one', reviews: [{id: 1, rating: 1, comment: 'yup'}]
@@ -62,4 +74,7 @@ test('clicking read more will redirect to detail route', function(assert) {
assert.equal(this.$().find('ul.search-results-list .result-review').length, 1);
assert.equal(this.$().find('ul.search-results-list .result-review:eq(0) a').text(), 'read more');
+
+ this.$().find('ul.search-results-list .result-review:eq(0) a').trigger('click');
+ assert.deepEqual(transitions, [{name: 'results.detail', args: [1]}]);
});

0 comments on commit e18016b

Please sign in to comment.