mirror of
https://github.com/Hopiu/angular.js.git
synced 2026-03-16 23:30:23 +00:00
style: fix some missing semi-colons and spaces, typos
This commit is contained in:
parent
292d5d1421
commit
4b4292edb8
7 changed files with 52 additions and 51 deletions
|
|
@ -30,7 +30,7 @@ writer.makeDir('build/docs/syntaxhighlighter').then(function() {
|
|||
return Q.deep(fileFutures);
|
||||
}).then(function generateManifestFile() {
|
||||
return appCache('build/docs/').then(function(list) {
|
||||
writer.output('appcache-offline.manifest',list)
|
||||
writer.output('appcache-offline.manifest', list);
|
||||
});
|
||||
}).then(function printStats() {
|
||||
console.log('DONE. Generated ' + docs.length + ' pages in ' + (now()-start) + 'ms.' );
|
||||
|
|
@ -46,7 +46,7 @@ function writeTheRest(writesFuture) {
|
|||
var manifest = 'manifest="appcache.manifest"',
|
||||
jq = '<script src="jquery.min.js"></script>',
|
||||
ngMin = '<script src="../angular.min.js" ng:autobind></script>',
|
||||
ng = '<script src="../angular.js" ng:autobind></script>'
|
||||
ng = '<script src="../angular.js" ng:autobind></script>';
|
||||
|
||||
writesFuture.push(writer.copy('docs/src/templates/index.html', 'build/docs/index.html',
|
||||
writer.replace, {'doc:manifest': manifest,
|
||||
|
|
|
|||
|
|
@ -8,14 +8,14 @@ var Q = require('qq');
|
|||
var OUTPUT_DIR = "build/docs/";
|
||||
var fs = require('fs');
|
||||
|
||||
exports.output = function(file, content){
|
||||
exports.output = function(file, content) {
|
||||
console.log('writing ', file);
|
||||
var fullPath = OUTPUT_DIR + file;
|
||||
var dir = parent(fullPath);
|
||||
return Q.when(exports.makeDir(dir), function(error) {
|
||||
qfs.write(fullPath,exports.toString(content));
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
//recursively create directory
|
||||
exports.makeDir = function (path) {
|
||||
|
|
|
|||
|
|
@ -188,10 +188,10 @@ angularServiceInject('$route', function($location, $routeParams) {
|
|||
* @description
|
||||
* Adds a new route definition to the `$route` service.
|
||||
*/
|
||||
when:function (path, route) {
|
||||
when: function (path, route) {
|
||||
var routeDef = routes[path];
|
||||
if (!routeDef) routeDef = routes[path] = {reloadOnSearch: true};
|
||||
if (route) extend(routeDef, route); //TODO(im): what the heck? merge two route definitions?
|
||||
if (route) extend(routeDef, route); // TODO(im): what the heck? merge two route definitions?
|
||||
dirty++;
|
||||
return routeDef;
|
||||
},
|
||||
|
|
@ -238,7 +238,7 @@ angularServiceInject('$route', function($location, $routeParams) {
|
|||
var regex = '^' + when.replace(/[\.\\\(\)\^\$]/g, "\$1") + '$',
|
||||
params = [],
|
||||
dst = {};
|
||||
forEach(when.split(/\W/), function(param){
|
||||
forEach(when.split(/\W/), function(param) {
|
||||
if (param) {
|
||||
var paramRegExp = new RegExp(":" + param + "([\\W])");
|
||||
if (regex.match(paramRegExp)) {
|
||||
|
|
@ -249,14 +249,14 @@ angularServiceInject('$route', function($location, $routeParams) {
|
|||
});
|
||||
var match = on.match(new RegExp(regex));
|
||||
if (match) {
|
||||
forEach(params, function(name, index){
|
||||
forEach(params, function(name, index) {
|
||||
dst[name] = match[index + 1];
|
||||
});
|
||||
}
|
||||
return match ? dst : null;
|
||||
}
|
||||
|
||||
function updateRoute(){
|
||||
function updateRoute() {
|
||||
var next = parseRoute(),
|
||||
last = $route.current;
|
||||
|
||||
|
|
@ -292,7 +292,7 @@ angularServiceInject('$route', function($location, $routeParams) {
|
|||
/**
|
||||
* @returns the current active route, by matching it against the URL
|
||||
*/
|
||||
function parseRoute(){
|
||||
function parseRoute() {
|
||||
// Match a route
|
||||
var params, match;
|
||||
forEach(routes, function(route, path) {
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
'use strict';
|
||||
|
||||
describe("directive", function(){
|
||||
describe("directive", function() {
|
||||
|
||||
var compile, model, element;
|
||||
|
||||
|
|
@ -20,7 +20,7 @@ describe("directive", function(){
|
|||
expect(scope.a).toEqual(123);
|
||||
});
|
||||
|
||||
describe('ng:bind', function(){
|
||||
describe('ng:bind', function() {
|
||||
it('should set text', function() {
|
||||
var scope = compile('<div ng:bind="a"></div>');
|
||||
expect(element.text()).toEqual('');
|
||||
|
|
@ -74,7 +74,7 @@ describe("directive", function(){
|
|||
});
|
||||
|
||||
|
||||
it('should suppress rendering of falsy values', function(){
|
||||
it('should suppress rendering of falsy values', function() {
|
||||
var scope = compile('<div>{{ null }}{{ undefined }}{{ "" }}-{{ 0 }}{{ false }}</div>');
|
||||
scope.$digest();
|
||||
expect(scope.$element.text()).toEqual('-0false');
|
||||
|
|
@ -82,7 +82,7 @@ describe("directive", function(){
|
|||
|
||||
});
|
||||
|
||||
describe('ng:bind-template', function(){
|
||||
describe('ng:bind-template', function() {
|
||||
it('should ng:bind-template', function() {
|
||||
var scope = compile('<div ng:bind-template="Hello {{name}}!"></div>');
|
||||
scope.name = 'Misko';
|
||||
|
|
@ -91,9 +91,9 @@ describe("directive", function(){
|
|||
expect(element.text()).toEqual('Hello Misko!');
|
||||
});
|
||||
|
||||
it('should have $element set to current bind element', function(){
|
||||
it('should have $element set to current bind element', function() {
|
||||
var innerText;
|
||||
angularFilter.myFilter = function(text){
|
||||
angularFilter.myFilter = function(text) {
|
||||
innerText = innerText || this.$element.text();
|
||||
return text;
|
||||
};
|
||||
|
|
@ -105,22 +105,22 @@ describe("directive", function(){
|
|||
|
||||
});
|
||||
|
||||
describe('ng:bind-attr', function(){
|
||||
it('should bind attributes', function(){
|
||||
describe('ng:bind-attr', function() {
|
||||
it('should bind attributes', function() {
|
||||
var scope = compile('<div ng:bind-attr="{src:\'http://localhost/mysrc\', alt:\'myalt\'}"/>');
|
||||
scope.$digest();
|
||||
expect(element.attr('src')).toEqual('http://localhost/mysrc');
|
||||
expect(element.attr('alt')).toEqual('myalt');
|
||||
});
|
||||
|
||||
it('should not pretty print JSON in attributes', function(){
|
||||
it('should not pretty print JSON in attributes', function() {
|
||||
var scope = compile('<img alt="{{ {a:1} }}"/>');
|
||||
scope.$digest();
|
||||
expect(element.attr('alt')).toEqual('{"a":1}');
|
||||
});
|
||||
});
|
||||
|
||||
it('should remove special attributes on false', function(){
|
||||
it('should remove special attributes on false', function() {
|
||||
var scope = compile('<input ng:bind-attr="{disabled:\'{{disabled}}\', readonly:\'{{readonly}}\', checked:\'{{checked}}\'}"/>');
|
||||
var input = scope.$element[0];
|
||||
expect(input.disabled).toEqual(false);
|
||||
|
|
@ -138,7 +138,7 @@ describe("directive", function(){
|
|||
});
|
||||
|
||||
describe('ng:click', function(){
|
||||
it('should get called on a click', function(){
|
||||
it('should get called on a click', function() {
|
||||
var scope = compile('<div ng:click="clicked = true"></div>');
|
||||
scope.$digest();
|
||||
expect(scope.clicked).toBeFalsy();
|
||||
|
|
@ -296,7 +296,7 @@ describe("directive", function(){
|
|||
});
|
||||
|
||||
|
||||
it('should ng:class odd/even', function(){
|
||||
it('should ng:class odd/even', function() {
|
||||
var scope = compile('<ul><li ng:repeat="i in [0,1]" class="existing" ng:class-odd="\'odd\'" ng:class-even="\'even\'"></li><ul>');
|
||||
scope.$digest();
|
||||
var e1 = jqLite(element[0].childNodes[1]);
|
||||
|
|
@ -351,8 +351,8 @@ describe("directive", function(){
|
|||
});
|
||||
|
||||
|
||||
describe('ng:style', function(){
|
||||
it('should set', function(){
|
||||
describe('ng:style', function() {
|
||||
it('should set', function() {
|
||||
var scope = compile('<div ng:style="{height: \'40px\'}"></div>');
|
||||
scope.$digest();
|
||||
expect(element.css('height')).toEqual('40px');
|
||||
|
|
@ -364,7 +364,7 @@ describe("directive", function(){
|
|||
expect(element.hasClass('ng-exception')).toBeFalsy();
|
||||
});
|
||||
|
||||
it('should preserve and remove previous style', function(){
|
||||
it('should preserve and remove previous style', function() {
|
||||
var scope = compile('<div style="height: 10px;" ng:style="myStyle"></div>');
|
||||
scope.$digest();
|
||||
expect(getStyle(element)).toEqual({height: '10px'});
|
||||
|
|
@ -385,7 +385,7 @@ describe("directive", function(){
|
|||
|
||||
|
||||
describe('ng:show', function() {
|
||||
it('should show and hide an element', function(){
|
||||
it('should show and hide an element', function() {
|
||||
var element = jqLite('<div ng:show="exp"></div>'),
|
||||
scope = compile(element);
|
||||
|
||||
|
|
@ -420,13 +420,13 @@ describe("directive", function(){
|
|||
});
|
||||
});
|
||||
|
||||
describe('ng:controller', function(){
|
||||
describe('ng:controller', function() {
|
||||
|
||||
var temp;
|
||||
|
||||
beforeEach(function(){
|
||||
beforeEach(function() {
|
||||
temp = window.temp = {};
|
||||
temp.Greeter = function(){
|
||||
temp.Greeter = function() {
|
||||
this.$root.greeter = this;
|
||||
this.greeting = 'hello';
|
||||
this.suffix = '!';
|
||||
|
|
@ -438,18 +438,18 @@ describe("directive", function(){
|
|||
};
|
||||
});
|
||||
|
||||
afterEach(function(){
|
||||
afterEach(function() {
|
||||
window.temp = undefined;
|
||||
});
|
||||
|
||||
it('should bind', function(){
|
||||
it('should bind', function() {
|
||||
var scope = compile('<div ng:controller="temp.Greeter"></div>');
|
||||
expect(scope.greeter.greeting).toEqual('hello');
|
||||
expect(scope.greeter.greet('misko')).toEqual('hello misko!');
|
||||
});
|
||||
|
||||
it('should support nested controllers', function(){
|
||||
temp.ChildGreeter = function(){
|
||||
it('should support nested controllers', function() {
|
||||
temp.ChildGreeter = function() {
|
||||
this.greeting = 'hey';
|
||||
this.$root.childGreeter = this;
|
||||
};
|
||||
|
|
@ -478,7 +478,7 @@ describe("directive", function(){
|
|||
|
||||
expect(element.attr('ng:cloak')).toBe('');
|
||||
|
||||
angular.compile(element)
|
||||
angular.compile(element);
|
||||
|
||||
expect(element.attr('ng:cloak')).toBeUndefined();
|
||||
});
|
||||
|
|
|
|||
|
|
@ -160,7 +160,7 @@ describe("markups", function(){
|
|||
expect(sortedHtml(element)).toEqual('<div ng:bind-attr="{"' + name +'":"some"}"></div>');
|
||||
dealoc(element);
|
||||
});
|
||||
})
|
||||
});
|
||||
|
||||
it('should Parse Text With No Bindings', function(){
|
||||
var parts = parseBindings("a");
|
||||
|
|
|
|||
|
|
@ -43,6 +43,5 @@ describe('$locale', function() {
|
|||
expect($locale.pluralCat(0)).toBe('other');
|
||||
expect($locale.pluralCat(2)).toBe('other');
|
||||
expect($locale.pluralCat(1)).toBe('one');
|
||||
})
|
||||
});
|
||||
});
|
||||
|
||||
|
|
|
|||
|
|
@ -3,14 +3,14 @@
|
|||
describe('$route', function() {
|
||||
var scope, $route, $location;
|
||||
|
||||
beforeEach(function(){
|
||||
beforeEach(function() {
|
||||
scope = angular.scope();
|
||||
$location = scope.$service('$location');
|
||||
$route = scope.$service('$route');
|
||||
});
|
||||
|
||||
|
||||
it('should route and fire change event', function(){
|
||||
it('should route and fire change event', function() {
|
||||
var log = '',
|
||||
lastRoute,
|
||||
nextRoute;
|
||||
|
|
@ -19,15 +19,15 @@ describe('$route', function() {
|
|||
log += '<init>;';
|
||||
}
|
||||
|
||||
$route.when('/Book/:book/Chapter/:chapter', {controller: BookChapter, template:'Chapter.html'});
|
||||
$route.when('/Book/:book/Chapter/:chapter', {controller: BookChapter, template: 'Chapter.html'});
|
||||
$route.when('/Blank');
|
||||
scope.$on('$beforeRouteChange', function(event, next, current){
|
||||
scope.$on('$beforeRouteChange', function(event, next, current) {
|
||||
log += 'before();';
|
||||
expect(current).toBe($route.current);
|
||||
lastRoute = current;
|
||||
nextRoute = next;
|
||||
});
|
||||
scope.$on('$afterRouteChange', function(event, current, last){
|
||||
scope.$on('$afterRouteChange', function(event, current, last) {
|
||||
log += 'after();';
|
||||
expect(current).toBe($route.current);
|
||||
expect(lastRoute).toBe(last);
|
||||
|
|
@ -58,6 +58,7 @@ describe('$route', function() {
|
|||
expect($route.current.template).toEqual('instant update');
|
||||
});
|
||||
|
||||
|
||||
it('should change route even when only search param changes', function() {
|
||||
var callback = jasmine.createSpy('onRouteChange');
|
||||
|
||||
|
|
@ -120,9 +121,10 @@ describe('$route', function() {
|
|||
expect(onChangeSpy).toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it('should $destroy old routes', function(){
|
||||
$route.when('/foo', {template: 'foo.html', controller: function(){ this.name = 'FOO';}});
|
||||
$route.when('/bar', {template: 'bar.html', controller: function(){ this.name = 'BAR';}});
|
||||
|
||||
it('should $destroy old routes', function() {
|
||||
$route.when('/foo', {template: 'foo.html', controller: function() {this.name = 'FOO';}});
|
||||
$route.when('/bar', {template: 'bar.html', controller: function() {this.name = 'BAR';}});
|
||||
$route.when('/baz', {template: 'baz.html'});
|
||||
|
||||
expect(scope.$childHead).toEqual(null);
|
||||
|
|
@ -220,6 +222,7 @@ describe('$route', function() {
|
|||
}
|
||||
});
|
||||
|
||||
|
||||
it('should replace the url when redirecting', function() {
|
||||
$route.when('/bar/:id', {template: 'bar.html'});
|
||||
$route.when('/foo/:id/:extra', {redirectTo: '/bar/:id'});
|
||||
|
|
@ -240,7 +243,7 @@ describe('$route', function() {
|
|||
|
||||
describe('reloadOnSearch', function() {
|
||||
it('should reload a route when reloadOnSearch is enabled and .search() changes', function() {
|
||||
var $rouetParams = scope.$service('$routeParams'),
|
||||
var $routeParams = scope.$service('$routeParams'),
|
||||
reloaded = jasmine.createSpy('route reload');
|
||||
|
||||
$route.when('/foo', {controller: FooCtrl});
|
||||
|
|
@ -253,14 +256,14 @@ describe('$route', function() {
|
|||
$location.path('/foo');
|
||||
scope.$digest();
|
||||
expect(reloaded).toHaveBeenCalled();
|
||||
expect($rouetParams).toEqual({});
|
||||
expect($routeParams).toEqual({});
|
||||
reloaded.reset();
|
||||
|
||||
// trigger reload
|
||||
$location.search({foo: 'bar'});
|
||||
scope.$digest();
|
||||
expect(reloaded).toHaveBeenCalled();
|
||||
expect($rouetParams).toEqual({foo:'bar'});
|
||||
expect($routeParams).toEqual({foo:'bar'});
|
||||
});
|
||||
|
||||
|
||||
|
|
@ -367,9 +370,9 @@ describe('$route', function() {
|
|||
});
|
||||
|
||||
|
||||
describe('reload', function(){
|
||||
describe('reload', function() {
|
||||
|
||||
it('should reload even if reloadOnSearch is false', function(){
|
||||
it('should reload even if reloadOnSearch is false', function() {
|
||||
var $routeParams = scope.$service('$routeParams'),
|
||||
count = 0;
|
||||
|
||||
|
|
@ -393,6 +396,5 @@ describe('$route', function() {
|
|||
expect(count).toEqual(2);
|
||||
});
|
||||
});
|
||||
|
||||
});
|
||||
});
|
||||
|
|
|
|||
Loading…
Reference in a new issue