question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Mocking input event for controlled inputs in react

See original GitHub issue

This extension works in a way that leads to unexpected behaviour when used in a react controlled input. Currently this extension assigns the value to the dom element without dispatching/triggering an event: app/scripts/ate.js(ln.343)

textInput.value = replaceText(
  textInput.value,
  shortcut,
  autotext,
  cursorPosition
);

Here’s a fiddle illustrating the problem: JS Fiddle example

and a rudimentary fix I made to get this working: https://github.com/briantingtc/ChromeAutoTextExpander/commit/76d8ad5b8b0bc17f4f195ead5bd2f42a5b15f1a4

Let me know if we could get something like the above commit merged in or whether or if adding custom behaviour for a specific domain would be possible.

Issue Analytics

  • State:open
  • Created 4 years ago
  • Reactions:1
  • Comments:12

github_iconTop GitHub Comments

2reactions
ghbeckmancommented, Jun 25, 2019

Hey @carlinyuen, wondering if you guys can push the most recent (2.0) version to the chrome web store… I kinda rely on this for my daily activities and now with improvements in iframe support it would really help me out. thanks!

1reaction
briantingtccommented, Jan 16, 2020

Sorry to poke you again @carlinyuen as I know you’re super busy but we’ll be needing this plugin to work with one of our features. If I create a pr with specific behavior for our domain would you consider merging that in? Otherwise would it be okay if we re hosted the plugin with that specific change?

e: I just rebased to the latest version on this repo and it had the fix that I needed. The manifest was updated to be 2.0.0 but the version on the chrome extension store is 1.9.5. Does the latest version just need to be pushed up? https://chrome.google.com/webstore/detail/auto-text-expander-for-go/iibninhmiggehlcdolcilmhacighjamp?hl=en-US

Read more comments on GitHub >

github_iconTop Results From Across the Web

Form Events With Controlled Inputs | React Testing For ...
In this video we will be dealing with form event and controlled inputs. We will continue to use mocking functions and spies ...
Read more >
Input Event - Testing Library
Input Event. Note. If you want to simulate a more natural typing behaviour while testing your component, consider the companion library ...
Read more >
How are we meant to test controlled components? #549 - GitHub
userEvent applies the input character by character just as typing in your browser would. Testing your controlled component is probably more ...
Read more >
How to test Input with React Testing Library? - Stack Overflow
My goal is to write the test so that initially the input value is empty and when user types something, test can validate...
Read more >
Testing a simple component with React Testing Library
it('should enable the "Add" button when a valid input is entered', () => { render(<AddWord />); expect(screen.getByTestId('add-word-button')).
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found