style: fix some missing semi-colons and spaces, typos

This commit is contained in:
Vojta Jina
2011-09-01 16:16:01 +02:00
parent 292d5d1421
commit 4b4292edb8
7 changed files with 52 additions and 51 deletions

View File

@@ -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();
});

View File

@@ -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");

View File

@@ -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');
})
});
});

View File

@@ -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);
});
});
});
});