/* @oracle/oraclejet-preact: undefined */
import { jsx } from 'preact/jsx-runtime';
import { waitFor, screen, render } from '@testing-library/preact';
import { expect } from 'chai';
import { m as matchTranslationBundle } from '../../matchTranslationBundle-d9e64706.js';
import '../../LayerHost-e6402730.js';
import { R as RootEnvironmentProvider } from '../../EnvironmentProvider-bada8909.js';
import { V as VisProgressiveLoader } from '../../VisProgressiveLoader-36c728ac.js';
import '../../Common/themes/redwood/theme.js';
import '../../Common/themes/themeContract.css.js';
import 'preact';
import 'preact/compat';
import '../../UNSAFE_Layer/themes/LayerHostStyles.css.js';
import './../../LayerHostStyles.styles.css';
import 'preact/hooks';
import '../../LayerManager-fa745cec.js';
import '../../useLoadingIndicatorTimer-898d4e3e.js';
import '../../useTimer-571e41e7.js';
import '../../LiveRegion-b56a1aa2.js';
import './../../LiveRegionStyles.styles.css';
import '../../useTestId-9b504481.js';
import '../../HiddenAccessible-61197e7c.js';
import './../../HiddenAccessibleStyles.styles.css';
import '../../useId-03dbfdf0.js';
import '../../useTranslationBundle-09302c20.js';
import '../themes/ProgressiveLoaderStyles.css.js';
import './../../ProgressiveLoaderStyles.styles.css';
import '../../classNames-4e12b00d.js';
import '../../size-18139a3a.js';
import '../../utils-a4102e03.js';
import '../../colorUtils-16eb823f.js';
import '../../_curry1-25297e59.js';
import '../../Skeleton-7b5ff102.js';
import '../../dimensions-d4159ace.js';
import '../../mergeInterpolations-e2db2a66.js';
import '../../mergeDeepWithKey-08531060.js';
import '../../_curry3-0b4222d7.js';
import '../../_curry2-34316bcf.js';
import '../../_isObject-1fab0f5b.js';
import '../../borders-98a63040.js';
import '../../useComponentTheme-d2f9e47f.js';
import '../../logger-c92f309c.js';
import '../../UNSAFE_Skeleton/themes/redwood/SkeletonTheme.js';
import '../../UNSAFE_Skeleton/themes/SkeletonStyles.css.js';
import './../../SkeletonStyles.styles.css';
import '../../UNSAFE_Skeleton/themes/redwood/SkeletonBaseTheme.css.js';
import './../../UNSAFE_Skeleton/themes/redwood/SkeletonBaseTheme.styles.css';
import '../../UNSAFE_Skeleton/themes/redwood/SkeletonVariants.css.js';
import '../../vanilla-extract-recipes-createRuntimeFn.esm-2aaf8c98.js';
import '../themes/VisSkeletonStyles.css.js';
import './../../VisSkeletonStyles.styles.css';

