From c2f2587a79aeb77aad66f081cf924a79348a698e Mon Sep 17 00:00:00 2001
From: Misko Hevery
Date: Wed, 19 Jan 2011 15:42:11 -0800
Subject: fixed example rendering, add tests for it.
---
src/AngularPublic.js | 2 +-
src/Browser.js | 48 ++++++-------
src/Compiler.js | 14 ++--
src/Injector.js | 2 +-
src/markups.js | 18 ++---
src/parser.js | 42 +++++------
src/sanitizer.js | 2 +-
src/scenario/output/Json.js | 2 +-
src/services.js | 170 ++++++++++++++++++++++----------------------
src/validators.js | 124 ++++++++++++++++----------------
10 files changed, 212 insertions(+), 212 deletions(-)
(limited to 'src')
diff --git a/src/AngularPublic.js b/src/AngularPublic.js
index ec41d0d9..4654acb1 100644
--- a/src/AngularPublic.js
+++ b/src/AngularPublic.js
@@ -4,7 +4,7 @@ var browserSingleton;
* @ngdoc service
* @name angular.service.$browser
* @requires $log
- *
+ *
* @description
* Represents the browser.
*/
diff --git a/src/Browser.js b/src/Browser.js
index 671ec1cc..c67608cd 100644
--- a/src/Browser.js
+++ b/src/Browser.js
@@ -67,12 +67,12 @@ function Browser(window, document, body, XHR, $log) {
* @ngdoc method
* @name angular.service.$browser#xhr
* @methodOf angular.service.$browser
- *
+ *
* @param {string} method Requested method (get|post|put|delete|head|json)
* @param {string} url Requested url
- * @param {string=} post Post data to send
+ * @param {string=} post Post data to send
* @param {function(number, string)} callback Function that will be called on response
- *
+ *
* @description
* Send ajax request
*/
@@ -113,7 +113,7 @@ function Browser(window, document, body, XHR, $log) {
* @ngdoc method
* @name angular.service.$browser#notifyWhenNoOutstandingRequests
* @methodOf angular.service.$browser
- *
+ *
* @param {function()} callback Function that will be called when no outstanding request
*/
self.notifyWhenNoOutstandingRequests = function(callback) {
@@ -144,12 +144,12 @@ function Browser(window, document, body, XHR, $log) {
* @ngdoc method
* @name angular.service.$browser#addPollFn
* @methodOf angular.service.$browser
- *
+ *
* @param {function()} fn Poll function to add
- *
+ *
* @description
* Adds a function to the list of functions that poller periodically executes
- *
+ *
* @returns {function()} the added function
*/
self.addPollFn = function(fn) {
@@ -162,10 +162,10 @@ function Browser(window, document, body, XHR, $log) {
* @ngdoc method
* @name angular.service.$browser#startPoller
* @methodOf angular.service.$browser
- *
+ *
* @param {number} interval How often should browser call poll functions (ms)
* @param {function()} setTimeout Reference to a real or fake `setTimeout` function.
- *
+ *
* @description
* Configures the poller to run in the specified intervals, using the specified
* setTimeout fn and kicks it off.
@@ -180,15 +180,15 @@ function Browser(window, document, body, XHR, $log) {
//////////////////////////////////////////////////////////////
// URL API
//////////////////////////////////////////////////////////////
-
+
/**
* @workInProgress
* @ngdoc method
* @name angular.service.$browser#setUrl
* @methodOf angular.service.$browser
- *
+ *
* @param {string} url New url
- *
+ *
* @description
* Sets browser's url
*/
@@ -204,10 +204,10 @@ function Browser(window, document, body, XHR, $log) {
* @ngdoc method
* @name angular.service.$browser#getUrl
* @methodOf angular.service.$browser
- *
+ *
* @description
* Get current browser's url
- *
+ *
* @returns {string} Browser's url
*/
self.getUrl = function() {
@@ -261,10 +261,10 @@ function Browser(window, document, body, XHR, $log) {
* @ngdoc method
* @name angular.service.$browser#cookies
* @methodOf angular.service.$browser
- *
+ *
* @param {string=} name Cookie name
* @param {string=} value Cokkie value
- *
+ *
* @description
* The cookies method provides a 'private' low level access to browser cookies.
* It is not meant to be used directly, use the $cookie service instead.
@@ -275,7 +275,7 @@ function Browser(window, document, body, XHR, $log) {
*
cookies(name, value) -> set name to value, if value is undefined delete the cookie
*
cookies(name) -> the same as (name, undefined) == DELETES (no one calls it right now that way)
*
- *
+ *
* @returns {Object} Hash of all cookies (if called without any parameter)
*/
self.cookies = function (name, value) {
@@ -342,7 +342,7 @@ function Browser(window, document, body, XHR, $log) {
// Misc API
//////////////////////////////////////////////////////////////
var hoverListener = noop;
-
+
/**
* @workInProgress
* @ngdoc method
@@ -356,13 +356,13 @@ function Browser(window, document, body, XHR, $log) {
* occurs.
*/
self.hover = function(listener) { hoverListener = listener; };
-
+
/**
* @workInProgress
* @ngdoc method
* @name angular.service.$browser#bind
* @methodOf angular.service.$browser
- *
+ *
* @description
* Register hover function to real browser
*/
@@ -383,7 +383,7 @@ function Browser(window, document, body, XHR, $log) {
* @ngdoc method
* @name angular.service.$browser#addCss
* @methodOf angular.service.$browser
- *
+ *
* @param {string} url Url to css file
* @description
* Adds a stylesheet tag to the head.
@@ -402,10 +402,10 @@ function Browser(window, document, body, XHR, $log) {
* @ngdoc method
* @name angular.service.$browser#addJs
* @methodOf angular.service.$browser
- *
+ *
* @param {string} url Url to js file
- * @param {string=} dom_id Optional id for the script tag
- *
+ * @param {string=} dom_id Optional id for the script tag
+ *
* @description
* Adds a script tag to the head.
*/
diff --git a/src/Compiler.js b/src/Compiler.js
index 58a7a47b..c2c56650 100644
--- a/src/Compiler.js
+++ b/src/Compiler.js
@@ -123,19 +123,19 @@ Compiler.prototype = {
};
},
-
+
/**
* @workInProgress
* @ngdoc directive
* @name angular.directive.ng:eval-order
*
* @description
- * Normally the view is updated from top to bottom. This usually is
- * not a problem, but under some circumstances the values for data
- * is not available until after the full view is computed. If such
- * values are needed before they are computed the order of
+ * Normally the view is updated from top to bottom. This usually is
+ * not a problem, but under some circumstances the values for data
+ * is not available until after the full view is computed. If such
+ * values are needed before they are computed the order of
* evaluation can be change using ng:eval-order
- *
+ *
* @element ANY
* @param {integer|string=} [priority=0] priority integer, or FIRST, LAST constant
*
@@ -164,7 +164,7 @@ Compiler.prototype = {
{{ items.$sum('total') | currency }}
- *
+ *
* @scenario
it('should check ng:format', function(){
expect(using('.doc-example-live div:first').binding("items.$sum('total')")).toBe('$9.99');
diff --git a/src/Injector.js b/src/Injector.js
index cd9438e7..c7ee6f82 100644
--- a/src/Injector.js
+++ b/src/Injector.js
@@ -31,7 +31,7 @@ function createInjector(providerScope, providers, cache) {
* array of keys: returns an array of instances.
* function: look at $inject property of function to determine instances
* and then call the function with instances and `scope`. Any
- * additional arguments (`args`) are appended to the function
+ * additional arguments (`args`) are appended to the function
* arguments.
* object: initialize eager providers and publish them the ones with publish here.
* none: same as object but use providerScope as place to publish.
diff --git a/src/markups.js b/src/markups.js
index 16ca9ba8..21dab128 100644
--- a/src/markups.js
+++ b/src/markups.js
@@ -74,18 +74,18 @@ angularTextMarkup('OPTION', function(text, textNode, parentElement){
* @name angular.directive.ng:href
*
* @description
- * Using markup like {{hash}} in an href attribute makes
- * the page open to a wrong URL, ff the user clicks that link before
- * angular has a chance to replace the {{hash}} with actual URL, the
- * link will be broken and will most likely return a 404 error.
- * The `ng:href` solves this problem by placing the `href` in the
+ * Using markup like {{hash}} in an href attribute makes
+ * the page open to a wrong URL, ff the user clicks that link before
+ * angular has a chance to replace the {{hash}} with actual URL, the
+ * link will be broken and will most likely return a 404 error.
+ * The `ng:href` solves this problem by placing the `href` in the
* `ng:` namespace.
*
* The buggy way to write it:
*
*
*
- *
+ *
* The correct way to write it:
*
*
@@ -101,8 +101,8 @@ angularTextMarkup('OPTION', function(text, textNode, parentElement){
* @name angular.directive.ng:src
*
* @description
- * Using markup like `{{hash}}` in a `src` attribute doesn't
- * work right: The browser will fetch from the URL with the literal
+ * Using markup like `{{hash}}` in a `src` attribute doesn't
+ * work right: The browser will fetch from the URL with the literal
* text `{{hash}}` until replaces the expression inside
* `{{hash}}`. The `ng:src` attribute solves this problem by placing
* the `src` attribute in the `ng:` namespace.
@@ -111,7 +111,7 @@ angularTextMarkup('OPTION', function(text, textNode, parentElement){
*
*
*
- *
+ *
* The correct way to write it:
*
*
diff --git a/src/parser.js b/src/parser.js
index ac62fb97..f2ca7a80 100644
--- a/src/parser.js
+++ b/src/parser.js
@@ -49,8 +49,8 @@ function lex(text, parseStringsForObjects){
}
} else if (is('(){}[].,;:')) {
tokens.push({
- index:index,
- text:ch,
+ index:index,
+ text:ch,
json:(was(':[,') && is('{[')) || is('}]:,')
});
if (is('{[')) json.unshift(ch);
@@ -108,8 +108,8 @@ function lex(text, parseStringsForObjects){
end = end || index;
throw Error("Lexer Error: " + error + " at column" +
(isDefined(start) ?
- "s " + start + "-" + index + " [" + text.substring(start, end) + "]" :
- " " + end) +
+ "s " + start + "-" + index + " [" + text.substring(start, end) + "]" :
+ " " + end) +
" in expression [" + text + "].");
}
@@ -157,8 +157,8 @@ function lex(text, parseStringsForObjects){
}
fn = OPERATORS[ident];
tokens.push({
- index:start,
- text:ident,
+ index:start,
+ text:ident,
json: fn,
fn:fn||extend(getterFn(ident), {
assign:function(self, value){
@@ -167,7 +167,7 @@ function lex(text, parseStringsForObjects){
})
});
}
-
+
function readString(quote) {
var start = index;
index++;
@@ -217,25 +217,25 @@ function lex(text, parseStringsForObjects){
function parser(text, json){
var ZERO = valueFn(0),
tokens = lex(text, json),
- assignment = _assignment,
+ assignment = _assignment,
assignable = logicalOR,
- functionCall = _functionCall,
- fieldAccess = _fieldAccess,
- objectIndex = _objectIndex,
- filterChain = _filterChain,
- functionIdent = _functionIdent,
+ functionCall = _functionCall,
+ fieldAccess = _fieldAccess,
+ objectIndex = _objectIndex,
+ filterChain = _filterChain,
+ functionIdent = _functionIdent,
pipeFunction = _pipeFunction;
if(json){
- // The extra level of aliasing is here, just in case the lexer misses something, so that
+ // The extra level of aliasing is here, just in case the lexer misses something, so that
// we prevent any accidental execution in JSON.
assignment = logicalOR;
- functionCall =
- fieldAccess =
- objectIndex =
+ functionCall =
+ fieldAccess =
+ objectIndex =
assignable =
- filterChain =
- functionIdent =
- pipeFunction =
+ filterChain =
+ functionIdent =
+ pipeFunction =
function (){ throwError("is not valid json", {text:text, index:0}); };
}
return {
@@ -368,7 +368,7 @@ function parser(text, json){
argFns.push(expression());
} else {
return valueFn({
- format:invokeFn(formatter.format),
+ format:invokeFn(formatter.format),
parse:invokeFn(formatter.parse)
});
}
diff --git a/src/sanitizer.js b/src/sanitizer.js
index 5e99ec71..c8a7b9f1 100644
--- a/src/sanitizer.js
+++ b/src/sanitizer.js
@@ -214,7 +214,7 @@ function decodeEntities(value) {
}
/**
- * Escapes all potentially dangerous characters, so that the
+ * Escapes all potentially dangerous characters, so that the
* resulting string can be safely inserted into attribute or
* element text.
* @param value
diff --git a/src/scenario/output/Json.js b/src/scenario/output/Json.js
index 94212301..2c852496 100644
--- a/src/scenario/output/Json.js
+++ b/src/scenario/output/Json.js
@@ -3,7 +3,7 @@
*/
angular.scenario.output('json', function(context, runner) {
var model = new angular.scenario.ObjectModel(runner);
-
+
runner.on('RunnerEnd', function() {
context.text(angular.toJson(model.value));
});
diff --git a/src/services.js b/src/services.js
index 1a7b91ac..aa4a2090 100644
--- a/src/services.js
+++ b/src/services.js
@@ -11,16 +11,16 @@ function angularServiceInject(name, fn, inject, eager) {
* @workInProgress
* @ngdoc service
* @name angular.service.$window
- *
+ *
* @description
* Is reference to the browser's window object. While window
* is globally available in JavaScript, it causes testability problems, because
* it is a global variable. In we always refer to it through the
* $window service, so it may be overriden, removed or mocked for testing.
- *
+ *
* All expressions are evaluated with respect to current scope so they don't
* suffer from window globality.
- *
+ *
* @example
@@ -32,7 +32,7 @@ angularServiceInject("$window", bind(window, identity, window), [], EAGER);
* @ngdoc service
* @name angular.service.$document
* @requires $window
- *
+ *
* @description
* Reference to the browser window.document, but wrapped into angular.element().
*/
@@ -45,7 +45,7 @@ angularServiceInject("$document", function(window){
* @ngdoc service
* @name angular.service.$location
* @requires $browser
- *
+ *
* @property {string} href
* @property {string} protocol
* @property {string} host
@@ -55,15 +55,15 @@ angularServiceInject("$document", function(window){
* @property {string} hash
* @property {string} hashPath
* @property {Object.} hashSearch
- *
+ *
* @description
* Parses the browser location url and makes it available to your application.
* Any changes to the url are reflected into $location service and changes to
* $location are reflected to url.
* Notice that using browser's forward/back buttons changes the $location.
- *
+ *
* @example
- clear hash |
+ clear hash |
test hash
$location = {{$location}}
@@ -91,7 +91,7 @@ angularServiceInject("$location", function($browser) {
* @ngdoc method
* @name angular.service.$location#update
* @methodOf angular.service.$location
- *
+ *
* @description
* Update location object
* Does not immediately update the browser
@@ -127,7 +127,7 @@ angularServiceInject("$location", function($browser) {
* @ngdoc method
* @name angular.service.$location#updateHash
* @methodOf angular.service.$location
- *
+ *
* @description
* Update location hash part
* @see update()
@@ -288,13 +288,13 @@ angularServiceInject("$location", function($browser) {
* @ngdoc service
* @name angular.service.$log
* @requires $window
- *
+ *
* @description
* Is simple service for logging. Default implementation writes the message
* into the browser's console (if present).
- *
+ *
* This is useful for debugging.
- *
+ *
* @example
Reload this page with open console, enter text and hit the log button...
Message:
@@ -311,46 +311,46 @@ angularServiceInject("$log", function($window){
* @ngdoc method
* @name angular.service.$log#log
* @methodOf angular.service.$log
- *
+ *
* @description
* Write a log message
*/
log: consoleLog('log'),
-
+
/**
* @workInProgress
* @ngdoc method
* @name angular.service.$log#warn
* @methodOf angular.service.$log
- *
+ *
* @description
* Write a warning message
*/
warn: consoleLog('warn'),
-
+
/**
* @workInProgress
* @ngdoc method
* @name angular.service.$log#info
* @methodOf angular.service.$log
- *
+ *
* @description
* Write an information message
*/
info: consoleLog('info'),
-
+
/**
* @workInProgress
* @ngdoc method
* @name angular.service.$log#error
* @methodOf angular.service.$log
- *
+ *
* @description
* Write an error message
*/
error: consoleLog('error')
};
-
+
function consoleLog(type) {
var console = $window.console || {};
var logFn = console[type] || console.log || noop;
@@ -374,17 +374,17 @@ angularServiceInject("$log", function($window){
* @ngdoc service
* @name angular.service.$exceptionHandler
* @requires $log
- *
+ *
* @description
* Any uncaught exception in is delegated to this service.
* The default implementation simply delegates to $log.error which logs it into
* the browser console.
- *
+ *
* When unit testing it is useful to have uncaught exceptions propagate
* to the test so the test will fail rather than silently log the exception
* to the browser console. For this purpose you can override this service with
- * a simple rethrow.
- *
+ * a simple rethrow.
+ *
* @example
*/
angularServiceInject('$exceptionHandler', function($log){
@@ -459,9 +459,9 @@ angularServiceInject('$updateView', serviceUpdateViewFactory, ['$browser']);
* @name angular.service.$hover
* @requires $browser
* @requires $document
- *
+ *
* @description
- *
+ *
* @example
*/
angularServiceInject("$hover", function(browser, document) {
@@ -514,11 +514,11 @@ angularServiceInject("$hover", function(browser, document) {
* @workInProgress
* @ngdoc service
* @name angular.service.$invalidWidgets
- *
+ *
* @description
* Keeps references to all invalid widgets found during validation.
* Can be queried to find whether there are any invalid widgets currently displayed.
- *
+ *
* @example
*/
angularServiceInject("$invalidWidgets", function(){
@@ -608,45 +608,45 @@ function switchRouteMatcher(on, when, dstName) {
* @ngdoc service
* @name angular.service.$route
* @requires $location
- *
+ *
* @property {Object} current Name of the current route
* @property {Array.