1AB9502 commented on a change in pull request #7638: Add new escape characters
to OnPasteSelect
URL:
https://github.com/apache/incubator-superset/pull/7638#discussion_r290952760
##########
File path: superset/assets/spec/javascripts/components/OnPasteSelect_spec.jsx
##########
@@ -74,15 +74,47 @@ describe('OnPasteSelect', () => {
});
describe('onPaste', () => {
- it('calls onChange with pasted values', () => {
+ it('calls onChange with pasted comma separated values', () => {
wrapper.instance().onPaste(evt);
expected = props.options.slice(0, 4);
expect(props.onChange.calledWith(expected)).toBe(true);
expect(evt.preventDefault.called).toBe(true);
expect(props.isValidNewOption.callCount).toBe(5);
});
- it('calls onChange without any duplicate values and adds new values', ()
=> {
+ it('calls onChange with pasted new line separated values', () => {
+ evt.clipboardData.getData = sinon.spy(() =>
+ 'United States\nChina\nRussian Federation\nIndia',
+ );
+ wrapper.instance().onPaste(evt);
+ expected = [
+ props.options[0],
+ props.options[1],
+ props.options[4],
+ props.options[2],
+ ];
+ expect(props.onChange.calledWith(expected)).toBe(true);
+ expect(evt.preventDefault.called).toBe(true);
+ expect(props.isValidNewOption.callCount).toBe(9);
+ });
+
+ it('calls onChange with pasted tab separated values', () => {
+ evt.clipboardData.getData = sinon.spy(() =>
+ 'Russian Federation\tMexico\tIndia\tCanada',
Review comment:
eagle eyes! Good catch, fixed
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]