Code Monkey home page Code Monkey logo

Comments (4)

josdejong avatar josdejong commented on July 18, 2024

The closer to hammer.js the better. Best would be if this library wouldn't be necessary at all ;).

This is an interesting case, so far I hadn't used emit and therefore didn't encounter this issue. I think this problem boils down to the internal property _firstTarget not being set in case of an event fired via emit.

I've added some code overriding hammers emit event, see ff7b6a7. Can you check whether this solves the issue?

from propagating-hammerjs.

kbullaughey avatar kbullaughey commented on July 18, 2024

Yes. That fix allowed me to remove the extra emit() in my tests.

btw, I was using emit in my tests because that's what I saw you doing in your tests. Is this the best way for me to be testing my app's use of hammerjs? I manually create an event object that is an ordinary javascript object (not an Event) and fill in the details that hammerjs uses. But this required some trial an error, and inspection of hammerjs's source code to get working. It's also probably rather brittle. It's also not easy to simulate more elaborate gestures.

Is there a better way to do this? Does hammerjs expose an interface (other than emit) that works well for simulating events during tests?

from propagating-hammerjs.

josdejong avatar josdejong commented on July 18, 2024

Ok great that it works.

I'm not sure which tests you mean, at least propagating-hammerjs doesn't have tests (sorry for that).

from propagating-hammerjs.

josdejong avatar josdejong commented on July 18, 2024

I don't know what is the preferred way to test touch events with hammer. I suppose the "right" way is to create real DOM events and fire them via real DOM event handlers attached to real DOM elements. But that's not so trivial.

from propagating-hammerjs.

Related Issues (11)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.