yahoo/arrow — pull request #43 by akshayp (2013-01-23 09:27:45+00:00)
Title: Add Lib's to facilitate testing of modular markup components and expand Asserts library available for Arrow

### New Asserts added:

* Y.Assert.isUrl - Is a valid URL
* Y.Assert.isMatch - Match string against supplied Regex
* Y.Assert.hasKey - Does Object have a specific key
* Y.Assert.hasValue - Does Object have a specific value
* Y.Assert.hasDeepKey - Validate key exists in a nested object
* Y.Assert.hasDeepValue - Validate value exists in a nested object
* Y.Assert.operator - Compare two values
* Y.Assert.isNode - Validate a Dom Node exists
* Y.Assert.nodeTextEquals - Validate text of a Dom node equals expected value
* Y.Assert.nodeTextExists - Validate Dom node has text in it
* Y.Assert.nodeCount - Validate selector counts(look at example below)
* Y.Assert.nodeContains - Validate if given needle is within the HTML of a module
* Y.Assert.isImage - Validate if Dom node is a valid image
* Y.Assert.isAnchor - Validate if Dom node is a valid anchor

### Y.Test.Module

Writing tests for a modular HTML component can be done using expressive JSON. Only requirements are to declare *html-module, dom, common* as Common Libs in your descriptor

```javascript
YUI.add("MyAwesomeModule-tests", function (Y) {
'use strict';

var suite = new Y.Test.Suite("MyAwesomeModule Tests");

suite.add(new Y.Test.Module({
"name" : "MyAwesomeModule",
"id" : "myawesomemodule",
"asserts" : {
"Title" : ".hd h3",
"Body" : ".bd",
"Footer Link" : ".ft li",
"Test Equal To" : {
"locator" : ".bd ul li",
"type" : "nodeCount",
"expected" : "=4",
"message" : "There should be 4 Table Headers"
},
"Test Less Than" : {
"locator" : ".bd ul li.foo",
"type" : "nodeCount",
"expected" : ">30",
"message" : "There should be more than 30 list items with class foo"
},
"Test Greater Than" : {
"locator" : ".bd ul li.bar",
"type" : "nodeCount",
"expected" : "<10",
"message" : "There should be less than 10 list items with class bar"
},
"Test Node Contains" : {
"locator" : ".hd h3",
"type" : "nodeContains",
"expected" : "My Module Header"
},
"Test Node Text Exists" : {
"locator" : ".hd h3",
"type" : "nodeTextExists"
},
"Test Node" : {
"locator" : ".hd h3",
"type" : "isNode"
},
"Test Anchor" : {
"locator" : ".ft a",
"type" : "isAnchor"
},
"Test Image" : {
"locator" : ".bd ul li.logo img",
"type" : "isImage"
}
}
}));

Y.Test.Runner.add(suite);

}, "0.1", {requires : ["test", "node", "html-module-lib", "dom-lib"]});
```