')($rootScope);
- assertEquals($rootScope.a, 123);
+ expect($rootScope.a).toBe(123);
}));
it('ExecuteInitializationStatements', inject(function($rootScope, $compile) {
$compile('
')($rootScope);
- assertEquals($rootScope.a, 123);
- assertEquals($rootScope.b, 345);
+ expect($rootScope.a).toBe(123);
+ expect($rootScope.b).toBe(345);
}));
it('ApplyTextBindings', inject(function($rootScope, $compile) {
var element = $compile('
x
')($rootScope);
$rootScope.model = {a:123};
$rootScope.$apply();
- assertEquals('123', element.text());
+ expect(element.text()).toBe('123');
}));
it('ReplaceBindingInTextWithSpan preserve surounding text', function() {
- assertEquals(this.compileToHtml("
a{{b}}c"), '
ac');
+ expect(this.compileToHtml("
a{{b}}c")).toBe('
ac');
});
it('ReplaceBindingInTextWithSpan', function() {
- assertEquals(this.compileToHtml("
{{b}}"), '
');
+ expect(this.compileToHtml("
{{b}}")).toBe('
');
});
it('BindingSpaceConfusesIE', inject(function($rootScope, $compile) {
@@ -61,48 +61,47 @@ describe('Binder', function() {
var span = document.createElement("span");
span.innerHTML = ' ';
var nbsp = span.firstChild.nodeValue;
- assertEquals(
- '
'+nbsp+'',
- this.compileToHtml("
{{a}} {{b}}"));
+ expect(this.compileToHtml("
{{a}} {{b}}")).
+ toBe('
' + nbsp + '');
dealoc(($rootScope));
- assertEquals(
- '
'+nbsp+'x '+nbsp+'()',
- this.compileToHtml("
{{A}} x {{B}} ({{C}})"));
+ expect(this.compileToHtml("
{{A}} x {{B}} ({{C}})")).
+ toBe('
' + nbsp + 'x ' +
+ '' + nbsp + '()');
}));
it('BindingOfAttributes', inject(function($rootScope, $compile) {
var element = $compile("
")($rootScope);
var attrbinding = element.attr("ng:bind-attr");
var bindings = fromJson(attrbinding);
- assertEquals("http://s/a{{b}}c", decodeURI(bindings.href));
- assertTrue(!bindings.foo);
+ expect(decodeURI(bindings.href)).toBe("http://s/a{{b}}c");
+ expect(bindings.foo).toBeFalsy();
}));
it('MarkMultipleAttributes', inject(function($rootScope, $compile) {
var element = $compile('
')($rootScope);
var attrbinding = element.attr("ng:bind-attr");
var bindings = fromJson(attrbinding);
- assertEquals(bindings.foo, "{{d}}");
- assertEquals(decodeURI(bindings.href), "http://s/a{{b}}c");
+ expect(bindings.foo).toBe("{{d}}");
+ expect(decodeURI(bindings.href)).toBe("http://s/a{{b}}c");
}));
it('AttributesNoneBound', inject(function($rootScope, $compile) {
var a = $compile("
")($rootScope);
- assertEquals(a[0].nodeName, "A");
- assertTrue(!a.attr("ng:bind-attr"));
+ expect(a[0].nodeName).toBe("A");
+ expect(a.attr("ng:bind-attr")).toBeFalsy();
}));
it('ExistingAttrbindingIsAppended', inject(function($rootScope, $compile) {
var a = $compile("
")($rootScope);
- assertEquals('{"b":"{{def}}","href":"http://s/{{abc}}"}', a.attr('ng:bind-attr'));
+ expect(a.attr('ng:bind-attr')).toBe('{"b":"{{def}}","href":"http://s/{{abc}}"}');
}));
it('AttributesAreEvaluated', inject(function($rootScope, $compile) {
var a = $compile('
')($rootScope);
$rootScope.$eval('a=1;b=2');
$rootScope.$apply();
- assertEquals(a.attr('a'), 'a');
- assertEquals(a.attr('b'), 'a+b=3');
+ expect(a.attr('a')).toBe('a');
+ expect(a.attr('b')).toBe('a+b=3');
}));
it('InputTypeButtonActionExecutesInScope', inject(function($rootScope, $compile) {
@@ -114,7 +113,7 @@ describe('Binder', function() {
savedCalled = true;
};
browserTrigger(element, 'click');
- assertTrue(savedCalled);
+ expect(savedCalled).toBe(true);
}));
it('InputTypeButtonActionExecutesInScope2', inject(function($rootScope, $compile) {
@@ -136,7 +135,7 @@ describe('Binder', function() {
savedCalled = true;
};
browserTrigger(element, 'click');
- assertTrue(savedCalled);
+ expect(savedCalled).toBe(true);
}));
it('RepeaterUpdateBindings', inject(function($rootScope, $compile) {
@@ -148,28 +147,31 @@ describe('Binder', function() {
$rootScope.model = {items:items};
$rootScope.$apply();
- assertEquals('
' +
+ expect(sortedHtml(form)).toBe(
+ '' +
'<#comment>#comment>' +
'- A
' +
'- B
' +
- '
', sortedHtml(form));
+ '
');
items.unshift({a:'C'});
$rootScope.$apply();
- assertEquals('
' +
+ expect(sortedHtml(form)).toBe(
+ '' +
'<#comment>#comment>' +
'- C
' +
'- A
' +
'- B
' +
- '
', sortedHtml(form));
+ '
');
items.shift();
$rootScope.$apply();
- assertEquals('
' +
+ expect(sortedHtml(form)).toBe(
+ '' +
'<#comment>#comment>' +
'- A
' +
'- B
' +
- '
', sortedHtml(form));
+ '
');
items.shift();
items.shift();
@@ -183,15 +185,16 @@ describe('Binder', function() {
'')($rootScope);
$rootScope.model = {items:[{a:"A"}]};
$rootScope.$apply();
- assertEquals('
' +
+ expect(sortedHtml(element)).toBe(
+ '' +
'<#comment>#comment>' +
'- A
' +
- '
', sortedHtml(element));
+ '
');
}));
it('DoNotOverwriteCustomAction', function() {
var html = this.compileToHtml('
');
- assertTrue(html.indexOf('action="foo();"') > 0 );
+ expect(html.indexOf('action="foo();"')).toBeGreaterThan(0);
});
it('RepeaterAdd', inject(function($rootScope, $compile, $browser) {
@@ -242,11 +245,11 @@ describe('Binder', function() {
$rootScope.error['throw'] = function() {throw "MyError";};
errorLogs.length = 0;
$rootScope.$apply();
- assertEquals(['MyError'], errorLogs.shift());
+ expect(errorLogs.shift()).toBe('MyError');
$rootScope.error['throw'] = function() {return "ok";};
$rootScope.$apply();
- assertEquals(0, errorLogs.length);
+ expect(errorLogs.length).toBe(0);
})
);
@@ -281,18 +284,20 @@ describe('Binder', function() {
$rootScope.model = [{name:'a', item:['a1', 'a2']}, {name:'b', item:['b1', 'b2']}];
$rootScope.$apply();
- assertEquals('
'+
- '<#comment>#comment>'+
- '
'+
+ expect(sortedHtml(element)).toBe(
+ '
'+
'<#comment>#comment>'+
- '
'+
- '
'+
- '
'+
- '
'+
- '<#comment>#comment>'+
- '
'+
- '
'+
- '
', sortedHtml(element));
+ '
'+
+ '<#comment>#comment>'+
+ '
'+
+ '
'+
+ '
'+
+ '
'+
+ '<#comment>#comment>'+
+ '
'+
+ '
'+
+ '
' +
+ '
');
}));
it('HideBindingExpression', inject(function($rootScope, $compile) {
@@ -354,12 +359,12 @@ describe('Binder', function() {
$rootScope.clazz = 'testClass';
$rootScope.$apply();
- assertEquals('
', sortedHtml(element));
+ expect(sortedHtml(element)).toBe('
');
$rootScope.clazz = ['a', 'b'];
$rootScope.$apply();
- assertEquals('
', sortedHtml(element));
+ expect(sortedHtml(element)).toBe('
');
}));
it('BindClassEvenOdd', inject(function($rootScope, $compile) {
@@ -372,11 +377,10 @@ describe('Binder', function() {
var d2 = jqLite(element[0].childNodes[2]);
expect(d1.hasClass('o')).toBeTruthy();
expect(d2.hasClass('e')).toBeTruthy();
- assertEquals(
+ expect(sortedHtml(element)).toBe(
'
<#comment>#comment>' +
'
' +
- '
',
- sortedHtml(element));
+ '
');
}));
it('BindStyle', inject(function($rootScope, $compile) {
@@ -385,7 +389,7 @@ describe('Binder', function() {
$rootScope.$eval('style={height: "10px"}');
$rootScope.$apply();
- assertEquals("10px", element.css('height'));
+ expect(element.css('height')).toBe("10px");
$rootScope.$eval('style={}');
$rootScope.$apply();
@@ -414,7 +418,7 @@ describe('Binder', function() {
"