mirror of
https://github.com/zhigang1992/angular.js.git
synced 2026-04-23 19:40:56 +08:00
Merge branch 'master' of github.com:angular/angular.js into future
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
describe('compiler', function(){
|
||||
var compiler, textMarkup, directives, widgets, compile, log;
|
||||
var compiler, markup, directives, widgets, compile, log;
|
||||
|
||||
beforeEach(function(){
|
||||
log = "";
|
||||
@@ -20,10 +20,10 @@ describe('compiler', function(){
|
||||
}
|
||||
|
||||
};
|
||||
textMarkup = [];
|
||||
markup = [];
|
||||
attrMarkup = [];
|
||||
widgets = extensionMap({}, 'widget');
|
||||
compiler = new Compiler(textMarkup, attrMarkup, directives, widgets);
|
||||
compiler = new Compiler(markup, attrMarkup, directives, widgets);
|
||||
compile = function(html){
|
||||
var e = jqLite("<div>" + html + "</div>");
|
||||
var scope = compiler.compile(e)(e);
|
||||
@@ -94,7 +94,7 @@ describe('compiler', function(){
|
||||
});
|
||||
|
||||
it('should process markup before directives', function(){
|
||||
textMarkup.push(function(text, textNode, parentNode) {
|
||||
markup.push(function(text, textNode, parentNode) {
|
||||
if (text == 'middle') {
|
||||
expect(textNode.text()).toEqual(text);
|
||||
parentNode.attr('hello', text);
|
||||
@@ -126,7 +126,7 @@ describe('compiler', function(){
|
||||
this.directives(true);
|
||||
return noop;
|
||||
};
|
||||
textMarkup.push(function(text, textNode, parent){
|
||||
markup.push(function(text, textNode, parent){
|
||||
if (text == '{{1+2}}')
|
||||
parent.text('3');
|
||||
});
|
||||
|
||||
@@ -160,13 +160,15 @@ describe("directives", function(){
|
||||
expect(scope.$get('count')).toEqual(1);
|
||||
});
|
||||
|
||||
it('should ng:click', function(){
|
||||
var scope = compile('<div ng:click="clicked = true"></div>');
|
||||
scope.$eval();
|
||||
expect(scope.$get('clicked')).toBeFalsy();
|
||||
describe('ng:click', function(){
|
||||
it('should fire event', function(){
|
||||
var scope = compile('<div ng:click="clicked = true"></div>');
|
||||
scope.$eval();
|
||||
expect(scope.$get('clicked')).toBeFalsy();
|
||||
|
||||
element.trigger('click');
|
||||
expect(scope.$get('clicked')).toEqual(true);
|
||||
element.trigger('click');
|
||||
expect(scope.$get('clicked')).toEqual(true);
|
||||
});
|
||||
});
|
||||
|
||||
it('should ng:class', function(){
|
||||
|
||||
@@ -91,7 +91,7 @@ describe("service", function(){
|
||||
scope.$location.hashPath = 'page=http://path';
|
||||
scope.$location.hashSearch = {k:'a=b'};
|
||||
|
||||
expect(scope.$location.toString()).toEqual('http://host:123/p/a/t/h.html?query=value#page=http://path?k=a%3Db');
|
||||
expect(scope.$location.toString()).toEqual('http://host:123/p/a/t/h.html?query=value#page%3Dhttp%3A//path?k=a%3Db');
|
||||
});
|
||||
|
||||
it('should parse file://', function(){
|
||||
@@ -106,7 +106,7 @@ describe("service", function(){
|
||||
expect(scope.$location.hashPath).toEqual('');
|
||||
expect(scope.$location.hashSearch).toEqual({});
|
||||
|
||||
expect(scope.$location.toString()).toEqual('file:///Users/Shared/misko/work/angular.js/scenario/widgets.html#');
|
||||
expect(scope.$location.toString()).toEqual('file:///Users/Shared/misko/work/angular.js/scenario/widgets.html');
|
||||
});
|
||||
|
||||
it('should update url on hash change', function(){
|
||||
@@ -123,6 +123,14 @@ describe("service", function(){
|
||||
expect(scope.$location.hash).toEqual('?a=b');
|
||||
});
|
||||
|
||||
it("should parse url which contains - in host", function(){
|
||||
scope.$location.parse('http://a-b1.c-d.09/path');
|
||||
expect(scope.$location.href).toEqual('http://a-b1.c-d.09/path');
|
||||
expect(scope.$location.protocol).toEqual('http');
|
||||
expect(scope.$location.host).toEqual('a-b1.c-d.09');
|
||||
expect(scope.$location.path).toEqual('/path');
|
||||
});
|
||||
|
||||
it('should update hash before any processing', function(){
|
||||
var scope = compile('<div>');
|
||||
var log = '';
|
||||
@@ -136,15 +144,6 @@ describe("service", function(){
|
||||
scope.$eval();
|
||||
expect(log).toEqual('/abc;');
|
||||
});
|
||||
|
||||
it("should parse url which contains - in host", function(){
|
||||
scope.$location.parse('http://a-b1.c-d.09/path');
|
||||
expect(scope.$location.href).toEqual('http://a-b1.c-d.09/path');
|
||||
expect(scope.$location.protocol).toEqual('http');
|
||||
expect(scope.$location.host).toEqual('a-b1.c-d.09');
|
||||
expect(scope.$location.path).toEqual('/path');
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
describe("$invalidWidgets", function(){
|
||||
|
||||
Reference in New Issue
Block a user