Merge pull request #6254 from kevinansfield/fix-profile-image

Fix teardown of gh-profile-image when fileStorage=false
This commit is contained in:
Hannah Wolfe 2016-01-08 15:54:25 +00:00
commit 4f05bbf6e1
2 changed files with 15 additions and 2 deletions

View File

@ -88,10 +88,12 @@ export default Component.extend({
},
willDestroyElement() {
let $input = this.$('.js-file-input');
this._super(...arguments);
if (this.$('.js-file-input').data()['blueimp-fileupload']) {
this.$('.js-file-input').fileupload('destroy');
if ($input.length && $input.data()['blueimp-fileupload']) {
$input.fileupload('destroy');
}
},

View File

@ -43,6 +43,17 @@ describeComponent(
expect(this.$()).to.have.length(1);
});
it('renders and tears down ok with fileStorage:false', function () {
this.set('fileStorage', false);
this.render(hbs`
{{gh-profile-image fileStorage=fileStorage}}
`);
expect(this.$()).to.have.length(1);
expect(this.$('input')).to.have.length(0);
}),
it('immediately renders the gravatar if valid email supplied', function () {
let email = 'test@example.com';
let expectedUrl = `http://www.gravatar.com/avatar/${md5(email)}?s=100&d=blank`;