Re: [touch-events] Need tests for ontouch*, the GlobalEventHandlers (#44)

I don't think there's anything in the web-platform-test repo that specifically looks at or uses the `ontouch*` attributes.  I'd suggest the following:
- make a small update to single-touch-manual.html to try using a couple of these attributes
  - note that we intentionally minimize the number of manual test cases (to make running the tests as easy as possible), so don't add a new test case, just piggy back on the existing one.
  - rather than always use on_event (which is just a silly wrapper around addEventListener AFAICT), you want to write code like `target0.ontouchmove = function onTouchMove(ev) {...` and `window.ontouchend = ...`.  It's probably OK to just convert a couple of the on_event tests to this pattern (so we have a mix of listening styles, covering a few different use cases.
- then for exhaustive completeness create a new automated test which just verifies the existence and exact details of the APIs.  Eg:
  - for each name of 'ontouchstart', 'ontouchmove', 'ontouchend' and 'ontouchcancel':
    - for each obj of window, HTMLElement.prototype and SVGElement.prototype:
     - verify "name in obj" is true (this is the simple thing that will pass on all browsers)
     - verify "obj.hasOwnProperty(name)" - this will fail today in some cases on some browsers but should now pass in Chrome.  You could use Object.getOwnPropertyDescriptor (eg. to also verify the attributes are writable) but IMHO that's probably overkill and so unnecessary.  Others may disagree.
   - verify "name in Element.prototype" is false (again this will fail in some browsers, but Edge plans to match Chrome here).


---
Reply to this email directly or view it on GitHub:
https://github.com/w3c/touch-events/issues/44#issuecomment-153543976

Received on Wednesday, 4 November 2015 01:42:47 UTC