aboutsummaryrefslogtreecommitdiffstats
path: root/src/Angular.js
diff options
context:
space:
mode:
authorMisko Hevery2011-01-31 16:21:29 -0800
committerMisko Hevery2011-02-01 10:00:09 -0800
commitba6b68b6ae2bb2400a75ca2834fee47bfd60f1c6 (patch)
tree94f08ee16f270dd5f6238fb77064c91c624df931 /src/Angular.js
parented768ebc53ef6746ca83d81892c22d2e9c3afeef (diff)
downloadangular.js-ba6b68b6ae2bb2400a75ca2834fee47bfd60f1c6.tar.bz2
changed the documentation @example to use <doc:example>
Diffstat (limited to 'src/Angular.js')
-rw-r--r--src/Angular.js92
1 files changed, 52 insertions, 40 deletions
diff --git a/src/Angular.js b/src/Angular.js
index 2812c926..de2de30d 100644
--- a/src/Angular.js
+++ b/src/Angular.js
@@ -484,14 +484,18 @@ function map(obj, iterator, context) {
* @returns {number} The size of `obj` or `0` if `obj` is neither an object or an array.
*
* @example
- * Number of items in array: {{ [1,2].$size() }}<br/>
- * Number of items in object: {{ {a:1, b:2, c:3}.$size() }}<br/>
- *
- * @scenario
- it('should print correct sizes for an array and an object', function() {
- expect(binding('[1,2].$size()')).toBe('2');
- expect(binding('{a:1, b:2, c:3}.$size()')).toBe('3');
- });
+ * <doc:example>
+ * <doc:source>
+ * Number of items in array: {{ [1,2].$size() }}<br/>
+ * Number of items in object: {{ {a:1, b:2, c:3}.$size() }}<br/>
+ * </doc:source>
+ * <doc:scenario>
+ * it('should print correct sizes for an array and an object', function() {
+ * expect(binding('[1,2].$size()')).toBe('2');
+ * expect(binding('{a:1, b:2, c:3}.$size()')).toBe('3');
+ * });
+ * </doc:scenario>
+ * </doc:example>
*/
function size(obj) {
var size = 0, key;
@@ -556,17 +560,19 @@ function isLeafNode (node) {
* @returns {*} The copy or updated `destination` if `destination` was specified.
*
* @example
- Salutation: <input type="text" name="master.salutation" value="Hello" /><br/>
- Name: <input type="text" name="master.name" value="world"/><br/>
- <button ng:click="form = master.$copy()">copy</button>
- <hr/>
-
- The master object is <span ng:hide="master.$equals(form)">NOT</span> equal to the form object.
-
- <pre>master={{master}}</pre>
- <pre>form={{form}}</pre>
-
- * @scenario
+ * <doc:example>
+ * <doc:source>
+ Salutation: <input type="text" name="master.salutation" value="Hello" /><br/>
+ Name: <input type="text" name="master.name" value="world"/><br/>
+ <button ng:click="form = master.$copy()">copy</button>
+ <hr/>
+
+ The master object is <span ng:hide="master.$equals(form)">NOT</span> equal to the form object.
+
+ <pre>master={{master}}</pre>
+ <pre>form={{form}}</pre>
+ * </doc:source>
+ * <doc:scenario>
it('should print that initialy the form object is NOT equal to master', function() {
expect(element('.doc-example input[name=master.salutation]').val()).toBe('Hello');
expect(element('.doc-example input[name=master.name]').val()).toBe('world');
@@ -577,6 +583,8 @@ function isLeafNode (node) {
element('.doc-example button').click();
expect(element('.doc-example span').css('display')).toBe('none');
});
+ * </doc:scenario>
+ * </doc:example>
*/
function copy(source, destination){
if (!destination) {
@@ -633,27 +641,31 @@ function copy(source, destination){
* @returns {boolean} True if arguments are equal.
*
* @example
- Salutation: <input type="text" name="greeting.salutation" value="Hello" /><br/>
- Name: <input type="text" name="greeting.name" value="world"/><br/>
- <hr/>
-
- The <code>greeting</code> object is
- <span ng:hide="greeting.$equals({salutation:'Hello', name:'world'})">NOT</span> equal to
- <code>{salutation:'Hello', name:'world'}</code>.
-
- <pre>greeting={{greeting}}</pre>
-
- @scenario
- it('should print that initialy greeting is equal to the hardcoded value object', function() {
- expect(element('.doc-example input[name=greeting.salutation]').val()).toBe('Hello');
- expect(element('.doc-example input[name=greeting.name]').val()).toBe('world');
- expect(element('.doc-example span').css('display')).toBe('none');
- });
-
- it('should say that the objects are not equal when the form is modified', function() {
- input('greeting.name').enter('kitty');
- expect(element('.doc-example span').css('display')).toBe('inline');
- });
+ * <doc:example>
+ * <doc:source>
+ Salutation: <input type="text" name="greeting.salutation" value="Hello" /><br/>
+ Name: <input type="text" name="greeting.name" value="world"/><br/>
+ <hr/>
+
+ The <code>greeting</code> object is
+ <span ng:hide="greeting.$equals({salutation:'Hello', name:'world'})">NOT</span> equal to
+ <code>{salutation:'Hello', name:'world'}</code>.
+
+ <pre>greeting={{greeting}}</pre>
+ * </doc:source>
+ * <doc:scenario>
+ it('should print that initialy greeting is equal to the hardcoded value object', function() {
+ expect(element('.doc-example input[name=greeting.salutation]').val()).toBe('Hello');
+ expect(element('.doc-example input[name=greeting.name]').val()).toBe('world');
+ expect(element('.doc-example span').css('display')).toBe('none');
+ });
+
+ it('should say that the objects are not equal when the form is modified', function() {
+ input('greeting.name').enter('kitty');
+ expect(element('.doc-example span').css('display')).toBe('inline');
+ });
+ * </doc:scenario>
+ * </doc:example>
*/
function equals(o1, o2) {
if (o1 == o2) return true;