-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Updating ReadMe to be a bit clearer.
- Loading branch information
Showing
1 changed file
with
9 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,13 @@ | ||
***BEHAVE!*** | ||
Dominate the DOM. | ||
We put the DOM back in the DOM. | ||
We put the Dom back in the DOM. | ||
|
||
`bower install behave` | ||
|
||
include the behave, lodash and jquery scripts in your test framework | ||
include behave, lodash and jquery scripts in your test framework | ||
|
||
**USE IT LIKE THIS** | ||
**The Problem This Solves** | ||
As we wrote front-end tests, we kept having to write verbose jQuery in order to grab and manipulate elements in our front-end tests. It sucked. Maybe you do the same thing. Maybe it looks like this... | ||
|
||
Tired of doing lame, verbose jQuery to grab and manipulate elements in your front-end tests? No more! | ||
|
||
Before: | ||
``` | ||
$("[name='email']").val('[email protected]').trigger('input'); | ||
$("[for='age']").val(27).trigger('input'); | ||
|
@@ -19,18 +16,17 @@ Before: | |
var createButton = $view.find("button:contains('Create')") | ||
expect(createButton).not.toBeDisabled(); | ||
``` | ||
Ew. Gross. | ||
|
||
Now with Behave!: | ||
**The Solution** | ||
Behave! Tell that DOM exactly what you want. | ||
``` | ||
fill('form').with({email: '[email protected]', age: 27, dob: '04/27/87'}); | ||
expect(find('Create')).not.toBeDisabled() | ||
``` | ||
|
||
|
||
|
||
Behave! tries to intelligently find things when you try to fill in an element on the page. If your | ||
forms conform to general standards, it will likely find them. It searches for attrs like | ||
name, for, placeholder, type, actual text, and others. Fill only looks through element types | ||
The example above uses Behave's `fill` method. It tries to intelligently find elements that you need on the page. If your forms conform to general standards, it will likely find them. It searches for attrs like | ||
`name`, `for`, `placeholder`, `type`, plus actual text, and others. Fill only looks through element types | ||
that would typically show up in a form ('input', 'select', 'option', 'label', 'textarea', or 'form'). | ||
|
||
|
||
|