This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class EmailInput extends React.Component<Props, State> { | |
| state = { | |
| emailList: [], | |
| inputValue: '', | |
| } | |
| setValues = (value: string) => { | |
| let v = value; | |
| if (v.length > 1 && (v.slice(-1) === ',' || v.slice(-1) === ' ')) { | |
| let list = [...this.state.emailList, v.slice(0, -1)]; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import data from './USCities.js'; | |
| const autoCompletejs = new autoComplete({ | |
| data: { | |
| src: () => { | |
| console.log(data) | |
| return data; | |
| }, | |
| key: ["city"], | |
| cache: false |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const arr = [1,2,3,4]; | |
| let newArr = []; | |
| const fetchMock = (item) => | |
| new Promise(resolve => setTimeout(() => resolve(item), 500)); | |
| function someFunc() { | |
| [1,2,3,4].forEach(async (item) => { | |
| const result = await fetchMock(item); | |
| newArr.push(result); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| it 'creates claim with current user data prefilled' do | |
| click_link('Claim', match: :first) | |
| click_on 'Submit' | |
| expect(page).to have_current_path(listing_path(@new_listing)) | |
| .and(have_text(I18n.t('claims.create.success'))) | |
| .and(not_have_link('Claim', href: new_listing_claim_path(@new_listing))) | |
| end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| debounce.mockImplementation((cb) => () => cb()); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| onChange = async ({ target: { value } }: SyntheticEvent<HTMLInputElement>): Promise<void> => { | |
| if (value === this.props.value) return; | |
| const { executeMutation, cardId, id: fieldId } = this.props; | |
| const mutationVars = { variables: { cardId, fieldId, value } }; | |
| if(this.state.lastUpdate) this.state.lastUpdate.cancel(); | |
| const TIME_DEBOUNCE = 500; | |
| const debounced = debounce(async () => { | |
| try { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| debounce = (): Promise<void> => { | |
| const TIME = 3000; | |
| return new Promise((resolve) => { | |
| setTimeout(resolve, TIME); | |
| }) | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const renderMap = { | |
| DueDateField: component => | |
| withClickOutside(component, function(event) { | |
| return !event.target.closest('.tether-element'); | |
| }), | |
| }; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const renderMap = { | |
| DueDateField: (component) => withClickOutside(component, function(event) { | |
| return !event.target.closest('.tether-element'); | |
| }), | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import React from 'react'; | |
| import { render } from '@testing-library/react' | |
| import withClickOutsideText from '../withClickOutsideText'; | |
| describe('withClickOutisdeText', () => { | |
| it('create a wrapper component', () => { | |
| const MockInput = () => withClickOutsideText(<input />); | |
| const { getByTestId, debug } = render(MockInput); |