/* * Copyright 2015 Palantir Technologies, Inc. All rights reserved. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ import { waitFor } from "@testing-library/dom"; import { mount, type ReactWrapper } from "enzyme"; import { act } from "react"; import { afterEach, assert, beforeEach, describe, expect, it, vi } from "@blueprintjs/test-commons/vitest"; import { Classes } from "../../common"; import { Tab } from "./tab"; import { Tabs, type TabsProps, type TabsState } from "./tabs"; import { generateTabIds } from "./tabTitle"; describe("", () => { const ID = "tabsTests"; // default tabs content is generated from these IDs in each test const TAB_IDS = ["first", "second", "third"]; // selectors using ARIA role const TAB_SELECTOR = "[role='tab']"; const TAB_LIST_SELECTOR = "[role='tablist']"; const TAB_PANEL_SELECTOR = "[role='tabpanel']"; let containerElement: HTMLElement; beforeEach(() => { containerElement = document.createElement("div"); document.body.appendChild(containerElement); }); afterEach(() => containerElement.remove()); it("gets by without children", () => { assert.doesNotThrow(() => mount()); }); it("supports non-existent children", () => { assert.doesNotThrow(() => mount( {null} {undefined} , ), ); }); it("default selectedTabId is first non-null Tab id", () => { const wrapper = mount( {null} {