function __variableDynamicImportRuntime2__(path) {
  switch (path) {
    case '../../resources/nls/ar/bundle.ts': return import('../../resources/nls/ar/bundle.js');
    case '../../resources/nls/ar-XB/bundle.ts': return import('../../resources/nls/ar-XB/bundle.js');
    case '../../resources/nls/bg/bundle.ts': return import('../../resources/nls/bg/bundle.js');
    case '../../resources/nls/bs/bundle.ts': return import('../../resources/nls/bs/bundle.js');
    case '../../resources/nls/bs-Cyrl/bundle.ts': return import('../../resources/nls/bs-Cyrl/bundle.js');
    case '../../resources/nls/cs/bundle.ts': return import('../../resources/nls/cs/bundle.js');
    case '../../resources/nls/da/bundle.ts': return import('../../resources/nls/da/bundle.js');
    case '../../resources/nls/de/bundle.ts': return import('../../resources/nls/de/bundle.js');
    case '../../resources/nls/el/bundle.ts': return import('../../resources/nls/el/bundle.js');
    case '../../resources/nls/en/bundle.ts': return import('../../resources/nls/en/bundle.js');
    case '../../resources/nls/en-XA/bundle.ts': return import('../../resources/nls/en-XA/bundle.js');
    case '../../resources/nls/en-XC/bundle.ts': return import('../../resources/nls/en-XC/bundle.js');
    case '../../resources/nls/es/bundle.ts': return import('../../resources/nls/es/bundle.js');
    case '../../resources/nls/et/bundle.ts': return import('../../resources/nls/et/bundle.js');
    case '../../resources/nls/fi/bundle.ts': return import('../../resources/nls/fi/bundle.js');
    case '../../resources/nls/fr/bundle.ts': return import('../../resources/nls/fr/bundle.js');
    case '../../resources/nls/fr-CA/bundle.ts': return import('../../resources/nls/fr-CA/bundle.js');
    case '../../resources/nls/he/bundle.ts': return import('../../resources/nls/he/bundle.js');
    case '../../resources/nls/hr/bundle.ts': return import('../../resources/nls/hr/bundle.js');
    case '../../resources/nls/hu/bundle.ts': return import('../../resources/nls/hu/bundle.js');
    case '../../resources/nls/is/bundle.ts': return import('../../resources/nls/is/bundle.js');
    case '../../resources/nls/it/bundle.ts': return import('../../resources/nls/it/bundle.js');
    case '../../resources/nls/ja/bundle.ts': return import('../../resources/nls/ja/bundle.js');
    case '../../resources/nls/ko/bundle.ts': return import('../../resources/nls/ko/bundle.js');
    case '../../resources/nls/lt/bundle.ts': return import('../../resources/nls/lt/bundle.js');
    case '../../resources/nls/lv/bundle.ts': return import('../../resources/nls/lv/bundle.js');
    case '../../resources/nls/ms/bundle.ts': return import('../../resources/nls/ms/bundle.js');
    case '../../resources/nls/nl/bundle.ts': return import('../../resources/nls/nl/bundle.js');
    case '../../resources/nls/no/bundle.ts': return import('../../resources/nls/no/bundle.js');
    case '../../resources/nls/pl/bundle.ts': return import('../../resources/nls/pl/bundle.js');
    case '../../resources/nls/pt/bundle.ts': return import('../../resources/nls/pt/bundle.js');
    case '../../resources/nls/pt-PT/bundle.ts': return import('../../resources/nls/pt-PT/bundle.js');
    case '../../resources/nls/ro/bundle.ts': return import('../../resources/nls/ro/bundle.js');
    case '../../resources/nls/ru/bundle.ts': return import('../../resources/nls/ru/bundle.js');
    case '../../resources/nls/sk/bundle.ts': return import('../../resources/nls/sk/bundle.js');
    case '../../resources/nls/sl/bundle.ts': return import('../../resources/nls/sl/bundle.js');
    case '../../resources/nls/sr/bundle.ts': return import('../../resources/nls/sr/bundle.js');
    case '../../resources/nls/sr-Latn/bundle.ts': return import('../../resources/nls/sr-Latn/bundle.js');
    case '../../resources/nls/sv/bundle.ts': return import('../../resources/nls/sv/bundle.js');
    case '../../resources/nls/th/bundle.ts': return import('../../resources/nls/th/bundle.js');
    case '../../resources/nls/tr/bundle.ts': return import('../../resources/nls/tr/bundle.js');
    case '../../resources/nls/uk/bundle.ts': return import('../../resources/nls/uk/bundle.js');
    case '../../resources/nls/vi/bundle.ts': return import('../../resources/nls/vi/bundle.js');
    case '../../resources/nls/zh-Hans/bundle.ts': return import('../../resources/nls/zh-Hans/bundle.js');
    case '../../resources/nls/zh-Hant/bundle.ts': return import('../../resources/nls/zh-Hant/bundle.js');
    default: return new Promise(function(resolve, reject) {
      (typeof queueMicrotask === 'function' ? queueMicrotask : setTimeout)(
        reject.bind(null, new Error("Unknown variable dynamic import: " + path))
      );
    })
   }
 }

