Permalink
Browse files

Started working on docs for 2.0 in doc/new.

  • Loading branch information...
1 parent 29661b9 commit a1db31971e6aa8d8a6dcd75974208bc0add85762 @assaf committed Dec 4, 2012
View
@@ -1,132 +0,0 @@
-## Assertions
-
-Node.js core includes an `assert` function, and there are many alternatives you
-can use for assertions and expectations. Obviously Zombie will support all of
-them.
-
-To make your life easier, it also introduces a set of convenience assertions you
-can execute directly against the browser object. For example, to check that a
-page load completed successfully, you may do:
-
- browser.assert.success();
- browser.assert.text("title", "My Awesome Site");
- browser.assert.element("#main");
-
-Assertions that take an expected value, will compare that against the actual
-value. The expected value can be a primitive JavaScript value (string, number,
-etc), a regular expression or a function. In the later case, the function is
-called with the actual value, and the assertion passes if the function returns
-true.
-
-Assertions that take a CSS selector use it to retrieve an HTML element or
-elements. You can also pass the element(s) directly instead of a selector (e.g.
-if you need to access an element inside an iframe).
-
-All assertions take an optional last argument that is the message to show if the
-assertion fails, but when using frameworks that has good reporting (e.g. Mocha)
-you want to let the assertion format the message for you.
-
-The following assertions are available:
-
-`browser.assert.attribute(selector, name, expected, message)`
-
-Assert the named attribute of the selected element(s) has the expected value.
-Fails if no elements found.
-
-`browser.assert.className(selector, className, message)`
-
-Asserts that selected element(s) has the that and only that class name.
-
-`browser.assert.cookie(name, expected, message)`
-
-Asserts that a cookie with the given name has the expected value.
-
-`browser.assert.element(selector, message)`
-
-Assert that an element matching selector exists.
-
-`browser.assert.elements(selector, count, message)`
-
-Assert how many elements exist that match the selector.
-
-The count can be a number, or an object with the following properties:
-
-- `atLeast` - Expect to find at least that many elements.
-- `atMost` - Expect to find at most that many elements.
-- `exactly` - Expect to find exactly that many elements.
-
-`browser.assert.evaluate(expression, expected, message)`
-
-Evaluates the JavaScript expression in the browser context. With one argument,
-asserts that the value is true. With two or three arguments, asserts that the
-value of the expression matches the expected value.
-
-`browser.assert.global(name, expected, message)`
-
-Asserts that the global (window) property has the expected value.
-
-`browser.assert.hasClass(selector, className, message)`
-
-Asserts that selected element(s) has the expected class name (it may have many
-other class names).
-
-`browser.assert.hasFocus(selector, message)`
-
-Asserts that selected element has the focus.
-
-`browser.assert.input(selector, expected, message)`
-
-Asserts that selected input field (text field, text area, etc) has the expected
-value.
-
-`browser.assert.hasNoClass(selector, className, message)`
-
-Asserts that selected element(s) does not have the expected class name (it may
-have many other class names).
-
-`browser.assert.prompted(messageShown, message)`
-
-Assert that browser prompted with a given message.
-
-`browser.assert.redirected(message)`
-
-Asserts that browser was redirected when retrieving the current page.
-
-`browser.assert.success(message)`
-
-Assert that the last page load returned status code 200.
-
-`browser.assert.status(code, message)`
-
-Assert that the last page load returned the expected status code.
-
-`browser.assert.style(selector, style, expected, message)`
-
-Assert that the style property of the selected element(s) the expected value.
-
-`browser.assert.text(selector, expected, message)`
-
-Assert that text content of selected element(s) matche the expected value.
-
-`browser.assert.url(url, message)`
-
-Asserts that current page has the expected URL.
-
-The expected URL value can be a string, regular expression, or function just
-like every other assertion. It can also be an object, in which case, individual
-properties are matched against the URL.
-
-For example:
-
- browser.assert.url({ pathame: "/resource" });
- browser.assert.url({ query: { name: "joedoe" } });
-
-
-You can add more assertions by adding methods to the prototype of
-`Browser.Assert`. These have access to the browser as a property, for example:
-
- // Asserts the browser has the expected number of open tabs.
- Browser.Assert.prototype.openTabs = function(expected, message) {
- assert.equal(this.browser.tabs.length, expected, message);
- };
-
View
No changes.
View
@@ -1,109 +0,0 @@
-## Events
-
-`console (level, messsage)`
-
-Emitted whenever a message is printed to the console (`console.log`,
-`console.error`, `console.trace`, etc).
-
-The first argument is the logging level, one of `debug`, `error`, `info`, `log`,
-`trace` or `warn`. The second argument is the message to log.
-
-
-
-`active (window)`
-
-Emitted when this window becomes the active window.
-
-`closed (window)`
-
-Emitted when a window is closed.
-
-
-`done ()`
-
-Emitted whenever the event loop is empty.
-
-`evaluated (code, result, filename)`
-
-Emitted whenever JavaScript code is evaluated. The first argument is the
-JavaScript function or source code, the second argument the result, and the
-third argument is the filename.
-
-`event (event, target)`
-
-Emitted whenever a DOM event is fired on the target element, document or window.
-
-`focus (element)`
-
-Emitted whenever an input element receives the focus.
-
-`inactive (window)`
-
-Emitted when this window is no longer the active window.
-
-`interval (function, interval)`
-
-Emitted whenever an interval event (`setInterval`) is fired, with the function and
-interval.
-
-`link (url, target)`
-
-Emitted when a link is clicked and the browser navigates to a new URL. Includes
-the URL and the target window (default to `_self`).
-
-`loaded (document)`
-
-Emitted when a document is loaded into a window or frame. This event is emitted
-after the HTML is parsed and loaded into the Document object.
-
-`loading (document)`
-
-Emitted when a document is loaded into a window or frame. This event is emitted
-with an empty Document object, before parsing the HTML response.
-
-`opened (window)`
-
-Emitted when a window is opened.
-
-`redirect (request, response)`
-
-Emitted when following a redirect.
-
-The first argument is the request, the second argument is the redirect response.
-The URL of the new resource to retrieve is given by `response.url`.
-
-`request (request, target)`
-
-Emitted before making a request to retrieve the resource.
-
-The first argument is the request object (see *Resources* for more details), the
-second argument is the target element/document.
-
-`response (request, response, target)`
-
-Emitted after receiving the response when retrieving a resource.
-
-The first argument is the request object (see *Resources* for more details), the
-second argument is the response that is passed back, and the third argument is
-the target element/document.
-
-`submit (url, target)`
-
-Emitted when a form is submitted. Includes the action URL and the target window
-(default to `_self`).
-
-`timeout (function, delay)`
-
-Emitted whenever a timeout event (`setTimeout`) is fired, with the function and
-delay.
-
-
-
-Browser.extend(function(browser) {
- browser.on("console", function(level, message) {
- logger.log(message);
- });
- browser.on("log", function(level, message) {
- logger.log(message);
- });
-});
Oops, something went wrong.

0 comments on commit a1db319

Please sign in to comment.