2018-11-12 02:55:56 -05:00
|
|
|
import componentTest from "helpers/component-test";
|
|
|
|
moduleForComponent("image-uploader", { integration: true });
|
|
|
|
|
2018-11-12 03:19:17 -05:00
|
|
|
componentTest("with image", {
|
|
|
|
template: "{{image-uploader imageUrl='/some/upload.png'}}",
|
|
|
|
|
2019-02-20 00:55:55 -05:00
|
|
|
async test(assert) {
|
2018-11-12 03:19:17 -05:00
|
|
|
assert.equal(
|
2019-01-22 06:02:02 -05:00
|
|
|
this.$(".d-icon-far-image").length,
|
2018-11-12 03:19:17 -05:00
|
|
|
1,
|
|
|
|
"it displays the upload icon"
|
|
|
|
);
|
|
|
|
|
|
|
|
assert.equal(
|
2019-01-22 06:02:02 -05:00
|
|
|
this.$(".d-icon-far-trash-alt").length,
|
2018-11-12 03:19:17 -05:00
|
|
|
1,
|
|
|
|
"it displays the trash icon"
|
|
|
|
);
|
2019-02-20 00:55:55 -05:00
|
|
|
|
|
|
|
assert.equal(
|
|
|
|
this.$(".image-uploader-info").length,
|
|
|
|
0,
|
|
|
|
"it does not display the image info"
|
|
|
|
);
|
|
|
|
|
|
|
|
await click(".image-uploader-info-btn");
|
|
|
|
|
|
|
|
assert.equal(
|
|
|
|
this.$(".image-uploader-info").length,
|
|
|
|
1,
|
|
|
|
"it displays the image info"
|
|
|
|
);
|
2018-11-12 03:19:17 -05:00
|
|
|
}
|
|
|
|
});
|
|
|
|
|
2018-11-12 02:55:56 -05:00
|
|
|
componentTest("without image", {
|
|
|
|
template: "{{image-uploader}}",
|
|
|
|
|
|
|
|
test(assert) {
|
2018-11-12 03:19:17 -05:00
|
|
|
assert.equal(
|
2019-01-22 06:02:02 -05:00
|
|
|
this.$(".d-icon-far-image").length,
|
2018-11-12 03:19:17 -05:00
|
|
|
1,
|
|
|
|
"it displays the upload icon"
|
|
|
|
);
|
|
|
|
|
2018-11-12 02:55:56 -05:00
|
|
|
assert.equal(
|
2019-01-22 06:02:02 -05:00
|
|
|
this.$(".d-icon-far-trash-alt").length,
|
2018-11-12 02:55:56 -05:00
|
|
|
0,
|
|
|
|
"it does not display trash icon"
|
|
|
|
);
|
2019-02-20 00:55:55 -05:00
|
|
|
|
|
|
|
assert.equal(
|
|
|
|
this.$(".image-uploader-info-btn").length,
|
|
|
|
0,
|
|
|
|
"it does not display the image info button toggle"
|
|
|
|
);
|
2018-11-12 02:55:56 -05:00
|
|
|
}
|
|
|
|
});
|