UX: Trash icon displaying when there is no upload take 2.

This commit is contained in:
Guo Xiang Tan 2018-11-12 16:19:17 +08:00
parent d50f4fdd7a
commit c7377e2f2d
2 changed files with 26 additions and 2 deletions

View File

@ -6,7 +6,7 @@ export default Em.Component.extend(UploadMixin, {
@computed("imageUrl")
backgroundStyle(imageUrl) {
if (Em.isNone(imageUrl)) {
if (Em.isEmpty(imageUrl)) {
return "".htmlSafe();
}
@ -15,7 +15,7 @@ export default Em.Component.extend(UploadMixin, {
@computed("backgroundStyle")
hasBackgroundStyle(backgroundStyle) {
Ember.isEmpty(backgroundStyle);
return !Ember.isEmpty(backgroundStyle.string);
},
validateUploadedFilesOptions() {

View File

@ -1,10 +1,34 @@
import componentTest from "helpers/component-test";
moduleForComponent("image-uploader", { integration: true });
componentTest("with image", {
template: "{{image-uploader imageUrl='/some/upload.png'}}",
test(assert) {
assert.equal(
this.$(".d-icon-picture-o").length,
1,
"it displays the upload icon"
);
assert.equal(
this.$(".d-icon-trash-o").length,
1,
"it displays the trash icon"
);
}
});
componentTest("without image", {
template: "{{image-uploader}}",
test(assert) {
assert.equal(
this.$(".d-icon-picture-o").length,
1,
"it displays the upload icon"
);
assert.equal(
this.$(".d-icon-trash-o").length,
0,