function __variableDynamicImportRuntime1__(path) {
  switch (path) {
    case '../../resources/nls/ar/bundle.ts': return import('../../resources/nls/ar/bundle.js');
    case '../../resources/nls/ar-XB/bundle.ts': return import('../../resources/nls/ar-XB/bundle.js');
    case '../../resources/nls/bg/bundle.ts': return import('../../resources/nls/bg/bundle.js');
    case '../../resources/nls/bs/bundle.ts': return import('../../resources/nls/bs/bundle.js');
    case '../../resources/nls/bs-Cyrl/bundle.ts': return import('../../resources/nls/bs-Cyrl/bundle.js');
    case '../../resources/nls/cs/bundle.ts': return import('../../resources/nls/cs/bundle.js');
    case '../../resources/nls/da/bundle.ts': return import('../../resources/nls/da/bundle.js');
    case '../../resources/nls/de/bundle.ts': return import('../../resources/nls/de/bundle.js');
    case '../../resources/nls/el/bundle.ts': return import('../../resources/nls/el/bundle.js');
    case '../../resources/nls/en/bundle.ts': return import('../../resources/nls/en/bundle.js');
    case '../../resources/nls/en-XA/bundle.ts': return import('../../resources/nls/en-XA/bundle.js');
    case '../../resources/nls/en-XC/bundle.ts': return import('../../resources/nls/en-XC/bundle.js');
    case '../../resources/nls/es/bundle.ts': return import('../../resources/nls/es/bundle.js');
    case '../../resources/nls/et/bundle.ts': return import('../../resources/nls/et/bundle.js');
    case '../../resources/nls/fi/bundle.ts': return import('../../resources/nls/fi/bundle.js');
    case '../../resources/nls/fr/bundle.ts': return import('../../resources/nls/fr/bundle.js');
    case '../../resources/nls/fr-CA/bundle.ts': return import('../../resources/nls/fr-CA/bundle.js');
    case '../../resources/nls/he/bundle.ts': return import('../../resources/nls/he/bundle.js');
    case '../../resources/nls/hr/bundle.ts': return import('../../resources/nls/hr/bundle.js');
    case '../../resources/nls/hu/bundle.ts': return import('../../resources/nls/hu/bundle.js');
    case '../../resources/nls/is/bundle.ts': return import('../../resources/nls/is/bundle.js');
    case '../../resources/nls/it/bundle.ts': return import('../../resources/nls/it/bundle.js');
    case '../../resources/nls/ja/bundle.ts': return import('../../resources/nls/ja/bundle.js');
    case '../../resources/nls/ko/bundle.ts': return import('../../resources/nls/ko/bundle.js');
    case '../../resources/nls/lt/bundle.ts': return import('../../resources/nls/lt/bundle.js');
    case '../../resources/nls/lv/bundle.ts': return import('../../resources/nls/lv/bundle.js');
    case '../../resources/nls/ms/bundle.ts': return import('../../resources/nls/ms/bundle.js');
    case '../../resources/nls/nl/bundle.ts': return import('../../resources/nls/nl/bundle.js');
    case '../../resources/nls/no/bundle.ts': return import('../../resources/nls/no/bundle.js');
    case '../../resources/nls/pl/bundle.ts': return import('../../resources/nls/pl/bundle.js');
    case '../../resources/nls/pt/bundle.ts': return import('../../resources/nls/pt/bundle.js');
    case '../../resources/nls/pt-PT/bundle.ts': return import('../../resources/nls/pt-PT/bundle.js');
    case '../../resources/nls/ro/bundle.ts': return import('../../resources/nls/ro/bundle.js');
    case '../../resources/nls/ru/bundle.ts': return import('../../resources/nls/ru/bundle.js');
    case '../../resources/nls/sk/bundle.ts': return import('../../resources/nls/sk/bundle.js');
    case '../../resources/nls/sl/bundle.ts': return import('../../resources/nls/sl/bundle.js');
    case '../../resources/nls/sr/bundle.ts': return import('../../resources/nls/sr/bundle.js');
    case '../../resources/nls/sr-Latn/bundle.ts': return import('../../resources/nls/sr-Latn/bundle.js');
    case '../../resources/nls/sv/bundle.ts': return import('../../resources/nls/sv/bundle.js');
    case '../../resources/nls/th/bundle.ts': return import('../../resources/nls/th/bundle.js');
    case '../../resources/nls/tr/bundle.ts': return import('../../resources/nls/tr/bundle.js');
    case '../../resources/nls/uk/bundle.ts': return import('../../resources/nls/uk/bundle.js');
    case '../../resources/nls/vi/bundle.ts': return import('../../resources/nls/vi/bundle.js');
    case '../../resources/nls/zh-Hans/bundle.ts': return import('../../resources/nls/zh-Hans/bundle.js');
    case '../../resources/nls/zh-Hant/bundle.ts': return import('../../resources/nls/zh-Hant/bundle.js');
    default: return new Promise(function(resolve, reject) {
      (typeof queueMicrotask === 'function' ? queueMicrotask : setTimeout)(
        reject.bind(null, new Error("Unknown variable dynamic import: " + path))
      );
    })
   }
 }

