aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/servicesSpec.js28
-rw-r--r--test/widgetsSpec.js10
2 files changed, 26 insertions, 12 deletions
diff --git a/test/servicesSpec.js b/test/servicesSpec.js
index 88cbc947..dec4550f 100644
--- a/test/servicesSpec.js
+++ b/test/servicesSpec.js
@@ -14,21 +14,35 @@ describe("services", function(){
});
it("should inject $location", function(){
- scope.$location('http://host:1234/p/a/t/h?query=value#path?key=value');
- expect(scope.$location.href).toEqual("http://host:123/p/a/t/h?query=value#path?key=value");
+ scope.$location('http://host:123/p/a/t/h.html?query=value#path?key=value');
+ expect(scope.$location.href).toEqual("http://host:123/p/a/t/h.html?query=value#path?key=value");
expect(scope.$location.protocol).toEqual("http");
expect(scope.$location.host).toEqual("host");
- expect(scope.$location.port).toEqual("1234");
- expect(scope.$location.path).toEqual("/p/a/t/h");
+ expect(scope.$location.port).toEqual("123");
+ expect(scope.$location.path).toEqual("/p/a/t/h.html");
expect(scope.$location.search).toEqual({query:'value'});
expect(scope.$location.hash).toEqual('path?key=value');
expect(scope.$location.hashPath).toEqual('path');
expect(scope.$location.hashSearch).toEqual({key:'value'});
- scope.$anchor.path = 'page=http://path';
- scope.$anchor.param = {k:'a=b'};
+ scope.$location.hashPath = 'page=http://path';
+ scope.$location.hashSearch = {k:'a=b'};
- expect(scope.$anchor()).toEqual('page=http://path?k=a%3Db');
+ expect(scope.$location()).toEqual('http://host:123/p/a/t/h.html?query=value#path?key=valuepage=http://path?k=a%3Db');
+ });
+
+ it('should parse file://', function(){
+ scope.$location('file:///Users/Shared/misko/work/angular.js/scenario/widgets.html');
+ expect(scope.$location.href).toEqual("file:///Users/Shared/misko/work/angular.js/scenario/widgets.html");
+ expect(scope.$location.protocol).toEqual("file");
+ expect(scope.$location.host).toEqual("");
+ expect(scope.$location.port).toEqual(null);
+ expect(scope.$location.path).toEqual("/Users/Shared/misko/work/angular.js/scenario/widgets.html");
+ expect(scope.$location.search).toEqual({});
+ expect(scope.$location.hash).toEqual('');
+ expect(scope.$location.hashPath).toEqual('');
+ expect(scope.$location.hashSearch).toEqual({});
+ expect(scope.$location()).toEqual('file:///Users/Shared/misko/work/angular.js/scenario/widgets.html');
});
});
diff --git a/test/widgetsSpec.js b/test/widgetsSpec.js
index 6123e229..6c47e5dd 100644
--- a/test/widgetsSpec.js
+++ b/test/widgetsSpec.js
@@ -114,23 +114,23 @@ describe("input widget", function(){
it('should type="checkbox"', function(){
compile('<input type="checkbox" name="checkbox" checked ng-change="action = true"/>');
- expect(scope.$get('checkbox')).toEqual(true);
+ expect(scope.checkbox).toEqual(true);
element.click();
- expect(scope.$get('checkbox')).toEqual(false);
- expect(scope.$get('action')).toEqual(true);
+ expect(scope.checkbox).toEqual(false);
+ expect(scope.action).toEqual(true);
element.click();
- expect(scope.$get('checkbox')).toEqual(true);
+ expect(scope.checkbox).toEqual(true);
});
it('should type="radio"', function(){
compile('<div>' +
'<input type="radio" name="chose" value="A" ng-change="clicked = 1"/>' +
'<input type="radio" name="chose" value="B" checked ng-change="clicked = 2"/>' +
+ '<input type="radio" name="chose" value="C" ng-change="clicked = 3"/>' +
'</div>');
var a = element[0].childNodes[0];
var b = element[0].childNodes[1];
expect(scope.chose).toEqual('B');
- expect(scope.clicked).not.toBeDefined();
scope.chose = 'A';
scope.$eval();
expect(a.checked).toEqual(true);