REFACTOR: Move qunit tests to a different directory structure

REFACTOR: Move qunit tests to a different directory structure

This structure is closer to how ember-cli expects tests to be placed. It is not their final position, just the first step towards it.

diff --git a/test/javascripts/admin/components/group-list-setting-test.js b/test/javascripts/admin/components/group-list-setting-test.js
deleted file mode 100644
index 2472d66..0000000
--- a/test/javascripts/admin/components/group-list-setting-test.js
+++ /dev/null
@@ -1,59 +0,0 @@
-import EmberObject from "@ember/object";
-import selectKit from "helpers/select-kit-helper";
-import componentTest from "helpers/component-test";
-
-moduleForComponent("group-list", { integration: true });
-
-componentTest("default", {
-  template: "{{site-setting setting=setting}}",
-
-  beforeEach() {
-    this.site.groups = [
-      {
-        id: 1,
-        name: "Donuts",
-      },
-      {
-        id: 2,
-        name: "Cheese cake",
-      },
-    ];
-
-    this.set(
-      "setting",
-      EmberObject.create({
-        allowsNone: undefined,
-        category: "foo",
-        default: "",
-        description: "Choose groups",
-        overridden: false,
-        placeholder: null,
-        preview: null,
-        secret: false,
-        setting: "foo_bar",
-        type: "group_list",
-        validValues: undefined,
-        value: "1",
-      })
-    );
-  },
-
-  async test(assert) {
-    const subject = selectKit(".list-setting");
-
-    assert.equal(
-      subject.header().value(),
-      "1",
-      "it selects the setting's value"
-    );
-
-    await subject.expand();
-    await subject.selectRowByValue("2");
-
-    assert.equal(
-      subject.header().value(),
-      "1,2",
-      "it allows to select a setting from the list of choices"
-    );
-  },
-});
diff --git a/test/javascripts/admin/components/themes-list-item-test.js b/test/javascripts/admin/components/themes-list-item-test.js
deleted file mode 100644
index d983624..0000000
--- a/test/javascripts/admin/components/themes-list-item-test.js
+++ /dev/null
@@ -1,95 +0,0 @@
-import I18n from "I18n";
-import componentTest from "helpers/component-test";
-import Theme from "admin/models/theme";
-
-moduleForComponent("themes-list-item", { integration: true });
-
-componentTest("default theme", {
-  template: "{{themes-list-item theme=theme}}",
-  beforeEach() {
-    this.set("theme", Theme.create({ name: "Test", default: true }));
-  },
-
-  test(assert) {
-    assert.expect(1);
-    assert.equal(find(".d-icon-check").length, 1, "shows default theme icon");
-  },
-});
-
-componentTest("pending updates", {
-  template: "{{themes-list-item theme=theme}}",
-  beforeEach() {
-    this.set(
-      "theme",
-      Theme.create({ name: "Test", remote_theme: { commits_behind: 6 } })
-    );
-  },
-
-  test(assert) {
-    assert.expect(1);
-    assert.equal(find(".d-icon-sync").length, 1, "shows pending update icon");
-  },
-});
-
-componentTest("broken theme", {
-  template: "{{themes-list-item theme=theme}}",
-  beforeEach() {
-    this.set(
-      "theme",
-      Theme.create({
-        name: "Test",
-        theme_fields: [{ name: "scss", type_id: 1, error: "something" }],
-      })
-    );
-  },
-
-  test(assert) {
-    assert.expect(1);
-    assert.equal(
-      find(".d-icon-exclamation-circle").length,
-      1,
-      "shows broken theme icon"
-    );
-  },
-});
-
-componentTest("with children", {
-  template: "{{themes-list-item theme=theme}}",
-
-  beforeEach() {
-    this.childrenList = [1, 2, 3, 4, 5].map((num) =>
-      Theme.create({ name: `Child ${num}`, component: true })
-    );
-
-    this.set(
-      "theme",
-      Theme.create({
-        name: "Test",
-        childThemes: this.childrenList,
-        default: true,
-      })
-    );
-  },
-
-  test(assert) {
-    assert.expect(2);
-    assert.deepEqual(
-      find(".components")
-        .text()
-        .trim()
-        .split(",")
-        .map((n) => n.trim())
-        .join(","),
-      this.childrenList
-        .splice(0, 4)
-        .map((theme) => theme.get("name"))
-        .join(","),
-      "lists the first 4 children"
-    );
-    assert.deepEqual(
-      find(".others-count").text().trim(),
-      I18n.t("admin.customize.theme.and_x_more", { count: 1 }),
-      "shows count of remaining children"
-    );
-  },
-});
diff --git a/test/javascripts/admin/components/themes-list-test.js b/test/javascripts/admin/components/themes-list-test.js
deleted file mode 100644
index 631e84b..0000000
--- a/test/javascripts/admin/components/themes-list-test.js
+++ /dev/null
@@ -1,144 +0,0 @@
-import I18n from "I18n";
-import componentTest from "helpers/component-test";
-import Theme, { THEMES, COMPONENTS } from "admin/models/theme";
-
-moduleForComponent("themes-list", { integration: true });
-
-componentTest("current tab is themes", {
-  template:
-    "{{themes-list themes=themes components=components currentTab=currentTab}}",
-  beforeEach() {
-    this.themes = [1, 2, 3, 4, 5].map((num) =>
-      Theme.create({ name: `Theme ${num}` })
-    );
-    this.components = [1, 2, 3, 4, 5].map((num) =>
-      Theme.create({
-        name: `Child ${num}`,
-        component: true,
-        parentThemes: [this.themes[num - 1]],
-        parent_themes: [1, 2, 3, 4, 5],
-      })
-    );
-    this.setProperties({
-      themes: this.themes,
-      components: this.components,
-      currentTab: THEMES,
-    });
-  },
-
-  test(assert) {
-    assert.equal(
-      find(".themes-tab").hasClass("active"),
-      true,
-      "themes tab is active"
-    );
-    assert.equal(
-      find(".components-tab").hasClass("active"),
-      false,
-      "components tab is not active"
-    );
-
-    assert.equal(
-      find(".inactive-indicator").index(),
-      -1,
-      "there is no inactive themes separator when all themes are inactive"
-    );
-    assert.equal(find(".themes-list-item").length, 5, "displays all themes");
-
-    [2, 3].forEach((num) => this.themes[num].set("user_selectable", true));
-    this.themes[4].set("default", true);
-    this.set("themes", this.themes);
-    const names = [4, 2, 3, 0, 1].map((num) => this.themes[num].get("name")); // default theme always on top, followed by user-selectable ones and then the rest
-    assert.deepEqual(
-      Array.from(find(".themes-list-item").find(".name")).map((node) =>
-        node.innerText.trim()
-      ),
-      names,
-      "sorts themes correctly"
-    );
-    assert.equal(
-      find(".inactive-indicator").index(),
-      3,
-      "the separator is in the right location"
-    );
-
-    this.themes.forEach((theme) => theme.set("user_selectable", true));
-    this.set("themes", this.themes);
-    assert.equal(
-      find(".inactive-indicator").index(),
-      -1,
-      "there is no inactive themes separator when all themes are user-selectable"
-    );
-
-    this.set("themes", []);
-    assert.equal(
-      find(".themes-list-item").length,
-      1,
-      "shows one entry with a message when there is nothing to display"
-    );
-    assert.equal(
-      find(".themes-list-item span.empty").text().trim(),
-      I18n.t("admin.customize.theme.empty"),
-      "displays the right message"
-    );
-  },
-});
-
-componentTest("current tab is components", {
-  template:
-    "{{themes-list themes=themes components=components currentTab=currentTab}}",
-  beforeEach() {
-    this.themes = [1, 2, 3, 4, 5].map((num) =>
-      Theme.create({ name: `Theme ${num}` })
-    );
-    this.components = [1, 2, 3, 4, 5].map((num) =>
-      Theme.create({
-        name: `Child ${num}`,
-        component: true,
-        parentThemes: [this.themes[num - 1]],
-        parent_themes: [1, 2, 3, 4, 5],
-      })
-    );
-    this.setProperties({
-      themes: this.themes,
-      components: this.components,
-      currentTab: COMPONENTS,
-    });
-  },
-
-  test(assert) {
-    assert.equal(
-      find(".components-tab").hasClass("active"),
-      true,
-      "components tab is active"
-    );
-    assert.equal(
-      find(".themes-tab").hasClass("active"),
-      false,
-      "themes tab is not active"
-    );
-
-    assert.equal(
-      find(".inactive-indicator").index(),
-      -1,

[... diff too long, it was truncated ...]

GitHub sha: 445d6ba4

1 Like

This commit appears in #10778 which was approved by CvX. It was merged by eviltrout.