function __variableDynamicImportRuntime0__(path) {
  switch (path) {
    case '../../resources/nls/ar/bundle.ts': return import('../../resources/nls/ar/bundle.js');
    case '../../resources/nls/ar-XB/bundle.ts': return import('../../resources/nls/ar-XB/bundle.js');
    case '../../resources/nls/bg/bundle.ts': return import('../../resources/nls/bg/bundle.js');
    case '../../resources/nls/bs/bundle.ts': return import('../../resources/nls/bs/bundle.js');
    case '../../resources/nls/bs-Cyrl/bundle.ts': return import('../../resources/nls/bs-Cyrl/bundle.js');
    case '../../resources/nls/cs/bundle.ts': return import('../../resources/nls/cs/bundle.js');
    case '../../resources/nls/da/bundle.ts': return import('../../resources/nls/da/bundle.js');
    case '../../resources/nls/de/bundle.ts': return import('../../resources/nls/de/bundle.js');
    case '../../resources/nls/el/bundle.ts': return import('../../resources/nls/el/bundle.js');
    case '../../resources/nls/en/bundle.ts': return import('../../resources/nls/en/bundle.js');
    case '../../resources/nls/en-XA/bundle.ts': return import('../../resources/nls/en-XA/bundle.js');
    case '../../resources/nls/en-XC/bundle.ts': return import('../../resources/nls/en-XC/bundle.js');
    case '../../resources/nls/es/bundle.ts': return import('../../resources/nls/es/bundle.js');
    case '../../resources/nls/et/bundle.ts': return import('../../resources/nls/et/bundle.js');
    case '../../resources/nls/fi/bundle.ts': return import('../../resources/nls/fi/bundle.js');
    case '../../resources/nls/fr/bundle.ts': return import('../../resources/nls/fr/bundle.js');
    case '../../resources/nls/fr-CA/bundle.ts': return import('../../resources/nls/fr-CA/bundle.js');
    case '../../resources/nls/he/bundle.ts': return import('../../resources/nls/he/bundle.js');
    case '../../resources/nls/hr/bundle.ts': return import('../../resources/nls/hr/bundle.js');
    case '../../resources/nls/hu/bundle.ts': return import('../../resources/nls/hu/bundle.js');
    case '../../resources/nls/is/bundle.ts': return import('../../resources/nls/is/bundle.js');
    case '../../resources/nls/it/bundle.ts': return import('../../resources/nls/it/bundle.js');
    case '../../resources/nls/ja/bundle.ts': return import('../../resources/nls/ja/bundle.js');
    case '../../resources/nls/ko/bundle.ts': return import('../../resources/nls/ko/bundle.js');
    case '../../resources/nls/lt/bundle.ts': return import('../../resources/nls/lt/bundle.js');
    case '../../resources/nls/lv/bundle.ts': return import('../../resources/nls/lv/bundle.js');
    case '../../resources/nls/ms/bundle.ts': return import('../../resources/nls/ms/bundle.js');
    case '../../resources/nls/nl/bundle.ts': return import('../../resources/nls/nl/bundle.js');
    case '../../resources/nls/no/bundle.ts': return import('../../resources/nls/no/bundle.js');
    case '../../resources/nls/pl/bundle.ts': return import('../../resources/nls/pl/bundle.js');
    case '../../resources/nls/pt/bundle.ts': return import('../../resources/nls/pt/bundle.js');
    case '../../resources/nls/pt-PT/bundle.ts': return import('../../resources/nls/pt-PT/bundle.js');
    case '../../resources/nls/ro/bundle.ts': return import('../../resources/nls/ro/bundle.js');
    case '../../resources/nls/ru/bundle.ts': return import('../../resources/nls/ru/bundle.js');
    case '../../resources/nls/sk/bundle.ts': return import('../../resources/nls/sk/bundle.js');
    case '../../resources/nls/sl/bundle.ts': return import('../../resources/nls/sl/bundle.js');
    case '../../resources/nls/sr/bundle.ts': return import('../../resources/nls/sr/bundle.js');
    case '../../resources/nls/sr-Latn/bundle.ts': return import('../../resources/nls/sr-Latn/bundle.js');
    case '../../resources/nls/sv/bundle.ts': return import('../../resources/nls/sv/bundle.js');
    case '../../resources/nls/th/bundle.ts': return import('../../resources/nls/th/bundle.js');
    case '../../resources/nls/tr/bundle.ts': return import('../../resources/nls/tr/bundle.js');
    case '../../resources/nls/uk/bundle.ts': return import('../../resources/nls/uk/bundle.js');
    case '../../resources/nls/vi/bundle.ts': return import('../../resources/nls/vi/bundle.js');
    case '../../resources/nls/zh-Hans/bundle.ts': return import('../../resources/nls/zh-Hans/bundle.js');
    case '../../resources/nls/zh-Hant/bundle.ts': return import('../../resources/nls/zh-Hant/bundle.js');
    default: return new Promise(function(resolve, reject) {
      (typeof queueMicrotask === 'function' ? queueMicrotask : setTimeout)(
        reject.bind(null, new Error("Unknown variable dynamic import: " + path))
      );
    })
   }
 }
