Skip to content

Commit

Permalink
Added documentation for new API methods unselect, selectOption and
Browse files Browse the repository at this point in the history
unselectOption.
  • Loading branch information
assaf committed Jan 9, 2011
1 parent 1578014 commit b3f816a
Show file tree
Hide file tree
Showing 3 changed files with 47 additions and 16 deletions.
14 changes: 12 additions & 2 deletions CHANGELOG.md
Expand Up @@ -8,10 +8,20 @@ Properly use the existance operator so empty strings are sent (José Valim).

Fix to XPath evaluation and sorting by document order (José Valim).

Added `unselect`, `selectOption` and `unselectOption` to browser (Bob
Lail).

Added `cookies.clear` (Bob Lail).

You can now call browser methods that accept a selector (e.g. `fill`,
`select`) with the element itself.

Fix to populate fields even if field type is invalid (Bob Lail).

Update to HTML5 0.2.9.

231 Tests
3.4 sec to complete
238 Tests
3.3 sec to complete


### Version 0.8.8 2011-01-04
Expand Down
22 changes: 11 additions & 11 deletions README.md
Expand Up @@ -135,11 +135,11 @@ entering text, submitting forms. You can certainly do that using the
functions we're going to cover next.

To click a link on the page, use `clickLink` with selector and callback.
The first argument can be a CSS selector (see _Hunting_) or the text
contents of the `A` element you want to click. The second argument is a
callback, which is passed on to `browser.wait` (see _Walking_). In
other words, it gets fired after all events are processed, with error
and browser as arguments.
The first argument can be a CSS selector (see _Hunting_), the `A`
element, or the text contents of the `A` element you want to click. The
second argument is a callback, which is passed on to `browser.wait` (see
_Walking_). In other words, it gets fired after all events are
processed, with error and browser as arguments.

Let's see that in action:

Expand All @@ -150,16 +150,16 @@ Let's see that in action:
});

To submit a form, use `pressButton`. The first argument can be a CSS
selector, the button name (the value of the `name` argument) or the text
that shows on the button. You can press any `BUTTON` element or `INPUT`
of type `submit`, `reset` or `button`. The second argument is a
callback, just like `clickLink`.
selector, the button/input element. the button name (the value of the
`name` argument) or the text that shows on the button. You can press
any `BUTTON` element or `INPUT` of type `submit`, `reset` or `button`.
The second argument is a callback, just like `clickLink`.

Of course, before submitting a form, you'll need to fill it with values.
For text fields, use the `fill` function, which takes two arguments:
selector and the field value. This time the selector can be a CSS
selector, the field name (its `name` attribute), or the text that shows
on the label associated with that field.
selector, the input element, the field name (its `name` attribute), or
the text that shows on the label associated with that field.

Zombie.js supports text fields, password fields, text areas, and also
the new HTML 5 fields types like email, search and url.
Expand Down
27 changes: 24 additions & 3 deletions doc/API.md
Expand Up @@ -205,7 +205,7 @@ and resets before passing control to the callback. For example:
Methods for interacting with form controls (e.g. `fill`, `check`) take a
first argument that tries to identify the form control using a variety
of approaches. You can always select the form control using an
appropriate [CSS selector](selectors.html).
appropriate [CSS selector](selectors.html), or pass the element itself.

Zombie.js can also identify form controls using their name (the value of
the `name` attribute) or using the text of the label associated with
Expand Down Expand Up @@ -292,13 +292,34 @@ For example:

browser.select("Currency", "brain$")

See also `selectOption`.

Returns itself.

### browser.selectOption(option) : this

Selects the option (an `OPTION` element) and returns itself.

### browser.uncheck(field) : this

Unchecks a checkbox. The argument can be the field name, label text or
a CSS selector.

### browser.unselect(field, value) : this

Unselects an option. The first argument can be the field name, label
text or a CSS selector. The second value is the option to unselect, by
value or label.

You can use this (or `unselectOption`) when dealing with multiple
selection.

Returns itself.

### browser.unselectOption(option) : this

Unselects the option (an `OPTION` element) and returns itself.


## State Management

Expand All @@ -317,8 +338,8 @@ For example:

browser.cookies("localhost").set("session", "567");

The `Cookies` object has the methods `get(name)`, `set(name, value)`,
`remove(name)` and `dump()`.
The `Cookies` object has the methods `clear()`, `get(name)`, `set(name,
value)`, `remove(name)` and `dump()`.

The `set` method accepts a third argument which may include the options
`expires`, `maxAge` and `secure`.
Expand Down

0 comments on commit b3f816a

Please sign in to comment.