-
Notifications
You must be signed in to change notification settings - Fork 23
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Track attach file #53
Comments
I'm thinking catching the document.addEventListener('input', (event) => {
const el = event.currentTarget
if (el.tagName.toLowerCase() === 'input' && el.type === 'file) {
// do something
}
}) |
Thanks for the idea @pascallaliberte! I have something working for this: document.addEventListener('input', function(event){
var element = event.target
var tagName = element.tagName
var action = ""
var target = ""
var options = ""
if (tagName === 'INPUT' && element.type === 'file') {
var fileName = element.files[0].name;
target = element.id
if (!target) return;
action = `attach_file '${target}', Rails.root.join('spec/fixtures/${fileName}')`
}
var testingOutput = JSON.parse(sessionStorage.getItem("testingOutput"));
testingOutput.push({action: action, target: target, options: options });
sessionStorage.setItem("testingOutput", JSON.stringify(testingOutput));
}); and I tried and seems to be working well: Considerations:
Thoughts? |
A lot of time has passed since you asked this question. Sorry for the delay. Where are you at right now with this? |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Is there a way to track an attach file action?
If no we can start the discussion on how to do that
The text was updated successfully, but these errors were encountered: