@@ -56,16 +56,16 @@ declare module "@cloudscape-design/test-utils-core/dist/dom" {
5656}
5757
5858ElementWrapper.prototype.findCartesianHighcharts = function (selector) {
59- return ( this as any ) .findComponent (getComponentSelector (CartesianChartWrapper , selector ), CartesianChartWrapper );
59+ return this .findComponent (getComponentSelector (CartesianChartWrapper , selector ), CartesianChartWrapper );
6060} ;
6161ElementWrapper.prototype.findPieHighcharts = function (selector) {
62- return ( this as any ) .findComponent (getComponentSelector (PieChartWrapper , selector ), PieChartWrapper );
62+ return this .findComponent (getComponentSelector (PieChartWrapper , selector ), PieChartWrapper );
6363} ;
6464ElementWrapper.prototype.findAllCartesianHighcharts = function (selector) {
65- return ( this as any ) .findAllComponents (CartesianChartWrapper , selector );
65+ return this .findAllComponents (CartesianChartWrapper , selector );
6666} ;
6767ElementWrapper.prototype.findAllPieHighcharts = function (selector) {
68- return ( this as any ) .findAllComponents (PieChartWrapper , selector );
68+ return this .findAllComponents (PieChartWrapper , selector );
6969} ;
7070
7171function getComponentSelector(wrapper: { rootSelector : string } , selector?: string) {
@@ -100,45 +100,55 @@ export { CartesianChartWrapper, PieChartWrapper };
100100declare module "@cloudscape-design/test-utils-core/dist/selectors" {
101101 interface ElementWrapper {
102102 /**
103- * Returns a wrapper that matches charts of the given type with the specified CSS selector.
104- * If no CSS selector is specified, returns a wrapper that matches charts.
103+ * Returns the wrapper of the first cartesian chart that matches the specified CSS selector.
104+ * If no CSS selector is specified, returns the wrapper of the first cartesian chart.
105+ * If no matching chart is found, returns \`null\`.
105106 *
106- * @param {"cartesian" | "pie"} [type] Chart type
107107 * @param {string} [selector] CSS Selector
108- * @returns {CartesianChartWrapper | PieChartWrapper }
108+ * @returns {CartesianChartWrapper | null }
109109 */
110- findChart(type : " cartesian" , selector ? : string ): CartesianChartWrapper | null ;
111- findChart(type : " pie" , selector ? : string ): PieChartWrapper | null ;
112-
110+ findCartesianHighcharts(selector ? : string ): CartesianChartWrapper ;
111+ /**
112+ * Returns the wrapper of the first pie chart that matches the specified CSS selector.
113+ * If no CSS selector is specified, returns the wrapper of the first pie chart.
114+ * If no matching chart is found, returns \`null\`.
115+ *
116+ * @param {string} [selector] CSS Selector
117+ * @returns {PieChartWrapper | null}
118+ */
119+ findPieHighcharts(selector ? : string ): PieChartWrapper ;
120+ /**
121+ * Returns an array of cartesian chart wrappers that matches the specified CSS selector.
122+ * If no CSS selector is specified, returns all cartesian charts inside the current wrapper.
123+ * If no matching chart is found, returns an empty array.
124+ *
125+ * @param {string} [selector] CSS Selector
126+ * @returns {CartesianChartWrapper[]}
127+ */
128+ findAllCartesianHighcharts(selector ? : string ): MultiElementWrapper <CartesianChartWrapper >;
113129 /**
114- * Returns a multi-element wrapper that matches charts of the given type with the specified CSS selector.
115- * If no CSS selector is specified, returns a multi-element wrapper that matches charts.
130+ * Returns an array of pie chart wrappers that matches the specified CSS selector.
131+ * If no CSS selector is specified, returns all pie charts inside the current wrapper.
132+ * If no matching chart is found, returns an empty array.
116133 *
117- * @param {"cartesian" | "pie"} [type] Chart type
118134 * @param {string} [selector] CSS Selector
119- * @returns {MultiElementWrapper<CartesianChartWrapper> | MultiElementWrapper< PieChartWrapper> }
135+ * @returns {PieChartWrapper[] }
120136 */
121- findAllCharts(type : " cartesian" , selector ? : string ): Array <CartesianChartWrapper >;
122- findAllCharts(type : " pie" , selector ? : string ): Array <PieChartWrapper >;
137+ findAllPieHighcharts(selector ? : string ): MultiElementWrapper <PieChartWrapper >;
123138 }
124139}
125140
126- ElementWrapper.prototype.findChart = function (type, selector) {
127- switch (type ) {
128- case " cartesian" :
129- return (this as any ).findComponent (getComponentSelector (CartesianChartWrapper , selector ), CartesianChartWrapper );
130- case " pie" :
131- return (this as any ).findComponent (getComponentSelector (PieChartWrapper , selector ), PieChartWrapper );
132- }
141+ ElementWrapper.prototype.findCartesianHighcharts = function (selector) {
142+ return this .findComponent (getComponentSelector (CartesianChartWrapper , selector ), CartesianChartWrapper );
133143} ;
134-
135- ElementWrapper.prototype.findAllCharts = function (type , selector) {
136- switch ( type ) {
137- case " cartesian " :
138- return ( this as any ) .findAllComponents (CartesianChartWrapper , selector );
139- case " pie " :
140- return ( this as any ). findAllComponents ( PieChartWrapper , selector );
141- }
144+ ElementWrapper.prototype.findPieHighcharts = function (selector) {
145+ return this . findComponent ( getComponentSelector ( PieChartWrapper , selector ), PieChartWrapper );
146+ } ;
147+ ElementWrapper.prototype.findAllCartesianHighcharts = function (selector) {
148+ return this .findAllComponents (CartesianChartWrapper , selector );
149+ } ;
150+ ElementWrapper.prototype.findAllPieHighcharts = function ( selector) {
151+ return this . findAllComponents ( PieChartWrapper , selector );
142152} ;
143153
144154function getComponentSelector(wrapper: { rootSelector : string } , selector?: string) {
0 commit comments