Easy method for testing the API methods ("InstantAPI";) - Printable Version
+- Aria Templates Forums (http://ariatemplates.com/forum)
+-- Forum: Public forums (/forumdisplay.php?fid=3)
+--- Forum: Mid & long term evolutions (/forumdisplay.php?fid=6)
+--- Thread: Easy method for testing the API methods ("InstantAPI";) (/showthread.php?tid=137)
Easy method for testing the API methods ("InstantAPI";) - jakub-g - 9 December 2013 12:49
It could be interesting to provide an easy way to test the API methods of certain AT classes without much overhead (mostly singleton util classes).
Say I want to test certain methods of http://aria/aria-templates/apidocs.html#aria.utils.Number with various inputs.
It's doable with InstantAT, but I'd have to:
- create a method in tpl script which calls the method-under-test and returns its value
- add stuff to $dependencies in tpl script
- call the method in tpl
One way would be to make a dumb HTML page doing all that by itself (perhaps a subpage of InstantAT), i.e. having the whole framework preloaded, or doing it lazily when needed.
We could bind http://ternjs.net/doc/demo.html to have the autocompletion if we want stuff to be displayed in the browser, or if we don't want to, then tell people to use their favorite dev tools for the autocompletion.
Even more interesting would be to integrate this functionality into API doc viewer, so that on each page you'd have a button which e.g. opens an inline mini-console and Aria.load()s the current class.
RE: Easy method for testing the API methods ("InstantAPI";) - Olaf - 30 January 2014 17:20
I like the idea (and even more the ability to test some methods directly from the APIdoc) but I'm not sure that's a very frequent use case. Most of the times I'd just go on the a page where AT is loaded, launch Firebug and test. Is it really something you do often?
RE: Easy method for testing the API methods ("InstantAPI";) - jakub-g - 31 January 2014 11:24
(30 January 2014 17:20)Olaf Wrote: Most of the times I'd just go on the a page where AT is loaded, launch Firebug and test.
This is exactly what I mean. Which URL do you use? Probably http://aria/aria-templates/aria/guide/ I guess, which is kind-of deprecated. Is there some good public URL easily accessible (easily = don't need to click through 3 pages)?
Anyway whatever the URL, for sure not all the classes are loaded there naturally - if you want to test some exotic class, you'd have to `Aria.load` it in your dev tools to use them first.
A dumb empty HTML page with everything from AT preloaded and easy URL would do the trick.
APIdoc integration would be even better 'cause
1) you could see the documentation just few lines above your console and not in another browser window
2) the magic button will fetch & load only what's needed, not the whole framework -> faster