@leaflink/dom-testing-utils 0.0.0-PR-75--e15fe6e → 0.0.0-PR-75--4b183d9
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/README.md +4 -4
- package/dist/index.d.ts +2 -2
- package/dist/index.js +2 -2
- package/dist/index.js.map +1 -1
- package/dist/utils/__tests__/{getBySelectedItem.spec.js → getBySelectedOption.spec.js} +3 -5
- package/dist/utils/__tests__/getBySelectedOption.spec.js.map +1 -0
- package/dist/utils/__tests__/{getBySelectedItems.spec.js → getBySelectedOptions.spec.js} +6 -5
- package/dist/utils/__tests__/getBySelectedOptions.spec.js.map +1 -0
- package/dist/utils/getBySelectedOption.d.ts +15 -0
- package/dist/utils/getBySelectedOption.js +25 -0
- package/dist/utils/getBySelectedOption.js.map +1 -0
- package/dist/utils/{getBySelectedItems.d.ts → getBySelectedOptions.d.ts} +6 -13
- package/dist/utils/{getBySelectedItems.js → getBySelectedOptions.js} +10 -7
- package/dist/utils/getBySelectedOptions.js.map +1 -0
- package/package.json +1 -1
- package/dist/utils/__tests__/getBySelectedItem.spec.js.map +0 -1
- package/dist/utils/__tests__/getBySelectedItems.spec.js.map +0 -1
- package/dist/utils/getBySelectedItem.d.ts +0 -17
- package/dist/utils/getBySelectedItem.js +0 -20
- package/dist/utils/getBySelectedItem.js.map +0 -1
- package/dist/utils/getBySelectedItems.js.map +0 -1
- /package/dist/utils/__tests__/{getBySelectedItem.spec.d.ts → getBySelectedOption.spec.d.ts} +0 -0
- /package/dist/utils/__tests__/{getBySelectedItems.spec.d.ts → getBySelectedOptions.spec.d.ts} +0 -0
package/README.md
CHANGED
|
@@ -22,8 +22,8 @@
|
|
|
22
22
|
- [`assertAndDismissNoty`](#assertanddismissnoty)
|
|
23
23
|
- [`getByDescriptionTerm`](#getbydescriptionterm)
|
|
24
24
|
- [`getAllByDescriptionTerm`](#getallbydescriptionterm)
|
|
25
|
-
- [`
|
|
26
|
-
- [`
|
|
25
|
+
- [`getBySelectedOption`](#getbyselectedoption)
|
|
26
|
+
- [`getBySelectedOptions`](#getbyselectedoptions)
|
|
27
27
|
- [`createFixtureGenerator`](#createfixturegenerator)
|
|
28
28
|
- [Mocking API Endpoints](#mocking-api-endpoints)
|
|
29
29
|
|
|
@@ -153,7 +153,7 @@ Queries and returns an array of HTML elements with the role "definition" (DD) th
|
|
|
153
153
|
**Returns**: `HTMLElement[]` - An array of HTML description detail elements that match the given text.
|
|
154
154
|
|
|
155
155
|
|
|
156
|
-
### `
|
|
156
|
+
### `getBySelectedOption`
|
|
157
157
|
|
|
158
158
|
Finds the first selected HTML element with the role "definition" (LI) "listitem" inside the specified select element.
|
|
159
159
|
|
|
@@ -166,7 +166,7 @@ Finds the first selected HTML element with the role "definition" (LI) "listitem"
|
|
|
166
166
|
**Returns**: `HTMLElement | undefined` - The first selected HTML listitem element or undefined if no match is found.
|
|
167
167
|
|
|
168
168
|
|
|
169
|
-
### `
|
|
169
|
+
### `getBySelectedOptions`
|
|
170
170
|
|
|
171
171
|
Finds all the selected HTML elements with the role "definition" (LI) "listitem" inside the specified select element.
|
|
172
172
|
|
package/dist/index.d.ts
CHANGED
|
@@ -6,8 +6,8 @@ export { default as cleanupToasts } from './utils/cleanupToasts.js';
|
|
|
6
6
|
export { default as createFixtureGenerator } from './utils/createFixtureGenerator.js';
|
|
7
7
|
export { default as getAllByDescriptionTerm } from './utils/getAllByDescriptionTerm.js';
|
|
8
8
|
export { default as getByDescriptionTerm } from './utils/getByDescriptionTerm.js';
|
|
9
|
-
export { default as
|
|
10
|
-
export { default as
|
|
9
|
+
export { default as getBySelectedOption } from './utils/getBySelectedOption.js';
|
|
10
|
+
export { default as getBySelectedOptions } from './utils/getBySelectedOptions.js';
|
|
11
11
|
export { default as hasText } from './utils/hasText.js';
|
|
12
12
|
export { default as isHTMLElement } from './utils/isHTMLElement.js';
|
|
13
13
|
export { default as createMockApiUtils, RestMethod } from './utils/mockEndpoints.js';
|
package/dist/index.js
CHANGED
|
@@ -6,8 +6,8 @@ export { default as cleanupToasts } from './utils/cleanupToasts.js';
|
|
|
6
6
|
export { default as createFixtureGenerator } from './utils/createFixtureGenerator.js';
|
|
7
7
|
export { default as getAllByDescriptionTerm } from './utils/getAllByDescriptionTerm.js';
|
|
8
8
|
export { default as getByDescriptionTerm } from './utils/getByDescriptionTerm.js';
|
|
9
|
-
export { default as
|
|
10
|
-
export { default as
|
|
9
|
+
export { default as getBySelectedOption } from './utils/getBySelectedOption.js';
|
|
10
|
+
export { default as getBySelectedOptions } from './utils/getBySelectedOptions.js';
|
|
11
11
|
export { default as hasText } from './utils/hasText.js';
|
|
12
12
|
export { default as isHTMLElement } from './utils/isHTMLElement.js';
|
|
13
13
|
export { default as createMockApiUtils } from './utils/mockEndpoints.js';
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"src/","sources":["index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,oBAAoB,EAAE,MAAM,iCAAiC,CAAC;AAClF,OAAO,EAAE,OAAO,IAAI,gBAAgB,EAAE,MAAM,6BAA6B,CAAC;AAC1E,OAAO,EAAE,OAAO,IAAI,aAAa,EAAE,MAAM,0BAA0B,CAAC;AACpE,OAAO,EAAE,OAAO,IAAI,WAAW,EAAE,MAAM,wBAAwB,CAAC;AAChE,OAAO,EAAE,OAAO,IAAI,aAAa,EAAE,MAAM,0BAA0B,CAAC;AACpE,OAAO,EAAE,OAAO,IAAI,sBAAsB,EAAE,MAAM,mCAAmC,CAAC;AACtF,OAAO,EAAE,OAAO,IAAI,uBAAuB,EAAE,MAAM,oCAAoC,CAAC;AACxF,OAAO,EAAE,OAAO,IAAI,oBAAoB,EAAE,MAAM,iCAAiC,CAAC;AAClF,OAAO,EAAE,OAAO,IAAI,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"src/","sources":["index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,oBAAoB,EAAE,MAAM,iCAAiC,CAAC;AAClF,OAAO,EAAE,OAAO,IAAI,gBAAgB,EAAE,MAAM,6BAA6B,CAAC;AAC1E,OAAO,EAAE,OAAO,IAAI,aAAa,EAAE,MAAM,0BAA0B,CAAC;AACpE,OAAO,EAAE,OAAO,IAAI,WAAW,EAAE,MAAM,wBAAwB,CAAC;AAChE,OAAO,EAAE,OAAO,IAAI,aAAa,EAAE,MAAM,0BAA0B,CAAC;AACpE,OAAO,EAAE,OAAO,IAAI,sBAAsB,EAAE,MAAM,mCAAmC,CAAC;AACtF,OAAO,EAAE,OAAO,IAAI,uBAAuB,EAAE,MAAM,oCAAoC,CAAC;AACxF,OAAO,EAAE,OAAO,IAAI,oBAAoB,EAAE,MAAM,iCAAiC,CAAC;AAClF,OAAO,EAAE,OAAO,IAAI,mBAAmB,EAAE,MAAM,gCAAgC,CAAC;AAChF,OAAO,EAAE,OAAO,IAAI,oBAAoB,EAAE,MAAM,iCAAiC,CAAC;AAClF,OAAO,EAAE,OAAO,IAAI,OAAO,EAAE,MAAM,oBAAoB,CAAC;AACxD,OAAO,EAAE,OAAO,IAAI,aAAa,EAAE,MAAM,0BAA0B,CAAC;AACpE,OAAO,EAAE,OAAO,IAAI,kBAAkB,EAAc,MAAM,0BAA0B,CAAC;AACrF,OAAO,EAAE,OAAO,IAAI,aAAa,EAAE,MAAM,0BAA0B,CAAC;AACpE,OAAO,EAAE,OAAO,IAAI,cAAc,EAAE,MAAM,2BAA2B,CAAC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { render, screen } from '@testing-library/vue';
|
|
2
|
-
import
|
|
2
|
+
import getBySelectedOption from '../getBySelectedOption';
|
|
3
3
|
// This content was extracted from https://stash.leaflink.com/?path=/story/components-select--single
|
|
4
4
|
const template = `<div class="input ll-select" data-test="ll-select">
|
|
5
5
|
<label class="stash-label tw-block tw-truncate tw-text-ice-900 tw-font-medium tw-text-sm tw-leading-6" for="field-92" id="field-label-91">
|
|
@@ -74,8 +74,6 @@ const template = `<div class="input ll-select" data-test="ll-select">
|
|
|
74
74
|
</div>`;
|
|
75
75
|
it('should return only the selected item', () => {
|
|
76
76
|
render({ template });
|
|
77
|
-
expect(
|
|
78
|
-
element: screen.getByTestId('ll-select'),
|
|
79
|
-
})).toHaveTextContent('First');
|
|
77
|
+
expect(getBySelectedOption(screen.getByTestId('ll-select'))).toHaveTextContent('First');
|
|
80
78
|
});
|
|
81
|
-
//# sourceMappingURL=
|
|
79
|
+
//# sourceMappingURL=getBySelectedOption.spec.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getBySelectedOption.spec.js","sourceRoot":"src/","sources":["utils/__tests__/getBySelectedOption.spec.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC;AAEtD,OAAO,mBAAmB,MAAM,wBAAwB,CAAC;AAEzD,oGAAoG;AACpG,MAAM,QAAQ,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAsEV,CAAC;AAER,EAAE,CAAC,sCAAsC,EAAE,GAAG,EAAE;IAC9C,MAAM,CAAC,EAAE,QAAQ,EAAE,CAAC,CAAC;IAErB,MAAM,CAAC,mBAAmB,CAAC,MAAM,CAAC,WAAW,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,iBAAiB,CAAC,OAAO,CAAC,CAAC;AAC1F,CAAC,CAAC,CAAC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { render, screen } from '@testing-library/vue';
|
|
2
|
-
import
|
|
2
|
+
import getBySelectedOptions from '../getBySelectedOptions';
|
|
3
3
|
// This content was extracted from https://stash.leaflink.com/?path=/story/components-select--multiple
|
|
4
4
|
const template = `<div class="input ll-select _has-hint_9vzwe_6" data-test="ll-select">
|
|
5
5
|
<label class="stash-label tw-block tw-truncate tw-text-ice-900 tw-font-medium tw-text-sm tw-leading-6" for="field-101" id="field-label-100">
|
|
@@ -99,8 +99,9 @@ const template = `<div class="input ll-select _has-hint_9vzwe_6" data-test="ll-s
|
|
|
99
99
|
</div>`;
|
|
100
100
|
it('should return only the selected items', () => {
|
|
101
101
|
render({ template });
|
|
102
|
-
expect(
|
|
103
|
-
|
|
104
|
-
|
|
102
|
+
expect(getBySelectedOptions(screen.getByTestId('ll-select')).map((el) => el.textContent?.trim())).toEqual([
|
|
103
|
+
'First',
|
|
104
|
+
'Second',
|
|
105
|
+
]);
|
|
105
106
|
});
|
|
106
|
-
//# sourceMappingURL=
|
|
107
|
+
//# sourceMappingURL=getBySelectedOptions.spec.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getBySelectedOptions.spec.js","sourceRoot":"src/","sources":["utils/__tests__/getBySelectedOptions.spec.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC;AAEtD,OAAO,oBAAoB,MAAM,yBAAyB,CAAC;AAE3D,sGAAsG;AACtG,MAAM,QAAQ,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OA+FV,CAAC;AAER,EAAE,CAAC,uCAAuC,EAAE,GAAG,EAAE;IAC/C,MAAM,CAAC,EAAE,QAAQ,EAAE,CAAC,CAAC;IAErB,MAAM,CAAC,oBAAoB,CAAC,MAAM,CAAC,WAAW,CAAC,WAAW,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,EAAE,CAAC,WAAW,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,OAAO,CAAC;QACxG,OAAO;QACP,QAAQ;KACT,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { type GetBySelectedOptionArgs } from './getBySelectedOptions.js';
|
|
2
|
+
/**
|
|
3
|
+
* Queries and returns the selected option inside of `select` HTML element with
|
|
4
|
+
* the role "definition" (LI) "listitem"
|
|
5
|
+
*
|
|
6
|
+
* E.G:
|
|
7
|
+
*```
|
|
8
|
+
* expect(
|
|
9
|
+
* getBySelectedOption(screen.getByTestId('ll-select')),
|
|
10
|
+
* ).toHaveTextContent('First');
|
|
11
|
+
*```
|
|
12
|
+
* @param element - The Stash `select` HTML element wrapper to be used for search purposes
|
|
13
|
+
* @returns A single selected `listitem` HTML element.
|
|
14
|
+
*/
|
|
15
|
+
export default function getBySelectedOption(element: HTMLSelectElement, { selectedClass, ...options }?: GetBySelectedOptionArgs): HTMLElement;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { queryHelpers } from '@testing-library/dom';
|
|
2
|
+
import getBySelectedOptions from './getBySelectedOptions.js';
|
|
3
|
+
/**
|
|
4
|
+
* Queries and returns the selected option inside of `select` HTML element with
|
|
5
|
+
* the role "definition" (LI) "listitem"
|
|
6
|
+
*
|
|
7
|
+
* E.G:
|
|
8
|
+
*```
|
|
9
|
+
* expect(
|
|
10
|
+
* getBySelectedOption(screen.getByTestId('ll-select')),
|
|
11
|
+
* ).toHaveTextContent('First');
|
|
12
|
+
*```
|
|
13
|
+
* @param element - The Stash `select` HTML element wrapper to be used for search purposes
|
|
14
|
+
* @returns A single selected `listitem` HTML element.
|
|
15
|
+
*/
|
|
16
|
+
export default function getBySelectedOption(element, { selectedClass = 'is-selected', ...options } = {}) {
|
|
17
|
+
const selectedOption = getBySelectedOptions(element, { selectedClass, ...options });
|
|
18
|
+
if (selectedOption.length > 1) {
|
|
19
|
+
throw queryHelpers.getElementError(`Found multiple options with the ".${selectedClass}" className: \n${selectedOption
|
|
20
|
+
.map((option, index) => `- Element with text "${option.textContent}" at index "${index}"`)
|
|
21
|
+
.join(`\n`)}`, element);
|
|
22
|
+
}
|
|
23
|
+
return selectedOption[0];
|
|
24
|
+
}
|
|
25
|
+
//# sourceMappingURL=getBySelectedOption.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getBySelectedOption.js","sourceRoot":"src/","sources":["utils/getBySelectedOption.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AAEpD,OAAO,oBAAsD,MAAM,2BAA2B,CAAC;AAC/F;;;;;;;;;;;;GAYG;AACH,MAAM,CAAC,OAAO,UAAU,mBAAmB,CACzC,OAA0B,EAC1B,EAAE,aAAa,GAAG,aAAa,EAAE,GAAG,OAAO,KAA8B,EAAE;IAE3E,MAAM,cAAc,GAAG,oBAAoB,CAAC,OAAO,EAAE,EAAE,aAAa,EAAE,GAAG,OAAO,EAAE,CAAC,CAAC;IAEpF,IAAI,cAAc,CAAC,MAAM,GAAG,CAAC,EAAE;QAC7B,MAAM,YAAY,CAAC,eAAe,CAChC,qCAAqC,aAAa,kBAAkB,cAAc;aAC/E,GAAG,CAAC,CAAC,MAAM,EAAE,KAAK,EAAE,EAAE,CAAC,wBAAwB,MAAM,CAAC,WAAW,eAAe,KAAK,GAAG,CAAC;aACzF,IAAI,CAAC,IAAI,CAAC,EAAE,EACf,OAAO,CACR,CAAC;KACH;IAED,OAAO,cAAc,CAAC,CAAC,CAAC,CAAC;AAC3B,CAAC"}
|
|
@@ -1,18 +1,13 @@
|
|
|
1
1
|
import { type ByRoleOptions } from '@testing-library/vue';
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
element: HTMLSelectElement;
|
|
2
|
+
/**
|
|
3
|
+
* `getAllByRole()` options values using `ByRoleOptions` type
|
|
4
|
+
*/
|
|
5
|
+
export interface GetBySelectedOptionArgs extends ByRoleOptions {
|
|
7
6
|
/**
|
|
8
7
|
* Selected class
|
|
9
8
|
* By default it's using Stash Select class `is-selected`
|
|
10
9
|
*/
|
|
11
10
|
selectedClass?: string;
|
|
12
|
-
/**
|
|
13
|
-
* `getAllByRole()` options values using `ByRoleOptions` type
|
|
14
|
-
*/
|
|
15
|
-
options?: ByRoleOptions;
|
|
16
11
|
}
|
|
17
12
|
/**
|
|
18
13
|
* Queries and returns the selected options inside of `select` HTML element with
|
|
@@ -22,13 +17,11 @@ export interface GetBySelectedItemArgs {
|
|
|
22
17
|
*```
|
|
23
18
|
*
|
|
24
19
|
* expect(
|
|
25
|
-
*
|
|
26
|
-
* element: screen.getByTestId('ll-select'),
|
|
27
|
-
* }).map((el) => el.textContent?.trim()),
|
|
20
|
+
* getBySelectedOptions(screen.getByTestId('ll-select'))
|
|
28
21
|
* ).toEqual(['First', 'Second'])
|
|
29
22
|
*```
|
|
30
23
|
* @param selectElement - The `select` HTML element to be used for search purposes.
|
|
31
24
|
* @param selectedClass - The `select` HTML element to be used for search purposes.
|
|
32
25
|
* @returns A list of selected `listitem` HTML elements.
|
|
33
26
|
*/
|
|
34
|
-
export default function
|
|
27
|
+
export default function getBySelectedOptions(element: HTMLSelectElement, { selectedClass, ...opts }?: GetBySelectedOptionArgs): HTMLElement[];
|
|
@@ -7,21 +7,24 @@ import { within } from '@testing-library/vue';
|
|
|
7
7
|
*```
|
|
8
8
|
*
|
|
9
9
|
* expect(
|
|
10
|
-
*
|
|
11
|
-
* element: screen.getByTestId('ll-select'),
|
|
12
|
-
* }).map((el) => el.textContent?.trim()),
|
|
10
|
+
* getBySelectedOptions(screen.getByTestId('ll-select'))
|
|
13
11
|
* ).toEqual(['First', 'Second'])
|
|
14
12
|
*```
|
|
15
13
|
* @param selectElement - The `select` HTML element to be used for search purposes.
|
|
16
14
|
* @param selectedClass - The `select` HTML element to be used for search purposes.
|
|
17
15
|
* @returns A list of selected `listitem` HTML elements.
|
|
18
16
|
*/
|
|
19
|
-
export default function
|
|
17
|
+
export default function getBySelectedOptions(element, { selectedClass = 'is-selected', ...opts } = {}) {
|
|
20
18
|
return within(element)
|
|
21
19
|
.getAllByRole('listitem', {
|
|
22
20
|
hidden: true,
|
|
23
|
-
...
|
|
21
|
+
...opts,
|
|
24
22
|
})
|
|
25
|
-
.filter((term) => term.tagName === 'LI' && term.classList.contains(selectedClass))
|
|
23
|
+
.filter((term) => term.tagName === 'LI' && term.classList.contains(selectedClass))
|
|
24
|
+
.map((element) => {
|
|
25
|
+
// Removing spaces before and after the text content inside the visible option
|
|
26
|
+
element.textContent = (element.textContent || '').trim();
|
|
27
|
+
return element;
|
|
28
|
+
});
|
|
26
29
|
}
|
|
27
|
-
//# sourceMappingURL=
|
|
30
|
+
//# sourceMappingURL=getBySelectedOptions.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getBySelectedOptions.js","sourceRoot":"src/","sources":["utils/getBySelectedOptions.ts"],"names":[],"mappings":"AAAA,OAAO,EAAsB,MAAM,EAAE,MAAM,sBAAsB,CAAC;AAalE;;;;;;;;;;;;;;GAcG;AACH,MAAM,CAAC,OAAO,UAAU,oBAAoB,CAC1C,OAA0B,EAC1B,EAAE,aAAa,GAAG,aAAa,EAAE,GAAG,IAAI,KAA8B,EAAE;IAExE,OAAO,MAAM,CAAC,OAAO,CAAC;SACnB,YAAY,CAAC,UAAU,EAAE;QACxB,MAAM,EAAE,IAAI;QACZ,GAAG,IAAI;KACR,CAAC;SACD,MAAM,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,OAAO,KAAK,IAAI,IAAI,IAAI,CAAC,SAAS,CAAC,QAAQ,CAAC,aAAa,CAAC,CAAC;SACjF,GAAG,CAAC,CAAC,OAAO,EAAE,EAAE;QACf,8EAA8E;QAC9E,OAAO,CAAC,WAAW,GAAG,CAAC,OAAO,CAAC,WAAW,IAAI,EAAE,CAAC,CAAC,IAAI,EAAE,CAAC;QAEzD,OAAO,OAAO,CAAC;IACjB,CAAC,CAAC,CAAC;AACP,CAAC"}
|
package/package.json
CHANGED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"getBySelectedItem.spec.js","sourceRoot":"src/","sources":["utils/__tests__/getBySelectedItem.spec.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC;AAEtD,OAAO,iBAAiB,MAAM,sBAAsB,CAAC;AAErD,oGAAoG;AACpG,MAAM,QAAQ,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAsEV,CAAC;AAER,EAAE,CAAC,sCAAsC,EAAE,GAAG,EAAE;IAC9C,MAAM,CAAC,EAAE,QAAQ,EAAE,CAAC,CAAC;IAErB,MAAM,CACJ,iBAAiB,CAAC;QAChB,OAAO,EAAE,MAAM,CAAC,WAAW,CAAC,WAAW,CAAC;KACzC,CAAC,CACH,CAAC,iBAAiB,CAAC,OAAO,CAAC,CAAC;AAC/B,CAAC,CAAC,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"getBySelectedItems.spec.js","sourceRoot":"src/","sources":["utils/__tests__/getBySelectedItems.spec.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC;AAEtD,OAAO,kBAAkB,MAAM,uBAAuB,CAAC;AAEvD,sGAAsG;AACtG,MAAM,QAAQ,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OA+FV,CAAC;AAER,EAAE,CAAC,uCAAuC,EAAE,GAAG,EAAE;IAC/C,MAAM,CAAC,EAAE,QAAQ,EAAE,CAAC,CAAC;IAErB,MAAM,CACJ,kBAAkB,CAAC;QACjB,OAAO,EAAE,MAAM,CAAC,WAAW,CAAC,WAAW,CAAC;KACzC,CAAC,CAAC,GAAG,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,EAAE,CAAC,WAAW,EAAE,IAAI,EAAE,CAAC,CACvC,CAAC,OAAO,CAAC,CAAC,OAAO,EAAE,QAAQ,CAAC,CAAC,CAAC;AACjC,CAAC,CAAC,CAAC"}
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { type GetBySelectedItemArgs } from './getBySelectedItems.js';
|
|
2
|
-
/**
|
|
3
|
-
* Queries and returns the selected option inside of `select` HTML element with
|
|
4
|
-
* the role "definition" (LI) "listitem"
|
|
5
|
-
*
|
|
6
|
-
* E.G:
|
|
7
|
-
*```
|
|
8
|
-
* expect(
|
|
9
|
-
* getBySelectedItem({
|
|
10
|
-
* element: screen.getByTestId('ll-select'),
|
|
11
|
-
* }),
|
|
12
|
-
* ).toHaveTextContent('First');
|
|
13
|
-
*```
|
|
14
|
-
* @param selectElement - The `select` HTML element to be used for search purposes.
|
|
15
|
-
* @returns A single selected `listitem` HTML element.
|
|
16
|
-
*/
|
|
17
|
-
export default function getBySelectedItem({ element, selectedClass, options }: GetBySelectedItemArgs): HTMLElement;
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import getBySelectedItems from './getBySelectedItems.js';
|
|
2
|
-
/**
|
|
3
|
-
* Queries and returns the selected option inside of `select` HTML element with
|
|
4
|
-
* the role "definition" (LI) "listitem"
|
|
5
|
-
*
|
|
6
|
-
* E.G:
|
|
7
|
-
*```
|
|
8
|
-
* expect(
|
|
9
|
-
* getBySelectedItem({
|
|
10
|
-
* element: screen.getByTestId('ll-select'),
|
|
11
|
-
* }),
|
|
12
|
-
* ).toHaveTextContent('First');
|
|
13
|
-
*```
|
|
14
|
-
* @param selectElement - The `select` HTML element to be used for search purposes.
|
|
15
|
-
* @returns A single selected `listitem` HTML element.
|
|
16
|
-
*/
|
|
17
|
-
export default function getBySelectedItem({ element, selectedClass = 'is-selected', options }) {
|
|
18
|
-
return getBySelectedItems({ element, selectedClass, options })[0];
|
|
19
|
-
}
|
|
20
|
-
//# sourceMappingURL=getBySelectedItem.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"getBySelectedItem.js","sourceRoot":"src/","sources":["utils/getBySelectedItem.ts"],"names":[],"mappings":"AAAA,OAAO,kBAAkD,MAAM,yBAAyB,CAAC;AACzF;;;;;;;;;;;;;;GAcG;AACH,MAAM,CAAC,OAAO,UAAU,iBAAiB,CAAC,EAAE,OAAO,EAAE,aAAa,GAAG,aAAa,EAAE,OAAO,EAAyB;IAClH,OAAO,kBAAkB,CAAC,EAAE,OAAO,EAAE,aAAa,EAAE,OAAO,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC;AACpE,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"getBySelectedItems.js","sourceRoot":"src/","sources":["utils/getBySelectedItems.ts"],"names":[],"mappings":"AAAA,OAAO,EAAsB,MAAM,EAAE,MAAM,sBAAsB,CAAC;AAoBlE;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,CAAC,OAAO,UAAU,kBAAkB,CAAC,EAAE,OAAO,EAAE,aAAa,GAAG,aAAa,EAAE,OAAO,EAAyB;IACnH,OAAO,MAAM,CAAC,OAAO,CAAC;SACnB,YAAY,CAAC,UAAU,EAAE;QACxB,MAAM,EAAE,IAAI;QACZ,GAAG,OAAO;KACX,CAAC;SACD,MAAM,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,OAAO,KAAK,IAAI,IAAI,IAAI,CAAC,SAAS,CAAC,QAAQ,CAAC,aAAa,CAAC,CAAC,CAAC;AACvF,CAAC"}
|
|
File without changes
|
/package/dist/utils/__tests__/{getBySelectedItems.spec.d.ts → getBySelectedOptions.spec.d.ts}
RENAMED
|
File without changes
|