mirror of
https://github.com/discourse/discourse.git
synced 2024-11-23 16:46:12 +08:00
UX: Trash icon displaying when there is no upload take 2.
This commit is contained in:
parent
d50f4fdd7a
commit
c7377e2f2d
|
@ -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() {
|
||||
|
|
|
@ -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,
|
||||
|
|
Loading…
Reference in New Issue
Block a user