mirror of
https://github.com/discourse/discourse.git
synced 2025-05-22 20:21:25 +08:00
UX: Use dominant color while loading onebox images (#21091)
When we "pull hotlinked images" on onebox images, they are added to the uploads table and their dominant color is calculated. This commit adds the data to the HTML so that it can be used by the client in the same way as non-onebox images. It also adds specific handling to the new `discourse-lazy-videos` plugin.
This commit is contained in:
@ -12,6 +12,7 @@ module("Discourse Lazy Videos | Component | lazy-video", function (hooks) {
|
||||
title: "15 Sorting Algorithms in 6 Minutes",
|
||||
providerName: "youtube",
|
||||
id: "kPRA0W1kECg",
|
||||
dominantColor: "00ffff",
|
||||
};
|
||||
|
||||
test("displays the correct video title", async function (assert) {
|
||||
@ -26,6 +27,14 @@ module("Discourse Lazy Videos | Component | lazy-video", function (hooks) {
|
||||
assert.dom(".icon.youtube-icon").exists();
|
||||
});
|
||||
|
||||
test("uses tthe dominant color from the dom", async function (assert) {
|
||||
await render(hbs`<LazyVideo @videoAttributes={{this.attributes}} />`);
|
||||
|
||||
assert
|
||||
.dom(".video-thumbnail")
|
||||
.hasAttribute("style", "background-color: #00ffff;");
|
||||
});
|
||||
|
||||
test("loads the iframe when clicked", async function (assert) {
|
||||
await render(hbs`<LazyVideo @videoAttributes={{this.attributes}}/>`);
|
||||
assert.dom(".lazy-video-container.video-loaded").doesNotExist();
|
||||
|
Reference in New Issue
Block a user