Skip to content
This repository was archived by the owner on Apr 12, 2024. It is now read-only.

Fix unit tests on FF4, Opera #364

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion src/Angular.js
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,8 @@ function forEachSorted(obj, iterator, context) {
function formatError(arg) {
if (arg instanceof Error) {
if (arg.stack) {
arg = arg.stack;
arg = (arg.message && arg.stack.indexOf(arg.message) === -1) ?
'Error: ' + arg.message + '\n' + arg.stack : arg.stack;
} else if (arg.sourceURL) {
arg = arg.message + '\n' + arg.sourceURL + ':' + arg.line;
}
Expand Down
4 changes: 2 additions & 2 deletions test/BinderSpec.js
Original file line number Diff line number Diff line change
Expand Up @@ -425,10 +425,10 @@ describe('Binder', function(){
it('BindStyle', function(){
var scope = this.compile('<div ng:style="style"/>');

scope.$eval('style={color:"red"}');
scope.$eval('style={height: "10px"}');
scope.$eval();

assertEquals("red", scope.$element.css('color'));
assertEquals("10px", scope.$element.css('height'));

scope.$eval('style={}');
scope.$eval();
Expand Down
14 changes: 7 additions & 7 deletions test/directivesSpec.js
Original file line number Diff line number Diff line change
Expand Up @@ -196,9 +196,9 @@ describe("directive", function(){

describe('ng:style', function(){
it('should set', function(){
var scope = compile('<div ng:style="{color:\'red\'}"></div>');
var scope = compile('<div ng:style="{height: \'40px\'}"></div>');
scope.$eval();
expect(element.css('color')).toEqual('red');
expect(element.css('height')).toEqual('40px');
});

it('should silently ignore undefined style', function() {
Expand All @@ -208,15 +208,15 @@ describe("directive", function(){
});

it('should preserve and remove previous style', function(){
var scope = compile('<div style="color:red;" ng:style="myStyle"></div>');
var scope = compile('<div style="height: 10px;" ng:style="myStyle"></div>');
scope.$eval();
expect(getStyle(element)).toEqual({color:'red'});
scope.myStyle = {color:'blue', width:'10px'};
expect(getStyle(element)).toEqual({height: '10px'});
scope.myStyle = {height: '20px', width: '10px'};
scope.$eval();
expect(getStyle(element)).toEqual({color:'blue', width:'10px'});
expect(getStyle(element)).toEqual({height: '20px', width: '10px'});
scope.myStyle = {};
scope.$eval();
expect(getStyle(element)).toEqual({color:'red'});
expect(getStyle(element)).toEqual({height: '10px'});
});
});

Expand Down
12 changes: 6 additions & 6 deletions test/scenario/dslSpec.js
Original file line number Diff line number Diff line change
Expand Up @@ -273,15 +273,15 @@ describe("angular.scenario.dsl", function() {
});

it('should get css', function() {
doc.append('<div id="test" style="border: 1px solid red"></div>');
$root.dsl.element('#test').css('border');
expect($root.futureResult).toMatch(/red/);
doc.append('<div id="test" style="height: 30px"></div>');
$root.dsl.element('#test').css('height');
expect($root.futureResult).toMatch(/30px/);
});

it('should set css', function() {
doc.append('<div id="test" style="border: 1px solid red"></div>');
$root.dsl.element('#test').css('border', '1px solid green');
expect(doc.find('#test').css('border')).toMatch(/green/);
doc.append('<div id="test" style="height: 10px"></div>');
$root.dsl.element('#test').css('height', '20px');
expect(doc.find('#test').css('height')).toEqual('20px');
});

it('should add all jQuery key/value methods', function() {
Expand Down