Skip to content

Instantly share code, notes, and snippets.

@walter
Last active August 29, 2015 14:05
Show Gist options
  • Select an option

  • Save walter/a8ffd8676fb223b45d68 to your computer and use it in GitHub Desktop.

Select an option

Save walter/a8ffd8676fb223b45d68 to your computer and use it in GitHub Desktop.
import Ember from 'ember';
export default Ember.Handlebars.makeBoundHelper(function(imageUrl) {
var escaped = encodeURIComponent(imageUrl);
var fullUrl = 'http://d2xfsikitl0nz3.cloudfront.net/' + escaped + '/60/60';
return new Ember.Handlebars.SafeString('<img src="' + fullUrl + '" width="60" height="60" alt="" />');
});
import Ember from 'ember';
import { test, moduleFor } from 'ember-qunit';
module('cdn-avatar-from Helper', {
});
test('it takes an imageUrl and returns cdn image tag', function() {
expect(1);
var result = Ember.Handlebars.helpers.cdn-avatar-from._rawFunction("xyz");
var expected = '<img src="http://d2xfsikitl0nz3.cloudfront.net/xyz/60/60" width="60" height="60" alt="" />';
equal(result, expected);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment