Skip to content

A platform for community discussion. Free, open, simple.

1.3 KB
Raw Blame
import { render } from "@ember/test-helpers";
import { module, test } from "qunit";
import { setupRenderingTest } from "discourse/tests/helpers/component-test";
import AdminHolidaysList from "discourse/plugins/discourse-events/discourse/components/admin-holidays-list";

module("Integration | Component | AdminHolidaysList", function (hooks) {
  setupRenderingTest(hooks);

  test("displaying a list of the provided holidays", async function (assert) {
    this.set("holidays", [
      { date: "2022-01-01", name: "New Year's Day" },
      { date: "2022-01-17", name: "Martin Luther King, Jr. Day" },
    ]);

    await render(
      <template><AdminHolidaysList @holidays={{this.holidays}} /></template>
    );

    assert
      .dom("table tbody tr:nth-child(1) td:nth-child(1)")
      .hasText("2022-01-01", "it displays the first holiday date");
    assert
      .dom("table tbody tr:nth-child(1) td:nth-child(2)")
      .hasText("New Year's Day", "it displays the first holiday name");

    assert
      .dom("table tbody tr:nth-child(2) td:nth-child(1)")
      .hasText("2022-01-17", "it displays the second holiday date");
    assert
      .dom("table tbody tr:nth-child(2) td:nth-child(2)")
      .hasText(
        "Martin Luther King, Jr. Day",
        "it displays the second holiday name"
      );
  });
});