diff --git a/app/assets/javascripts/discourse/tests/acceptance/transformers/header-notifications-avatar-size-test.js b/app/assets/javascripts/discourse/tests/acceptance/transformers/header-notifications-avatar-size-test.js new file mode 100644 index 00000000000..34d3d8fdc85 --- /dev/null +++ b/app/assets/javascripts/discourse/tests/acceptance/transformers/header-notifications-avatar-size-test.js @@ -0,0 +1,27 @@ +import { visit } from "@ember/test-helpers"; +import { test } from "qunit"; +import { withPluginApi } from "discourse/lib/plugin-api"; +import { acceptance } from "discourse/tests/helpers/qunit-helpers"; + +acceptance("header-notifications-avatar-size transformer", function (needs) { + needs.user(); + + test("applying a value transformation", async function (assert) { + withPluginApi("1.34.0", (api) => { + api.registerValueTransformer( + "header-notifications-avatar-size", + () => "huge" + ); + }); + + await visit("/"); + + assert + .dom(".current-user .avatar") + .hasAttribute("width", "144", "it transforms the avatar width"); + + assert + .dom(".current-user .avatar") + .hasAttribute("height", "144", "it transforms the avatar height"); + }); +}); diff --git a/app/assets/javascripts/discourse/tests/acceptance/transformers/home-logo-href-test.js b/app/assets/javascripts/discourse/tests/acceptance/transformers/home-logo-href-test.js new file mode 100644 index 00000000000..6788c818511 --- /dev/null +++ b/app/assets/javascripts/discourse/tests/acceptance/transformers/home-logo-href-test.js @@ -0,0 +1,21 @@ +import { visit } from "@ember/test-helpers"; +import { test } from "qunit"; +import { withPluginApi } from "discourse/lib/plugin-api"; +import { acceptance } from "discourse/tests/helpers/qunit-helpers"; + +acceptance("home-logo-href transformer", function () { + test("applying a value transformation", async function (assert) { + withPluginApi("1.34.0", (api) => { + api.registerValueTransformer( + "home-logo-href", + ({ value }) => value + "transformed" + ); + }); + + await visit("/"); + + assert + .dom(".title > a") + .hasAttribute("href", "/transformed", "it transforms the logo link href"); + }); +});