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")
|
@computed("imageUrl")
|
||||||
backgroundStyle(imageUrl) {
|
backgroundStyle(imageUrl) {
|
||||||
if (Em.isNone(imageUrl)) {
|
if (Em.isEmpty(imageUrl)) {
|
||||||
return "".htmlSafe();
|
return "".htmlSafe();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -15,7 +15,7 @@ export default Em.Component.extend(UploadMixin, {
|
||||||
|
|
||||||
@computed("backgroundStyle")
|
@computed("backgroundStyle")
|
||||||
hasBackgroundStyle(backgroundStyle) {
|
hasBackgroundStyle(backgroundStyle) {
|
||||||
Ember.isEmpty(backgroundStyle);
|
return !Ember.isEmpty(backgroundStyle.string);
|
||||||
},
|
},
|
||||||
|
|
||||||
validateUploadedFilesOptions() {
|
validateUploadedFilesOptions() {
|
||||||
|
|
|
@ -1,10 +1,34 @@
|
||||||
import componentTest from "helpers/component-test";
|
import componentTest from "helpers/component-test";
|
||||||
moduleForComponent("image-uploader", { integration: true });
|
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", {
|
componentTest("without image", {
|
||||||
template: "{{image-uploader}}",
|
template: "{{image-uploader}}",
|
||||||
|
|
||||||
test(assert) {
|
test(assert) {
|
||||||
|
assert.equal(
|
||||||
|
this.$(".d-icon-picture-o").length,
|
||||||
|
1,
|
||||||
|
"it displays the upload icon"
|
||||||
|
);
|
||||||
|
|
||||||
assert.equal(
|
assert.equal(
|
||||||
this.$(".d-icon-trash-o").length,
|
this.$(".d-icon-trash-o").length,
|
||||||
0,
|
0,
|
||||||
|
|
Loading…
Reference in New Issue