Skip to content
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

Bring over DOM helper implementation. #258

Merged
merged 61 commits into from Dec 15, 2017
Merged

Commits on Dec 15, 2017

  1. Copy the full SHA
    f5396fa View commit details
    Browse the repository at this point in the history
  2. Add initial implementations for click and focus.

    Original implementations are from
    https://github.com/cibernox/ember-native-dom-helpers and then modified:
    
    * Prefer default exports when reasonable
    * Remove manual run-wrapping when firing events (event listeners should
      already be run-wrapped).
    * Allow `focusin` to bubble in `focus`
    * Remove `context` arguments from helper methods.
    rwjblue committed Dec 15, 2017
    Copy the full SHA
    657e8d8 View commit details
    Browse the repository at this point in the history
  3. Bring over blur implementation.

    Original implementations are from
    https://github.com/cibernox/ember-native-dom-helpers and then modified:
    
    * Added `fireEvent(element, 'focusout')`
    * Remove run wrapping
    rwjblue committed Dec 15, 2017
    Copy the full SHA
    31e66a8 View commit details
    Browse the repository at this point in the history
  4. Add triggerEvent and triggerKeyEvent.

    Original implementations are from
    https://github.com/cibernox/ember-native-dom-helpers and then modified:
    
    * Remove run wrapping
    rwjblue committed Dec 15, 2017
    Copy the full SHA
    4b91a8c View commit details
    Browse the repository at this point in the history
  5. Copy the full SHA
    534e330 View commit details
    Browse the repository at this point in the history
  6. Copy the full SHA
    56c6026 View commit details
    Browse the repository at this point in the history
  7. Copy the full SHA
    1220ed4 View commit details
    Browse the repository at this point in the history
  8. Copy the full SHA
    59596f8 View commit details
    Browse the repository at this point in the history
  9. Ensure focus throws if invoked with unfocusable selector.

    Extract `_focus` helper method that can be used from `click` to avoid
    the assertion...
    rwjblue committed Dec 15, 2017
    Copy the full SHA
    e5f84cd View commit details
    Browse the repository at this point in the history
  10. Copy the full SHA
    51a5da8 View commit details
    Browse the repository at this point in the history
  11. Copy the full SHA
    457333e View commit details
    Browse the repository at this point in the history
  12. Copy the full SHA
    2e0cc6c View commit details
    Browse the repository at this point in the history
  13. Reorder events in focus.

    Even though
    https://w3c.github.io/uievents/#events-focusevent-event-order suggests
    that `focus` is always fired after `focusin`, after testing on Firefox,
    Chrome, and Safari (snippet below) this is not true.
    
    ```js
    let element = document.createElement('input');
    
    ['mousedown', 'mouseup', 'click', 'focus', 'focusin'].forEach(type => {
      element.addEventListener(type, () => {
        console.log('event:', type);
      });
    });
    
    document.body.appendChild(element);
    ```
    rwjblue committed Dec 15, 2017
    Copy the full SHA
    622ce97 View commit details
    Browse the repository at this point in the history
  14. Copy the full SHA
    da7d8e5 View commit details
    Browse the repository at this point in the history
  15. Copy the full SHA
    fa9f7c1 View commit details
    Browse the repository at this point in the history
  16. Ensure click is _always_ async.

    Never fire events synchronously.
    rwjblue committed Dec 15, 2017
    Copy the full SHA
    05d1f00 View commit details
    Browse the repository at this point in the history
  17. Copy the full SHA
    dbbb7a3 View commit details
    Browse the repository at this point in the history
  18. Add unit tests for focus.

    rwjblue committed Dec 15, 2017
    Copy the full SHA
    8f55c94 View commit details
    Browse the repository at this point in the history
  19. Create private nextTick utility.

    In order to ensure "time traveling" (sinon's fake timers, timecop, etc)
    we need to capture our `setTimeout` early during evaluation.
    rwjblue committed Dec 15, 2017
    Copy the full SHA
    88beb6b View commit details
    Browse the repository at this point in the history
  20. Use nextTick in waitUntil.

    rwjblue committed Dec 15, 2017
    Copy the full SHA
    043c4bc View commit details
    Browse the repository at this point in the history
  21. Copy the full SHA
    cf98536 View commit details
    Browse the repository at this point in the history
  22. Add blur unit tests.

    rwjblue committed Dec 15, 2017
    Copy the full SHA
    c919c77 View commit details
    Browse the repository at this point in the history
  23. Refactor blur

    * ensure always async
    * fire correct events (in order)
    
    To ensure correct event order, used the following snippet:
    
    ```js
    let element = document.createElement('input');
    
    ['blur', 'focusout'].forEach(type => {
      element.addEventListener(type, () => {
        console.log('event:', type);
      });
    });
    
    document.body.appendChild(element);
    ```
    rwjblue committed Dec 15, 2017
    Copy the full SHA
    58441b0 View commit details
    Browse the repository at this point in the history
  24. Copy the full SHA
    1f10141 View commit details
    Browse the repository at this point in the history
  25. Copy the full SHA
    88c88ed View commit details
    Browse the repository at this point in the history
  26. Add and utilize nextTickPromise helper method.

    Prior to this change the `nextTick` would run and _might_ not be
    properly waited on by the returned `settle()` promise (though in
    practice `nextTick` did finish first).
    
    This updates to ensure that we only return `settled()` after the actual
    events have been fired.
    rwjblue committed Dec 15, 2017
    Copy the full SHA
    e523951 View commit details
    Browse the repository at this point in the history
  27. Copy the full SHA
    b751706 View commit details
    Browse the repository at this point in the history
  28. Copy the full SHA
    d21bf56 View commit details
    Browse the repository at this point in the history
  29. Copy the full SHA
    fbd0353 View commit details
    Browse the repository at this point in the history
  30. Copy the full SHA
    6d17cc9 View commit details
    Browse the repository at this point in the history
  31. Copy the full SHA
    48ab310 View commit details
    Browse the repository at this point in the history
  32. Copy the full SHA
    2221b42 View commit details
    Browse the repository at this point in the history
  33. Initial implementation of fillIn.

    Intial implementation from
    https://github.com/cibernox/ember-native-dom-helpers, but modified in a
    few ways:
    
    * Ensure validations are ran sync
    * Ensure events are triggered async
    * Remove run loop wrapping
    * Tweak error message and validation.
    rwjblue committed Dec 15, 2017
    Copy the full SHA
    83444ea View commit details
    Browse the repository at this point in the history
  34. Mark internal helper functions as private.

    Also add extra underscores :P
    rwjblue committed Dec 15, 2017
    Copy the full SHA
    5988674 View commit details
    Browse the repository at this point in the history
  35. Copy the full SHA
    5b7da22 View commit details
    Browse the repository at this point in the history
  36. Tweak more documentation.

    * Use `target` to mean `selectorOrElement`
    * Properly indicate optional params
    * Show default values
    rwjblue committed Dec 15, 2017
    Copy the full SHA
    ca88ee2 View commit details
    Browse the repository at this point in the history
  37. Add explicit assert.expect.

    rwjblue committed Dec 15, 2017
    Copy the full SHA
    1ffe33c View commit details
    Browse the repository at this point in the history
  38. Copy the full SHA
    d91821c View commit details
    Browse the repository at this point in the history
  39. Copy the full SHA
    2f34b26 View commit details
    Browse the repository at this point in the history
  40. Refactor DOM helper tests.

    Avoid `setContext(this)` (use `setContext(localVariable)`) to make it
    much clearer what is going on.
    rwjblue committed Dec 15, 2017
    Copy the full SHA
    61222a5 View commit details
    Browse the repository at this point in the history
  41. Add tests for fillIn.

    rwjblue committed Dec 15, 2017
    Copy the full SHA
    b6073e4 View commit details
    Browse the repository at this point in the history
  42. Copy the full SHA
    ead022a View commit details
    Browse the repository at this point in the history
  43. Copy the full SHA
    62e22c7 View commit details
    Browse the repository at this point in the history
  44. Copy the full SHA
    612c815 View commit details
    Browse the repository at this point in the history
  45. Copy the full SHA
    f2b3c35 View commit details
    Browse the repository at this point in the history
  46. Add tap implementation.

    rwjblue committed Dec 15, 2017
    Copy the full SHA
    2cc394e View commit details
    Browse the repository at this point in the history
  47. Add unit tests for tap.

    rwjblue committed Dec 15, 2017
    Copy the full SHA
    f03eead View commit details
    Browse the repository at this point in the history
  48. Copy the full SHA
    5c23057 View commit details
    Browse the repository at this point in the history
  49. Copy the full SHA
    2a8b97d View commit details
    Browse the repository at this point in the history
  50. Copy the full SHA
    caf3e13 View commit details
    Browse the repository at this point in the history
  51. Copy the full SHA
    3b3d7c1 View commit details
    Browse the repository at this point in the history
  52. Add unit tests for waitFor.

    rwjblue committed Dec 15, 2017
    Copy the full SHA
    326b968 View commit details
    Browse the repository at this point in the history
  53. Remove tests requiring click only wait for subset of settledness.

    These tests previously used a sync version of click that allowed
    `settled` to be tested with _only_ waiting for some portions of
    settledness. When the tests were converted to use the new public version
    of `click` the test began failing (because `click` doesn't kick off
    until the next tick of the event loop, so `settled` resolves
    immediately).
    rwjblue committed Dec 15, 2017
    Copy the full SHA
    fdefbc9 View commit details
    Browse the repository at this point in the history
  54. Copy the full SHA
    95b34ee View commit details
    Browse the repository at this point in the history
  55. Copy the full SHA
    adb006b View commit details
    Browse the repository at this point in the history
  56. Copy the full SHA
    7ee206a View commit details
    Browse the repository at this point in the history
  57. Copy the full SHA
    7e41f7f View commit details
    Browse the repository at this point in the history
  58. Copy the full SHA
    e6f8668 View commit details
    Browse the repository at this point in the history
  59. Copy the full SHA
    0412bbf View commit details
    Browse the repository at this point in the history
  60. Copy the full SHA
    d07492b View commit details
    Browse the repository at this point in the history
  61. Validate target in waitFor.

    rwjblue committed Dec 15, 2017
    Copy the full SHA
    1848f83 View commit details
    Browse the repository at this point in the history