2018-11-12 15:55:56 +08:00
|
|
|
import componentTest from "helpers/component-test";
|
|
|
|
moduleForComponent("image-uploader", { integration: true });
|
|
|
|
|
2018-11-12 16:19:17 +08:00
|
|
|
componentTest("with image", {
|
|
|
|
template: "{{image-uploader imageUrl='/some/upload.png'}}",
|
|
|
|
|
2019-02-20 13:55:55 +08:00
|
|
|
async test(assert) {
|
2018-11-12 16:19:17 +08:00
|
|
|
assert.equal(
|
2019-02-25 23:04:55 +08:00
|
|
|
find(".d-icon-far-image").length,
|
2018-11-12 16:19:17 +08:00
|
|
|
1,
|
|
|
|
"it displays the upload icon"
|
|
|
|
);
|
|
|
|
|
|
|
|
assert.equal(
|
2019-02-25 23:04:55 +08:00
|
|
|
find(".d-icon-far-trash-alt").length,
|
2018-11-12 16:19:17 +08:00
|
|
|
1,
|
|
|
|
"it displays the trash icon"
|
|
|
|
);
|
2019-02-20 13:55:55 +08:00
|
|
|
|
2019-02-21 10:13:37 +08:00
|
|
|
await click(".image-uploader-lightbox-btn");
|
2019-02-20 13:55:55 +08:00
|
|
|
|
|
|
|
assert.equal(
|
2019-02-21 10:13:37 +08:00
|
|
|
$(".mfp-container").length,
|
2019-02-20 13:55:55 +08:00
|
|
|
1,
|
2019-02-21 10:13:37 +08:00
|
|
|
"it displays the image lightbox"
|
2019-02-20 13:55:55 +08:00
|
|
|
);
|
2018-11-12 16:19:17 +08:00
|
|
|
}
|
|
|
|
});
|
|
|
|
|
2018-11-12 15:55:56 +08:00
|
|
|
componentTest("without image", {
|
|
|
|
template: "{{image-uploader}}",
|
|
|
|
|
|
|
|
test(assert) {
|
2018-11-12 16:19:17 +08:00
|
|
|
assert.equal(
|
2019-02-25 23:04:55 +08:00
|
|
|
find(".d-icon-far-image").length,
|
2018-11-12 16:19:17 +08:00
|
|
|
1,
|
|
|
|
"it displays the upload icon"
|
|
|
|
);
|
|
|
|
|
2018-11-12 15:55:56 +08:00
|
|
|
assert.equal(
|
2019-02-25 23:04:55 +08:00
|
|
|
find(".d-icon-far-trash-alt").length,
|
2018-11-12 15:55:56 +08:00
|
|
|
0,
|
|
|
|
"it does not display trash icon"
|
|
|
|
);
|
2019-02-20 13:55:55 +08:00
|
|
|
|
|
|
|
assert.equal(
|
2019-02-25 23:04:55 +08:00
|
|
|
find(".image-uploader-lightbox-btn").length,
|
2019-02-20 13:55:55 +08:00
|
|
|
0,
|
2019-02-21 10:13:37 +08:00
|
|
|
"it does not display the button to open image lightbox"
|
2019-02-20 13:55:55 +08:00
|
|
|
);
|
2018-11-12 15:55:56 +08:00
|
|
|
}
|
|
|
|
});
|