Droogans/ppo — pull request #2 by Droogans (2014-08-18 03:34:09+00:00)
Title: Tokenizer tests

I really want to get the selectors api figured out before this gets merged.

Everything here, so far, is pretty consistent.

Highlights:

Any of these selectors can be (roughly) expressed as a string in the form:

> `'[all] by locator "input"'`

`all` is optional, but quotes are required for any and all input, for simplicity and uniformity.

Simplicity and uniformity is a bit trickier with selector shorthands. For the most part, it uses the same tokens (if available), but they're doubled if using `element.all`. For instance, `'/xpath'` gets doubled to `'//xpath'` (which is nice), but `''` gets doubled to `'<>'` (not so nice).

This is based on the pattern established by the `$`/`$$` shorthand selector.

The only exception is `element(by.js())`, since it uses the code block backtick `` ` `` character. I thought it made more sense to use the well-known "code fences" operator for `element.all(by.js())` (e.g., ```` ``` ````)

All shorthand selectors are of type string.

Below are the proposed shorthands:

Selector | `element(by())` | `element.all(by())`
---------|-----------------|--------------------
**addLocator** | *not supported* | *not supported*
**binding** | `'{{binding.data}}'` | `'{{{{binding.data}}}}'`
**buttonText** | `'button="Button Text"'` | `'buttons="Button Text"'`
**className** | `'.class-name'` | `'..class-name'`
**css** | `'$(.title)'` | `'$$(.title)'`
**cssContainingText** | `'$(.title) "Text"'` | `'$$(.title) "Text"'`
**exactBinding** | `'{{"exact.binding"}}'` | `'{{{{"exact.binding"}}}}'`
**id** | `'#id'` | `'##id'`
**js** | ``'`return 2 + "2"`'`` | ````'```return 2 + "2"```'````
**linkText** | `'href="linkText"'` | `'hrefs="linkText"'`
**model** | '`model="modelName"'` | `'models="modelName"'`
**name** | `'name="someName"'` | `'names="someName"'`
**options** | *none* | `'opt for opt in options'`
**partialButtonText** | `'button*="Button Text"'` | `'buttons*="Button Text"'`
**partialLinkText** | `'href*="linkText"'` | `'hrefs*="linkText"'`
**repeater** | *none* | `'thing in repeater'`
**tagName** | `''` | `'<>'`
**xpath** | `'/xpath'` | `'//xpath'`