import { newSpecPage } from "@stencil/core/testing";
import { BpSdkLabel } from "./bp-sdk-label";
describe('bp-sdk-label', () => {
    it('renders', async () => {
        const page = await newSpecPage({
            html: '<bp-sdk-label></bp-sdk-label>',
            components: [BpSdkLabel],
        });
        const el = page.root.querySelector('div');
        expect(el.className).toBe('bp-sdk-label__container');
    });
    it('renders external component if defined', async () => {
        const whenDefinedMock = jest.spyOn(customElements, 'whenDefined').mockResolvedValueOnce({});
        const page = await newSpecPage({
            html: '<bp-sdk-label></bp-sdk-label>',
            components: [BpSdkLabel],
        });
        await page.waitForChanges();
        const element = page.root.querySelector('div');
        expect(element).toBeFalsy();
        whenDefinedMock.mockRestore();
    });
    it('renders changes to the name data', async () => {
        const page = await newSpecPage({
            html: '<bp-sdk-label></bp-sdk-label>',
            components: [BpSdkLabel],
        });
        page.rootInstance.label = 'James';
        await page.waitForChanges();
        const element = page.root.querySelector('.bp-sdk-label__content');
        expect(element.textContent).toEqual(`James`);
    });
});
