mirror of
https://github.com/discourse/discourse.git
synced 2024-11-29 13:03:44 +08:00
2a4a2a2ab7
A few tests were removed that were testing a subforum for the logo, which I don't think gain us much anymore. We use `getURL` everywhere and needn't test it so much. Plus, over time it's always good to remove a few tests here and there :)
90 lines
1.8 KiB
JavaScript
90 lines
1.8 KiB
JavaScript
import componentTest from "helpers/component-test";
|
|
moduleForComponent("image-uploader", { integration: true });
|
|
|
|
componentTest("with image", {
|
|
template:
|
|
"{{image-uploader imageUrl='/images/avatar.png' placeholderUrl='/not/used.png'}}",
|
|
|
|
async test(assert) {
|
|
assert.equal(
|
|
find(".d-icon-far-image").length,
|
|
1,
|
|
"it displays the upload icon"
|
|
);
|
|
|
|
assert.equal(
|
|
find(".d-icon-far-trash-alt").length,
|
|
1,
|
|
"it displays the trash icon"
|
|
);
|
|
|
|
assert.equal(
|
|
find(".placeholder-overlay").length,
|
|
0,
|
|
"it does not display the placeholder image"
|
|
);
|
|
|
|
await click(".image-uploader-lightbox-btn");
|
|
|
|
assert.equal(
|
|
$(".mfp-container").length,
|
|
1,
|
|
"it displays the image lightbox"
|
|
);
|
|
}
|
|
});
|
|
|
|
componentTest("without image", {
|
|
template: "{{image-uploader}}",
|
|
|
|
test(assert) {
|
|
assert.equal(
|
|
find(".d-icon-far-image").length,
|
|
1,
|
|
"it displays the upload icon"
|
|
);
|
|
|
|
assert.equal(
|
|
find(".d-icon-far-trash-alt").length,
|
|
0,
|
|
"it does not display trash icon"
|
|
);
|
|
|
|
assert.equal(
|
|
find(".image-uploader-lightbox-btn").length,
|
|
0,
|
|
"it does not display the button to open image lightbox"
|
|
);
|
|
}
|
|
});
|
|
|
|
componentTest("with placeholder", {
|
|
template: "{{image-uploader placeholderUrl='/images/avatar.png'}}",
|
|
|
|
test(assert) {
|
|
assert.equal(
|
|
find(".d-icon-far-image").length,
|
|
1,
|
|
"it displays the upload icon"
|
|
);
|
|
|
|
assert.equal(
|
|
find(".d-icon-far-trash-alt").length,
|
|
0,
|
|
"it does not display trash icon"
|
|
);
|
|
|
|
assert.equal(
|
|
find(".image-uploader-lightbox-btn").length,
|
|
0,
|
|
"it does not display the button to open image lightbox"
|
|
);
|
|
|
|
assert.equal(
|
|
find(".placeholder-overlay").length,
|
|
1,
|
|
"it displays the placeholder image"
|
|
);
|
|
}
|
|
});
|