mirror of
https://github.com/zhigang1992/angular.js.git
synced 2026-06-05 20:01:00 +08:00
various bug fixes
This commit is contained in:
@@ -250,3 +250,7 @@ ApiTest.prototype.testStringFromUTC = function(){
|
||||
assertEquals("2003-09-10T13:02:03Z", angular.Date.toString(date));
|
||||
assertEquals("str", angular.String.toDate("str"));
|
||||
};
|
||||
|
||||
ApiTest.prototype.testObjectShouldHaveExtend = function(){
|
||||
assertEquals(angular.Object.extend, extend);
|
||||
};
|
||||
|
||||
@@ -12,7 +12,7 @@ ValidatorTest.prototype.testItShouldHaveThisSet = function() {
|
||||
scope.$init();
|
||||
assertEquals('misko', validator.first);
|
||||
assertEquals('hevery', validator.last);
|
||||
assertSame(scope, validator._this);
|
||||
assertSame(scope, validator._this.__proto__);
|
||||
delete angular.validator.myValidator;
|
||||
scope.$element.remove();
|
||||
};
|
||||
|
||||
@@ -47,6 +47,11 @@ describe("markups", function(){
|
||||
expect(element.html()).toEqual('<option value="A">A</option>');
|
||||
});
|
||||
|
||||
it('should process all bindings when we have leading space', function(){
|
||||
compile('<a> {{a}}<br/>{{b}}</a>');
|
||||
expect(sortedHtml(scope.$element)).toEqual('<a> <span ng-bind="a"></span><br></br><span ng-bind="b"></span></a>');
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
|
||||
|
||||
@@ -42,6 +42,20 @@ describe("services", function(){
|
||||
expect(scope.$location.toString()).toEqual('file:///Users/Shared/misko/work/angular.js/scenario/widgets.html#');
|
||||
});
|
||||
|
||||
it('should update url on hash change', function(){
|
||||
scope.$location.parse('http://server/#path?a=b');
|
||||
scope.$location.hash = '';
|
||||
expect(scope.$location.toString()).toEqual('http://server/#');
|
||||
expect(scope.$location.hashPath).toEqual('');
|
||||
});
|
||||
|
||||
it('should update url on hashPath change', function(){
|
||||
scope.$location.parse('http://server/#path?a=b');
|
||||
scope.$location.hashPath = '';
|
||||
expect(scope.$location.toString()).toEqual('http://server/#?a=b');
|
||||
expect(scope.$location.hash).toEqual('?a=b');
|
||||
});
|
||||
|
||||
xit('should add stylesheets', function(){
|
||||
scope.$document = {
|
||||
getElementsByTagName: function(name){
|
||||
|
||||
@@ -207,13 +207,18 @@ describe("input widget", function(){
|
||||
|
||||
describe('ng:switch', function(){
|
||||
it("should match urls", function(){
|
||||
var scope = compile('<ng:switch on="url" using="route"><div ng-switch-when="/Book/:name">{{name}}</div></ng:include>');
|
||||
var scope = compile('<ng:switch on="url" using="route:params"><div ng-switch-when="/Book/:name">{{params.name}}</div></ng:include>');
|
||||
scope.url = '/Book/Moby';
|
||||
scope.$init();
|
||||
// jstestdriver.console.log('text');
|
||||
expect(scope.$element.text()).toEqual('Moby');
|
||||
});
|
||||
|
||||
it("should match sandwich ids", function(){
|
||||
var scope = {};
|
||||
var match = angular.widget['NG:SWITCH'].route.call(scope, '/a/123/b', '/a/:id');
|
||||
expect(match).toBeFalsy();
|
||||
});
|
||||
|
||||
it('should call init on switch', function(){
|
||||
var scope = compile('<ng:switch on="url" change="name=\'works\'"><div ng-switch-when="a">{{name}}</div></ng:include>');
|
||||
scope.url = 'a';
|
||||
|
||||
Reference in New Issue
Block a user