@cloudscape-design/code-view 3.0.109 → 3.0.111
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/internal/environment.js
CHANGED
package/internal/manifest.json
CHANGED
package/package.json
CHANGED
|
@@ -22,6 +22,14 @@ declare module '@cloudscape-design/test-utils-core/dist/dom' {
|
|
|
22
22
|
* @returns {Array<CodeViewWrapper>}
|
|
23
23
|
*/
|
|
24
24
|
findAllCodeViews(selector?: string): Array<CodeViewWrapper>;
|
|
25
|
+
/**
|
|
26
|
+
* Returns the wrapper of the closest parent CodeView for the current element,
|
|
27
|
+
* or the element itself if it is an instance of CodeView.
|
|
28
|
+
* If no CodeView is found, returns `null`.
|
|
29
|
+
*
|
|
30
|
+
* @returns {CodeViewWrapper | null}
|
|
31
|
+
*/
|
|
32
|
+
findClosestCodeView(): CodeViewWrapper | null;
|
|
25
33
|
}
|
|
26
34
|
}
|
|
27
35
|
export default function wrapper(root?: Element): ElementWrapper<Element>;
|
package/test-utils/dom/index.js
CHANGED
|
@@ -20,6 +20,11 @@ dom_1.ElementWrapper.prototype.findCodeView = function (selector) {
|
|
|
20
20
|
dom_1.ElementWrapper.prototype.findAllCodeViews = function (selector) {
|
|
21
21
|
return this.findAllComponents(code_view_1.default, selector);
|
|
22
22
|
};
|
|
23
|
+
dom_1.ElementWrapper.prototype.findClosestCodeView = function () {
|
|
24
|
+
// casting to 'any' is needed to avoid this issue with generics
|
|
25
|
+
// https://github.com/microsoft/TypeScript/issues/29132
|
|
26
|
+
return this.findClosestComponent(code_view_1.default);
|
|
27
|
+
};
|
|
23
28
|
function wrapper(root = document.body) {
|
|
24
29
|
if (document && document.body && !document.body.contains(root)) {
|
|
25
30
|
console.warn('[AwsUi] [test-utils] provided element is not part of the document body, interactions may work incorrectly');
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/test-utils/dom/index.ts"],"names":[],"mappings":";;;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I,CAAC,QAAQ,CAAC,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,EAAE;QAC9D,OAAO,CAAC,IAAI,CAAC,2GAA2G,CAAC,CAAA;KAC1H;IAAA,CAAC;IACF,OAAO,IAAI,oBAAc,CAAC,IAAI,CAAC,CAAC;AAClC,CAAC;AALD,0BAKC","sourcesContent":["\n// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport { ElementWrapper } from '@cloudscape-design/test-utils-core/dom';\nimport { appendSelector } from '@cloudscape-design/test-utils-core/utils';\n\nexport { ElementWrapper };\n\nimport CodeViewWrapper from './code-view';\n\n\nexport { CodeViewWrapper };\n\ndeclare module '@cloudscape-design/test-utils-core/dist/dom' {\n interface ElementWrapper {\n \n/**\n * Returns the wrapper of the first CodeView that matches the specified CSS selector.\n * If no CSS selector is specified, returns the wrapper of the first CodeView.\n * If no matching CodeView is found, returns `null`.\n *\n * @param {string} [selector] CSS Selector\n * @returns {CodeViewWrapper | null}\n */\nfindCodeView(selector?: string): CodeViewWrapper | null;\n\n/**\n * Returns an array of CodeView wrapper that matches the specified CSS selector.\n * If no CSS selector is specified, returns all of the CodeViews inside the current wrapper.\n * If no matching CodeView is found, returns an empty array.\n *\n * @param {string} [selector] CSS Selector\n * @returns {Array<CodeViewWrapper>}\n */\nfindAllCodeViews(selector?: string): Array<CodeViewWrapper>;\n\n/**\n * Returns the wrapper of the closest parent CodeView for the current element,\n * or the element itself if it is an instance of CodeView.\n * If no CodeView is found, returns `null`.\n *\n * @returns {CodeViewWrapper | null}\n */\nfindClosestCodeView(): CodeViewWrapper | null;\n }\n}\n\n\nElementWrapper.prototype.findCodeView = function(selector) {\n let rootSelector = `.${CodeViewWrapper.rootSelector}`;\n if(\"legacyRootSelector\" in CodeViewWrapper && CodeViewWrapper.legacyRootSelector){\n rootSelector = `:is(.${CodeViewWrapper.rootSelector}, .${CodeViewWrapper.legacyRootSelector})`;\n }\n // casting to 'any' is needed to avoid this issue with generics\n // https://github.com/microsoft/TypeScript/issues/29132\n return (this as any).findComponent(selector ? appendSelector(selector, rootSelector) : rootSelector, CodeViewWrapper);\n};\n\nElementWrapper.prototype.findAllCodeViews = function(selector) {\n return this.findAllComponents(CodeViewWrapper, selector);\n};\n\nElementWrapper.prototype.findClosestCodeView = function() {\n // casting to 'any' is needed to avoid this issue with generics\n // https://github.com/microsoft/TypeScript/issues/29132\n return (this as any).findClosestComponent(CodeViewWrapper);\n};\n\nexport default function wrapper(root: Element = document.body) {\n if (document && document.body && !document.body.contains(root)) {\n console.warn('[AwsUi] [test-utils] provided element is not part of the document body, interactions may work incorrectly')\n };\n return new ElementWrapper(root);\n}\n"]}
|