diff --git a/web/app/components/doc/folder-affordance.hbs b/web/app/components/doc/folder-affordance.hbs index 62147e869..065b5e42a 100644 --- a/web/app/components/doc/folder-affordance.hbs +++ b/web/app/components/doc/folder-affordance.hbs @@ -2,7 +2,7 @@ data-test-doc-thumbnail-folder-affordance xmlns="http://www.w3.org/2000/svg" fill="none" - viewBox={{if @isLarge "0 0 97 145" "0 0 43 63"}} + viewBox={{if this.sizeIsLarge "0 0 97 145" "0 0 43 63"}} class="folder-affordance" > diff --git a/web/app/components/doc/folder-affordance.ts b/web/app/components/doc/folder-affordance.ts index bdc0636dd..2b6e8f0f4 100644 --- a/web/app/components/doc/folder-affordance.ts +++ b/web/app/components/doc/folder-affordance.ts @@ -2,11 +2,15 @@ import Component from "@glimmer/component"; interface DocFolderAffordanceSignature { Args: { - isLarge?: boolean; + size?: "large"; }; } -export default class DocFolderAffordance extends Component {} +export default class DocFolderAffordance extends Component { + protected get sizeIsLarge(): boolean { + return this.args.size === "large"; + } +} declare module "@glint/environment-ember-loose/registry" { export default interface Registry { diff --git a/web/app/components/doc/thumbnail.hbs b/web/app/components/doc/thumbnail.hbs index 393eeefb9..f45840082 100644 --- a/web/app/components/doc/thumbnail.hbs +++ b/web/app/components/doc/thumbnail.hbs @@ -1,16 +1,16 @@
- + -
+
{{#if this.isObsolete}} - + {{/if}} {{#if (or this.isApproved this.isObsolete)}} diff --git a/web/app/components/doc/thumbnail.ts b/web/app/components/doc/thumbnail.ts index 47cfeb08f..c5c864d48 100644 --- a/web/app/components/doc/thumbnail.ts +++ b/web/app/components/doc/thumbnail.ts @@ -5,9 +5,9 @@ import getProductId from "hermes/utils/get-product-id"; interface DocThumbnailComponentSignature { Element: HTMLDivElement; Args: { - isLarge?: boolean; status?: string; product?: string; + size?: "large"; }; } @@ -20,6 +20,10 @@ export default class DocThumbnailComponent extends Component
diff --git a/web/tests/integration/components/doc/folder-affordance-test.ts b/web/tests/integration/components/doc/folder-affordance-test.ts index 15373dd35..ae387bbb0 100644 --- a/web/tests/integration/components/doc/folder-affordance-test.ts +++ b/web/tests/integration/components/doc/folder-affordance-test.ts @@ -1,32 +1,38 @@ import { module, test } from "qunit"; import { setupRenderingTest } from "ember-qunit"; import { hbs } from "ember-cli-htmlbars"; -import { render } from "@ember/test-helpers"; +import { TestContext, render } from "@ember/test-helpers"; + +interface DocFolderAffordanceTestContext extends TestContext { + size?: "large"; +} module("Integration | Component | doc/folder-affordance", function (hooks) { setupRenderingTest(hooks); test("it renders as expected", async function (assert) { - this.set("isLarge", false); - await render(hbs` - {{! @glint-nocheck: not typesafe yet }} - + this.set("size", undefined); + + await render(hbs` + `); assert .dom("[data-test-doc-thumbnail-folder-affordance]") - .hasAttribute("viewBox", "0 0 43 63"); + .hasAttribute( + "viewBox", + "0 0 43 63", + "the default size renders as expected", + ); - this.set("isLarge", true); + this.set("size", "large"); assert .dom("[data-test-doc-thumbnail-folder-affordance]") .hasAttribute( "viewBox", "0 0 97 145", - "the `isLarge` attribute is passed to the component" + "the large size renders as expected", ); }); }); diff --git a/web/tests/integration/components/doc/thumbnail-test.ts b/web/tests/integration/components/doc/thumbnail-test.ts index cfdcc0477..6fc1b2667 100644 --- a/web/tests/integration/components/doc/thumbnail-test.ts +++ b/web/tests/integration/components/doc/thumbnail-test.ts @@ -1,20 +1,25 @@ import { module, test } from "qunit"; import { setupRenderingTest } from "ember-qunit"; import { hbs } from "ember-cli-htmlbars"; -import { render } from "@ember/test-helpers"; +import { TestContext, render } from "@ember/test-helpers"; + +interface DocThumbnailTestContext extends TestContext { + size?: "large"; + status?: string; + product?: string; +} module("Integration | Component | doc/thumbnail", function (hooks) { setupRenderingTest(hooks); test("it renders as expected", async function (assert) { - this.set("isLarge", false); + this.set("size", undefined); this.set("status", "In Review"); this.set("product", "Labs"); - await render(hbs` - {{! @glint-nocheck: not typesafe yet }} + await render(hbs` @@ -30,7 +35,7 @@ module("Integration | Component | doc/thumbnail", function (hooks) { assert.dom("[data-test-doc-status-icon]").doesNotExist(); assert.dom("[data-test-doc-thumbnail-product-badge]").doesNotExist(); - this.set("isLarge", true); + this.set("size", "large"); assert .dom("[data-test-doc-thumbnail]")