This repository has been archived on 2023-03-18. You can view files and clone it, but cannot push or open issues or pull requests.
osr-discourse-src/app/assets/javascripts/discourse/tests/integration/components/d-navigation-test.js

37 lines
1.1 KiB
JavaScript

import { module, test } from "qunit";
import { setupRenderingTest } from "discourse/tests/helpers/component-test";
import { click, render } from "@ember/test-helpers";
import { count, query } from "discourse/tests/helpers/qunit-helpers";
import { hbs } from "ember-cli-htmlbars";
module("Integration | Component | d-navigation", function (hooks) {
setupRenderingTest(hooks);
hooks.beforeEach(function () {
const categories = this.site.categoriesList
.filter((category) => !category.parent_category_id)
.slice(0, 4);
this.site.setProperties({ categories });
this.currentUser.set(
"indirectly_muted_category_ids",
categories.slice(0, 3).map((category) => category.id)
);
});
test("filters indirectly muted categories", async function (assert) {
await render(hbs`<DNavigation @filterType="categories" />`);
await click(".category-drop .select-kit-header-wrapper");
assert.strictEqual(
count(".category-row"),
1,
"displays only categories that are not muted"
);
assert.strictEqual(
query(".category-row .badge-category span").textContent.trim(),
"dev"
);
});
});