@skyux/tabs 11.16.0 → 11.18.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/documentation.json +407 -391
- package/fesm2022/skyux-tabs-testing.mjs.map +1 -1
- package/fesm2022/skyux-tabs.mjs.map +1 -1
- package/package.json +10 -10
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"skyux-tabs-testing.mjs","sources":["../../../../../libs/components/tabs/testing/src/tabs/tabset-fixture.ts","../../../../../libs/components/tabs/testing/src/skyux-tabs-testing.ts"],"sourcesContent":["import { DebugElement } from '@angular/core';\nimport { ComponentFixture } from '@angular/core/testing';\nimport { By } from '@angular/platform-browser';\nimport { SkyAppTestUtility } from '@skyux-sdk/testing';\n\nimport { SkyTabsetFixtureTab } from './tab-fixture-tab';\n\n/**\n * Allows interaction with a SKY UX tabset component.\n * @internal\n */\nexport class SkyTabsetFixture {\n /**\n * The tabset component's ARIA label.\n */\n public get ariaLabel(): string | undefined {\n const tabsetEl = this.#getTabsetEl();\n return tabsetEl.getAttribute('aria-label') || undefined;\n }\n\n /**\n * The tabset component's ARIA labelled by attribute.\n */\n public get ariaLabelledBy(): string | undefined {\n const tabsetEl = this.#getTabsetEl();\n return tabsetEl.getAttribute('aria-labelledby') || undefined;\n }\n\n /**\n * The index of the currently selected tab.\n */\n public get activeTabIndex(): number {\n const tabLinkEls = this.#getTabLinkEls();\n\n for (let i = 0, n = tabLinkEls.length; i < n; i++) {\n if (tabLinkEls.item(i).classList.contains('sky-btn-tab-selected')) {\n return i;\n }\n }\n\n /* safety check */\n /* istanbul ignore next */\n return -1;\n }\n\n #debugEl: DebugElement;\n #fixture: ComponentFixture<any>;\n\n constructor(fixture: ComponentFixture<any>, skyTestId: string) {\n this.#fixture = fixture;\n this.#debugEl = SkyAppTestUtility.getDebugElementByTestId(\n fixture,\n skyTestId,\n 'sky-tabset',\n );\n }\n\n /**\n * Retrieves information about the tab at the specified index.\n * @param tabIndex The index of the tab.\n */\n public getTab(tabIndex: number): SkyTabsetFixtureTab {\n const tabLinkEl = this.#getTabLinkEl(tabIndex);\n\n const active = this.activeTabIndex === tabIndex;\n const disabled = tabLinkEl.classList.contains('sky-btn-tab-disabled');\n const tabHeading = this.#getTextContent(\n tabLinkEl.querySelector('.sky-tab-heading span')?.childNodes[0],\n );\n const tabHeaderCount = this.#getTextContent(\n tabLinkEl.querySelector('.sky-tab-header-count'),\n );\n\n let permalinkValue: string | undefined;\n\n if (tabLinkEl.href) {\n const permalink = tabLinkEl.href.split('?')[1];\n if (permalink) {\n const permalinkParts = permalink.split('=');\n\n permalinkValue = decodeURIComponent(permalinkParts[1]);\n }\n }\n\n return {\n active,\n disabled,\n permalinkValue,\n tabHeaderCount,\n tabHeading,\n };\n }\n\n /**\n * Clicks the tabset's \"new\" button.\n */\n public async clickNewButton(): Promise<any> {\n return this.#clickButton('sky-tabset-btn-new');\n }\n\n /**\n * Clicks the tabset's \"open\" button.\n */\n public async clickOpenButton(): Promise<any> {\n return this.#clickButton('sky-tabset-btn-open');\n }\n\n /**\n * Clicks the tab button at the specified index.\n * @param tabIndex The index of the tab.\n */\n public async clickTab(tabIndex: number): Promise<any> {\n const tabLinkEl = this.#getTabLinkEl(tabIndex);\n\n tabLinkEl.click();\n\n this.#fixture.detectChanges();\n return this.#fixture.whenStable();\n }\n\n /**\n * Click's the tab's close button at the specified index.\n * @param tabIndex The index of the tab.\n */\n public async clickTabClose(tabIndex: number): Promise<any> {\n const tabWrapperEl = this.#getTabsetEl().querySelectorAll(\n `.sky-tabset-tabs .sky-btn-tab-wrapper`,\n )[tabIndex];\n\n const closeBtnEl = tabWrapperEl.querySelector(\n '.sky-btn-tab-close',\n ) as HTMLButtonElement;\n\n if (!closeBtnEl) {\n throw new Error('The specified tab does not have a close button.');\n }\n\n closeBtnEl.click();\n\n this.#fixture.detectChanges();\n return this.#fixture.whenStable();\n }\n\n async #clickButton(buttonCls: string): Promise<any> {\n const tabsetEl = this.#getTabsetEl();\n\n const newButtonEl = tabsetEl.querySelector(\n `.sky-tabset-btns .${buttonCls}`,\n ) as HTMLButtonElement;\n\n newButtonEl.click();\n\n this.#fixture.detectChanges();\n return this.#fixture.whenStable();\n }\n\n #getTabsetEl(): HTMLDivElement {\n const tabsetEl = this.#debugEl.query(By.css('.sky-tabset')).nativeElement;\n\n return tabsetEl;\n }\n\n #getTabLinkEls(): NodeListOf<HTMLAnchorElement> {\n return this.#getTabsetEl().querySelectorAll(\n `.sky-tabset-tabs .sky-btn-tab`,\n );\n }\n\n #getTabLinkEl(tabIndex: number): HTMLAnchorElement {\n const tabLinkEl = this.#getTabLinkEls().item(tabIndex);\n\n if (!tabLinkEl) {\n throw new Error(`There is no tab at index ${tabIndex}.`);\n }\n\n return tabLinkEl;\n }\n\n #getTextContent(el: Element | Node | undefined | null): string | undefined {\n return (el && el.textContent?.trim()) || undefined;\n }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;AAOA;;;AAGG;MACU,gBAAgB,CAAA;AAC3B;;AAEG;AACH,IAAA,IAAW,SAAS,GAAA;AAClB,QAAA,MAAM,QAAQ,GAAG,IAAI,CAAC,YAAY,EAAE
|
|
1
|
+
{"version":3,"file":"skyux-tabs-testing.mjs","sources":["../../../../../libs/components/tabs/testing/src/tabs/tabset-fixture.ts","../../../../../libs/components/tabs/testing/src/skyux-tabs-testing.ts"],"sourcesContent":["import { DebugElement } from '@angular/core';\nimport { ComponentFixture } from '@angular/core/testing';\nimport { By } from '@angular/platform-browser';\nimport { SkyAppTestUtility } from '@skyux-sdk/testing';\n\nimport { SkyTabsetFixtureTab } from './tab-fixture-tab';\n\n/**\n * Allows interaction with a SKY UX tabset component.\n * @internal\n */\nexport class SkyTabsetFixture {\n /**\n * The tabset component's ARIA label.\n */\n public get ariaLabel(): string | undefined {\n const tabsetEl = this.#getTabsetEl();\n return tabsetEl.getAttribute('aria-label') || undefined;\n }\n\n /**\n * The tabset component's ARIA labelled by attribute.\n */\n public get ariaLabelledBy(): string | undefined {\n const tabsetEl = this.#getTabsetEl();\n return tabsetEl.getAttribute('aria-labelledby') || undefined;\n }\n\n /**\n * The index of the currently selected tab.\n */\n public get activeTabIndex(): number {\n const tabLinkEls = this.#getTabLinkEls();\n\n for (let i = 0, n = tabLinkEls.length; i < n; i++) {\n if (tabLinkEls.item(i).classList.contains('sky-btn-tab-selected')) {\n return i;\n }\n }\n\n /* safety check */\n /* istanbul ignore next */\n return -1;\n }\n\n #debugEl: DebugElement;\n #fixture: ComponentFixture<any>;\n\n constructor(fixture: ComponentFixture<any>, skyTestId: string) {\n this.#fixture = fixture;\n this.#debugEl = SkyAppTestUtility.getDebugElementByTestId(\n fixture,\n skyTestId,\n 'sky-tabset',\n );\n }\n\n /**\n * Retrieves information about the tab at the specified index.\n * @param tabIndex The index of the tab.\n */\n public getTab(tabIndex: number): SkyTabsetFixtureTab {\n const tabLinkEl = this.#getTabLinkEl(tabIndex);\n\n const active = this.activeTabIndex === tabIndex;\n const disabled = tabLinkEl.classList.contains('sky-btn-tab-disabled');\n const tabHeading = this.#getTextContent(\n tabLinkEl.querySelector('.sky-tab-heading span')?.childNodes[0],\n );\n const tabHeaderCount = this.#getTextContent(\n tabLinkEl.querySelector('.sky-tab-header-count'),\n );\n\n let permalinkValue: string | undefined;\n\n if (tabLinkEl.href) {\n const permalink = tabLinkEl.href.split('?')[1];\n if (permalink) {\n const permalinkParts = permalink.split('=');\n\n permalinkValue = decodeURIComponent(permalinkParts[1]);\n }\n }\n\n return {\n active,\n disabled,\n permalinkValue,\n tabHeaderCount,\n tabHeading,\n };\n }\n\n /**\n * Clicks the tabset's \"new\" button.\n */\n public async clickNewButton(): Promise<any> {\n return this.#clickButton('sky-tabset-btn-new');\n }\n\n /**\n * Clicks the tabset's \"open\" button.\n */\n public async clickOpenButton(): Promise<any> {\n return this.#clickButton('sky-tabset-btn-open');\n }\n\n /**\n * Clicks the tab button at the specified index.\n * @param tabIndex The index of the tab.\n */\n public async clickTab(tabIndex: number): Promise<any> {\n const tabLinkEl = this.#getTabLinkEl(tabIndex);\n\n tabLinkEl.click();\n\n this.#fixture.detectChanges();\n return this.#fixture.whenStable();\n }\n\n /**\n * Click's the tab's close button at the specified index.\n * @param tabIndex The index of the tab.\n */\n public async clickTabClose(tabIndex: number): Promise<any> {\n const tabWrapperEl = this.#getTabsetEl().querySelectorAll(\n `.sky-tabset-tabs .sky-btn-tab-wrapper`,\n )[tabIndex];\n\n const closeBtnEl = tabWrapperEl.querySelector(\n '.sky-btn-tab-close',\n ) as HTMLButtonElement;\n\n if (!closeBtnEl) {\n throw new Error('The specified tab does not have a close button.');\n }\n\n closeBtnEl.click();\n\n this.#fixture.detectChanges();\n return this.#fixture.whenStable();\n }\n\n async #clickButton(buttonCls: string): Promise<any> {\n const tabsetEl = this.#getTabsetEl();\n\n const newButtonEl = tabsetEl.querySelector(\n `.sky-tabset-btns .${buttonCls}`,\n ) as HTMLButtonElement;\n\n newButtonEl.click();\n\n this.#fixture.detectChanges();\n return this.#fixture.whenStable();\n }\n\n #getTabsetEl(): HTMLDivElement {\n const tabsetEl = this.#debugEl.query(By.css('.sky-tabset')).nativeElement;\n\n return tabsetEl;\n }\n\n #getTabLinkEls(): NodeListOf<HTMLAnchorElement> {\n return this.#getTabsetEl().querySelectorAll(\n `.sky-tabset-tabs .sky-btn-tab`,\n );\n }\n\n #getTabLinkEl(tabIndex: number): HTMLAnchorElement {\n const tabLinkEl = this.#getTabLinkEls().item(tabIndex);\n\n if (!tabLinkEl) {\n throw new Error(`There is no tab at index ${tabIndex}.`);\n }\n\n return tabLinkEl;\n }\n\n #getTextContent(el: Element | Node | undefined | null): string | undefined {\n return (el && el.textContent?.trim()) || undefined;\n }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;AAOA;;;AAGG;MACU,gBAAgB,CAAA;AAC3B;;AAEG;AACH,IAAA,IAAW,SAAS,GAAA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