BrandanBurgess commented on code in PR #36275: URL: https://github.com/apache/superset/pull/36275#discussion_r2570068397
########## superset-frontend/plugins/plugin-chart-word-cloud/test/RotationControl.test.tsx: ########## @@ -0,0 +1,47 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import { RotationControl } from '../src/plugin/controls'; +import { render, screen } from 'spec/helpers/testing-library'; + +const setup = (props = {}) => { + const defaultProps = { + name: 'rotation', + value: 'square', + onChange: jest.fn(), + }; + return render(<RotationControl {...defaultProps} {...props} />); +}; + +test('renders rotation control with label', () => { + setup(); + expect(screen.getByText('Word Rotation')).toBeInTheDocument(); +}); + +test('renders select with default value', () => { + setup({ value: 'flat' }); + // Check that the select is rendered (implementation depends on Select component) + expect(screen.getByTestId('rotation')).toBeInTheDocument(); +}); + +test('calls onChange when value changes', () => { + const onChange = jest.fn(); + setup({ onChange }); + // Test onChange is called when select value changes +}); Review Comment: Test implementation was complete in the following commit [refactor(word-cloud): address review feedback and add control tests](https://github.com/apache/superset/pull/36275/commits/089244a2cefcdfa87a427ea704a41db2838d7aea) [089244a](https://github.com/apache/superset/pull/36275/commits/089244a2cefcdfa87a427ea704a41db2838d7aea) -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
