Mocking input event for controlled inputs in react
See original GitHub issueThis 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:
- Created 4 years ago
- Reactions:1
- Comments:12
Top 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 >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
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!
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 is1.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