dwf: small cleanups.

This commit is contained in:
pivotal 2008-12-02 19:59:13 -08:00
parent 63db262f35
commit 10b613c97d
4 changed files with 93 additions and 5 deletions

20
README Normal file
View File

@ -0,0 +1,20 @@
Jasmine
=======
**yet another JavaScript testing framework**
The Problem
-----------
There are some situations when you want to test-drive JavaScript, but you don't want to be bothered with or even have an explicit document. You have no DOM to work with and so don't have HTML elements on which to hang events handlers. You may need to make asynchronous calls (say, to an AJAX API) and cannot mock/stub them.
But you still need to write tests.
What's an Agile Engineer to do?
The Solution
------------
Enter Jasmine.
Jasmine is yet another JavaScript testing framework. It's *heavily* influenced by [RSpec]() & [JSpec](http://github.com/visionmedia/jspec/tree/master),

70
README.markdown Normal file
View File

@ -0,0 +1,70 @@
Jasmine
=======
**yet another JavaScript testing framework**
Why another frickin' JS tdd/bdd framework?
-----------
There are some situations when you want to test-drive JavaScript, but you don't want to be bothered with or even have an explicit document. You have no DOM to work with and so don't have HTML elements on which to hang events handlers. You may need to make asynchronous calls (say, to an AJAX API) and cannot mock/stub them.
But you still need to write tests.
What's an Agile Engineer to do?
Enter Jasmine
------------
Jasmine is yet another JavaScript testing framework. It's *heavily* influenced by JSSpec, ScrewUnit & [JSpec](http://github.com/visionmedia/jspec/tree/master), which are all influenced by RSpec. But each of those was lacking in some way: JSSpec & ScrewUnit required a DOM. JSpec's DOM-less assumption was a great start, but it needed asynchronous support.
So we started over. And TDD'd a whole new framework. Enjoy.
How To
------
### Runner
Jasmine()
You don't need a DOM, but you do need a page on which to load & execute your JS.
### Suites
Group your specs via describe
### Specs
call it() and provide a desc & a function
call runs
alias of runs to then
#### Asynchronous support
call waits
### Custom Matchers
use Matchers.method('name', function ()). Write TESTS!
### Reports
no reporting yet other than Runner.results, which is walkable
### Tests
There is a VERY simple test reporter - it's not even a framework at all - that allows you to write tests.
Contributing
-----------
Contributions are welcome. Please submit tests with your pull request.
### TODO
* protect the global-ness of some variables & functions
* suite.beforeAll and suite.afterAll
* JSON reporter
* HTML reporter (callback driven)

View File

@ -110,7 +110,7 @@
<file leaf-file-name="jasmine.js" pinned="false" current="true" current-in-tab="true">
<entry file="file://$PROJECT_DIR$/lib/jasmine.js">
<provider selected="true" editor-type-id="text-editor">
<state line="274" column="0" selection-start="5628" selection-end="5628" vertical-scroll-proportion="0.07317073">
<state line="296" column="0" selection-start="6528" selection-end="6528" vertical-scroll-proportion="0.76829267">
<folding />
</state>
</provider>
@ -305,7 +305,7 @@
</todo-panel>
</component>
<component name="ToolWindowManager">
<frame x="80" y="22" width="1661" height="1178" extended-state="0" />
<frame x="1" y="22" width="1661" height="1178" extended-state="0" />
<editor active="true" />
<layout>
<window_info id="UI Designer" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" order="3" />
@ -458,7 +458,7 @@
</entry>
<entry file="file://$PROJECT_DIR$/lib/jasmine.js">
<provider selected="true" editor-type-id="text-editor">
<state line="274" column="0" selection-start="5628" selection-end="5628" vertical-scroll-proportion="0.07317073">
<state line="296" column="0" selection-start="6528" selection-end="6528" vertical-scroll-proportion="0.76829267">
<folding />
</state>
</provider>

View File

@ -294,7 +294,5 @@ var currentSpec;
* - Failed output is styled with red
* - JSON reporter
* - Lists full results as a JSON object/string
* - Luna reporter
* - each result calls back into widgets for rendering to Luna views
*/