const ariaLabel = 'ariaLabel';
const ariaDescribeId = 'ariaDescribeId';
const ariaLabelledId = 'ariaLabelledId';
const componentText = 'Dummy Component';
describe('Test VisProgressiveLoader component', () => {
    it('render (loading)', async function () {
        await setupVisProgressiveLoader(true);
        // There's a delay before loading indicator is shown
        await waitFor(() => {
            // The dummy component doesn't have role application
            // During loading, the container should have role application
            const target = screen.getByRole('application');
            expect(target).not.null;
        });
    });
    it('live region text (loading)', async function () {
        const locale = matchTranslationBundle(['en'], new Set(['en-US', 'en']));
        const { default: translations } = await __variableDynamicImportRuntime0__(`../../resources/nls/${locale}/bundle.ts`);
        await setupVisProgressiveLoader(true);
        // There's a delay before loading indicator is shown
        await waitFor(() => {
            // The dummy component doesn't have role application
            // During loading, the container should have role application
            const target = screen.getByRole('application');
            expect(target).not.null;
        });
        await waitFor(() => {
            const loadingText = screen.getByText(translations.vis_stateLoading());
            expect(loadingText).not.null;
        });
    });
    it('render (loaded)', async function () {
        await setupVisProgressiveLoader(false);
        const compText = await screen.findByText(componentText);
        expect(compText).not.null;
    });
    it('live region text (loaded)', async function () {
        const locale = matchTranslationBundle(['en'], new Set(['en-US', 'en']));
        const { default: translations } = await __variableDynamicImportRuntime1__(`../../resources/nls/${locale}/bundle.ts`);
        await setupVisProgressiveLoader(false);
        const loadedText = await screen.findByText(translations.vis_stateLoaded());
        expect(loadedText).not.null;
    });
    it('aria-label, aria-labelledBy and aria-describedBy is set', async function () {
        await setupVisProgressiveLoader(true, ariaDescribeId, ariaLabelledId, ariaLabel);
        await waitFor(() => {
            const target = screen.getByRole('application');
            expect(target?.getAttribute('aria-label')).equal(ariaLabel);
        });
        const target = screen.getByRole('application');
        expect(target?.getAttribute('aria-labelledby')).equal(ariaLabelledId);
        expect(target?.getAttribute('aria-describedby')).contains(ariaDescribeId);
    });
});
const setupVisProgressiveLoader = async (isLoading, describedBy, labelledBy, label) => {
    const locale = matchTranslationBundle(['en'], new Set(['en-US', 'en']));
    const { default: translations } = await __variableDynamicImportRuntime2__(`../../resources/nls/${locale}/bundle.ts`);
    const env = {
        translations: { '@oracle/oraclejet-preact': translations }
    };
    const visProgressiveLoader = (jsx(VisProgressiveLoader, { role: "application", type: "bar", isLoading: isLoading ?? true, width: "100x", height: "100x", "aria-label": label, "aria-describedby": describedBy, "aria-labelledby": labelledBy, children: jsx("div", { style: { width: '100%', height: '100%' }, children: componentText }) }));
    return render(jsx(RootEnvironmentProvider, { environment: env, children: visProgressiveLoader }));
};
//# sourceMappingURL=VisProgressiveLoader.spec.js.map
